added window always on top option
This commit is contained in:
@@ -19,15 +19,16 @@ namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
AccountPopupWidget::AccountPopupWidget(std::shared_ptr<Channel> channel)
|
||||
: QWidget(nullptr)
|
||||
: BaseWidget()
|
||||
, _ui(new Ui::AccountPopup)
|
||||
, _channel(channel)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
|
||||
resize(0, 0);
|
||||
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->initAsWindow();
|
||||
|
||||
resize(0, 0);
|
||||
|
||||
SettingsManager &settings = SettingsManager::getInstance();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "basewidget.hpp"
|
||||
#include "concurrentmap.hpp"
|
||||
#include "twitch/twitchchannel.hpp"
|
||||
|
||||
@@ -18,7 +19,7 @@ class Channel;
|
||||
|
||||
namespace widgets {
|
||||
|
||||
class AccountPopupWidget : public QWidget
|
||||
class AccountPopupWidget : public BaseWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "widgets/basewidget.hpp"
|
||||
#include "colorscheme.hpp"
|
||||
#include "settingsmanager.hpp"
|
||||
|
||||
//#include <QApplication>
|
||||
#include <QDebug>
|
||||
@@ -28,6 +29,12 @@ BaseWidget::BaseWidget(BaseWidget *parent)
|
||||
this->init();
|
||||
}
|
||||
|
||||
BaseWidget::BaseWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, colorScheme(*ColorScheme::instance)
|
||||
{
|
||||
}
|
||||
|
||||
float BaseWidget::getDpiMultiplier()
|
||||
{
|
||||
BaseWidget *baseWidget = dynamic_cast<BaseWidget *>(this->window());
|
||||
@@ -60,6 +67,10 @@ void BaseWidget::initAsWindow()
|
||||
this->dpiMultiplier = dpi.value() / 96.f;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SettingsManager::getInstance().windowTopMost.getValue()) {
|
||||
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseWidget::refreshTheme()
|
||||
|
||||
@@ -21,6 +21,8 @@ public:
|
||||
|
||||
explicit BaseWidget(BaseWidget *parent);
|
||||
|
||||
explicit BaseWidget(QWidget *parent = nullptr);
|
||||
|
||||
ColorScheme &colorScheme;
|
||||
|
||||
float getDpiMultiplier();
|
||||
|
||||
@@ -6,15 +6,19 @@ namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
QualityPopup::QualityPopup(const QString &channel, const QString &path, QStringList options)
|
||||
: channel(channel)
|
||||
: BaseWidget()
|
||||
, channel(channel)
|
||||
, path(path)
|
||||
{
|
||||
this->initAsWindow();
|
||||
|
||||
this->ui.okButton.setText("OK");
|
||||
this->ui.cancelButton.setText("Cancel");
|
||||
|
||||
QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, &QualityPopup::okButtonClicked);
|
||||
QObject::connect(&this->ui.okButton, &QPushButton::clicked, this,
|
||||
&QualityPopup::okButtonClicked);
|
||||
QObject::connect(&this->ui.cancelButton, &QPushButton::clicked, this,
|
||||
&QualityPopup::cancelButtonClicked);
|
||||
&QualityPopup::cancelButtonClicked);
|
||||
|
||||
this->ui.buttonBox.addButton(&this->ui.okButton, QDialogButtonBox::ButtonRole::AcceptRole);
|
||||
this->ui.buttonBox.addButton(&this->ui.cancelButton, QDialogButtonBox::ButtonRole::RejectRole);
|
||||
@@ -29,7 +33,8 @@ QualityPopup::QualityPopup(const QString &channel, const QString &path, QStringL
|
||||
this->setLayout(&this->ui.vbox);
|
||||
}
|
||||
|
||||
void QualityPopup::showDialog(const QString &channel, const QString &path, QStringList options) {
|
||||
void QualityPopup::showDialog(const QString &channel, const QString &path, QStringList options)
|
||||
{
|
||||
static QualityPopup *instance = new QualityPopup(channel, path, options);
|
||||
|
||||
instance->show();
|
||||
@@ -38,9 +43,10 @@ void QualityPopup::showDialog(const QString &channel, const QString &path, QStri
|
||||
instance->setFocus();
|
||||
}
|
||||
|
||||
void QualityPopup::okButtonClicked() {
|
||||
void QualityPopup::okButtonClicked()
|
||||
{
|
||||
QProcess::startDetached(this->path,
|
||||
{"twitch.tv/" + this->channel, this->ui.selector.currentText()});
|
||||
{"twitch.tv/" + this->channel, this->ui.selector.currentText()});
|
||||
this->close();
|
||||
}
|
||||
|
||||
@@ -49,5 +55,5 @@ void QualityPopup::cancelButtonClicked()
|
||||
this->close();
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
#ifndef QUALITYPOPUP_H
|
||||
#define QUALITYPOPUP_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#include "basewidget.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
namespace widgets {
|
||||
|
||||
class QualityPopup : public QWidget
|
||||
class QualityPopup : public BaseWidget
|
||||
{
|
||||
public:
|
||||
QualityPopup(const QString &channel, const QString &path, QStringList options);
|
||||
static void showDialog(const QString &channel, const QString &path, QStringList options);
|
||||
|
||||
private:
|
||||
struct {
|
||||
QVBoxLayout vbox;
|
||||
@@ -25,7 +28,7 @@ private:
|
||||
QPushButton okButton;
|
||||
QPushButton cancelButton;
|
||||
} ui;
|
||||
|
||||
|
||||
QString channel;
|
||||
QString path;
|
||||
|
||||
@@ -33,7 +36,7 @@ private:
|
||||
void cancelButtonClicked();
|
||||
};
|
||||
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // QUALITYPOPUP_H
|
||||
#endif // QUALITYPOPUP_H
|
||||
|
||||
@@ -23,11 +23,14 @@ namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
SettingsDialog::SettingsDialog()
|
||||
: snapshot(SettingsManager::getInstance().createSnapshot())
|
||||
: BaseWidget()
|
||||
, snapshot(SettingsManager::getInstance().createSnapshot())
|
||||
, usernameDisplayMode(
|
||||
"/appearance/messages/usernameDisplayMode",
|
||||
twitch::TwitchMessageBuilder::UsernameDisplayMode::UsernameAndLocalizedName)
|
||||
{
|
||||
this->initAsWindow();
|
||||
|
||||
QFile file(":/qss/settings.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
@@ -328,7 +331,8 @@ QVBoxLayout *SettingsDialog::createBehaviourTab()
|
||||
|
||||
auto form = new QFormLayout();
|
||||
|
||||
form->addRow("Window:", createCheckbox("Window always on top", settings.windowTopMost));
|
||||
form->addRow("Window:",
|
||||
createCheckbox("Window always on top (requires restart)", settings.windowTopMost));
|
||||
// form->addRow("Messages:", createCheckbox("Mention users with a @ (except in
|
||||
// commands)",
|
||||
// settings.mentionUsersWithAt));
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
#include <QWidget>
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
|
||||
#include "basewidget.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
namespace widgets {
|
||||
|
||||
class SettingsDialog : public QWidget
|
||||
class SettingsDialog : public BaseWidget
|
||||
{
|
||||
public:
|
||||
SettingsDialog();
|
||||
|
||||
Reference in New Issue
Block a user