Use Qt's dialog where applicable (#1843)
This commit is contained in:
@@ -123,7 +123,7 @@ QColor ColorPickerDialog::selectedColor() const
|
||||
|
||||
void ColorPickerDialog::closeEvent(QCloseEvent *)
|
||||
{
|
||||
this->closed.invoke();
|
||||
this->closed.invoke(this->selectedColor());
|
||||
}
|
||||
|
||||
void ColorPickerDialog::themeChangedEvent()
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
* You can connect to the ::closed signal of this instance to get notified
|
||||
* when the dialog is closed.
|
||||
*/
|
||||
ColorPickerDialog(const QColor &initial, QWidget *parent = nullptr);
|
||||
ColorPickerDialog(const QColor &initial, QWidget *parent);
|
||||
|
||||
~ColorPickerDialog();
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
*/
|
||||
QColor selectedColor() const;
|
||||
|
||||
pajlada::Signals::NoArgSignal closed;
|
||||
pajlada::Signals::Signal<QColor> closed;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#include "QualityPopup.hpp"
|
||||
#include "Application.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/StreamLink.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
QualityPopup::QualityPopup(const QString &_channelName, QStringList options)
|
||||
: channelName_(_channelName)
|
||||
: BasePopup({},
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())))
|
||||
, channelName_(_channelName)
|
||||
{
|
||||
this->ui_.okButton.setText("OK");
|
||||
this->ui_.cancelButton.setText("Cancel");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "widgets/BaseWindow.hpp"
|
||||
#include "widgets/BasePopup.hpp"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class QualityPopup : public BaseWindow
|
||||
class QualityPopup : public BasePopup
|
||||
{
|
||||
public:
|
||||
QualityPopup(const QString &_channelName, QStringList options);
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
namespace chatterino {
|
||||
|
||||
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
: BaseWindow(BaseWindow::EnableCustomFrame, parent)
|
||||
: BaseWindow(
|
||||
{BaseWindow::Flags::EnableCustomFrame, BaseWindow::Flags::Dialog},
|
||||
parent)
|
||||
, selectedChannel_(Channel::getEmpty())
|
||||
{
|
||||
this->setWindowTitle("Select a channel to join");
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
SettingsDialog::SettingsDialog()
|
||||
: BaseWindow(BaseWindow::DisableCustomScaling)
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: BaseWindow(
|
||||
{BaseWindow::Flags::DisableCustomScaling, BaseWindow::Flags::Dialog},
|
||||
parent)
|
||||
{
|
||||
this->setWindowTitle("Chatterino Settings");
|
||||
this->resize(815, 600);
|
||||
@@ -41,6 +43,10 @@ SettingsDialog::SettingsDialog()
|
||||
this->ui_.search->setFocus();
|
||||
this->ui_.search->selectAll();
|
||||
});
|
||||
|
||||
// Disable the ? button in the titlebar until we decide to use it
|
||||
this->setWindowFlags(this->windowFlags() &
|
||||
~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
void SettingsDialog::initUi()
|
||||
@@ -238,9 +244,10 @@ SettingsDialogTab *SettingsDialog::tab(SettingsTabId id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SettingsDialog::showDialog(SettingsDialogPreference preferredTab)
|
||||
void SettingsDialog::showDialog(QWidget *parent,
|
||||
SettingsDialogPreference preferredTab)
|
||||
{
|
||||
static SettingsDialog *instance = new SettingsDialog();
|
||||
static SettingsDialog *instance = new SettingsDialog(parent);
|
||||
static bool hasShownBefore = false;
|
||||
if (hasShownBefore)
|
||||
instance->refresh();
|
||||
|
||||
@@ -31,10 +31,11 @@ enum class SettingsDialogPreference {
|
||||
|
||||
class SettingsDialog : public BaseWindow
|
||||
{
|
||||
SettingsDialog();
|
||||
SettingsDialog(QWidget *parent);
|
||||
|
||||
public:
|
||||
static void showDialog(SettingsDialogPreference preferredTab =
|
||||
static void showDialog(QWidget *parent,
|
||||
SettingsDialogPreference preferredTab =
|
||||
SettingsDialogPreference::NoPreference);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -104,13 +104,22 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
UserInfoPopup::UserInfoPopup(bool closeAutomatically)
|
||||
: BaseWindow(
|
||||
closeAutomatically
|
||||
? FlagsEnum<BaseWindow::Flags>{BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::Frameless,
|
||||
BaseWindow::FramelessDraggable}
|
||||
: BaseWindow::EnableCustomFrame)
|
||||
#ifdef Q_OS_LINUX
|
||||
FlagsEnum<BaseWindow::Flags> userInfoPopupFlags{BaseWindow::Dialog,
|
||||
BaseWindow::EnableCustomFrame};
|
||||
FlagsEnum<BaseWindow::Flags> userInfoPopupFlagsCloseAutomatically{
|
||||
BaseWindow::EnableCustomFrame};
|
||||
#else
|
||||
FlagsEnum<BaseWindow::Flags> userInfoPopupFlags{BaseWindow::EnableCustomFrame};
|
||||
FlagsEnum<BaseWindow::Flags> userInfoPopupFlagsCloseAutomatically{
|
||||
BaseWindow::EnableCustomFrame, BaseWindow::Frameless,
|
||||
BaseWindow::FramelessDraggable};
|
||||
#endif
|
||||
|
||||
UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||
: BaseWindow(closeAutomatically ? userInfoPopupFlagsCloseAutomatically
|
||||
: userInfoPopupFlags,
|
||||
parent)
|
||||
, hack_(new bool)
|
||||
{
|
||||
this->setWindowTitle("Usercard");
|
||||
|
||||
@@ -18,7 +18,7 @@ class UserInfoPopup final : public BaseWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UserInfoPopup(bool closeAutomatically);
|
||||
UserInfoPopup(bool closeAutomatically, QWidget *parent);
|
||||
~UserInfoPopup();
|
||||
|
||||
void setData(const QString &name, const ChannelPtr &channel);
|
||||
|
||||
Reference in New Issue
Block a user