Renamed private members

This commit is contained in:
fourtf
2018-07-06 19:23:47 +02:00
parent 6935619820
commit 280bb4cf8e
141 changed files with 1754 additions and 1861 deletions
+12 -12
View File
@@ -15,16 +15,16 @@ namespace chatterino {
EmotePopup::EmotePopup()
: BaseWindow(nullptr, BaseWindow::EnableCustomFrame)
{
this->viewEmotes = new ChannelView();
this->viewEmojis = new ChannelView();
this->viewEmotes_ = new ChannelView();
this->viewEmojis_ = new ChannelView();
this->viewEmotes->setOverrideFlags(MessageElement::Flags(
this->viewEmotes_->setOverrideFlags(MessageElement::Flags(
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
this->viewEmojis->setOverrideFlags(MessageElement::Flags(
this->viewEmojis_->setOverrideFlags(MessageElement::Flags(
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
this->viewEmotes->setEnableScrollingToBottom(false);
this->viewEmojis->setEnableScrollingToBottom(false);
this->viewEmotes_->setEnableScrollingToBottom(false);
this->viewEmojis_->setEnableScrollingToBottom(false);
auto *layout = new QVBoxLayout(this);
this->getLayoutContainer()->setLayout(layout);
@@ -33,14 +33,14 @@ EmotePopup::EmotePopup()
layout->addWidget(notebook);
layout->setMargin(0);
notebook->addPage(this->viewEmotes, "Emotes");
notebook->addPage(this->viewEmojis, "Emojis");
notebook->addPage(this->viewEmotes_, "Emotes");
notebook->addPage(this->viewEmojis_, "Emojis");
this->loadEmojis();
this->viewEmotes->linkClicked.connect(
this->viewEmotes_->linkClicked.connect(
[this](const Link &link) { this->linkClicked.invoke(link); });
this->viewEmojis->linkClicked.connect(
this->viewEmojis_->linkClicked.connect(
[this](const Link &link) { this->linkClicked.invoke(link); });
}
@@ -127,7 +127,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
addEmotes(*channel->ffzChannelEmotes.get(), "FrankerFaceZ Channel Emotes",
"FrankerFaceZ Channel Emote");
this->viewEmotes->setChannel(emoteChannel);
this->viewEmotes_->setChannel(emoteChannel);
}
void EmotePopup::loadEmojis()
@@ -155,7 +155,7 @@ void EmotePopup::loadEmojis()
});
emojiChannel->addMessage(builder.getMessage());
this->viewEmojis->setChannel(emojiChannel);
this->viewEmojis_->setChannel(emojiChannel);
}
} // namespace chatterino
+2 -2
View File
@@ -19,8 +19,8 @@ public:
pajlada::Signals::Signal<Link> linkClicked;
private:
ChannelView *viewEmotes;
ChannelView *viewEmojis;
ChannelView *viewEmotes_;
ChannelView *viewEmojis_;
};
} // namespace chatterino
+59 -57
View File
@@ -63,22 +63,22 @@ void LogInWithCredentials(const std::string &userID, const std::string &username
BasicLoginWidget::BasicLoginWidget()
{
this->setLayout(&this->ui.layout);
this->setLayout(&this->ui_.layout);
this->ui.loginButton.setText("Log in (Opens in browser)");
this->ui.pasteCodeButton.setText("Paste code");
this->ui_.loginButton.setText("Log in (Opens in browser)");
this->ui_.pasteCodeButton.setText("Paste code");
this->ui.horizontalLayout.addWidget(&this->ui.loginButton);
this->ui.horizontalLayout.addWidget(&this->ui.pasteCodeButton);
this->ui_.horizontalLayout.addWidget(&this->ui_.loginButton);
this->ui_.horizontalLayout.addWidget(&this->ui_.pasteCodeButton);
this->ui.layout.addLayout(&this->ui.horizontalLayout);
this->ui_.layout.addLayout(&this->ui_.horizontalLayout);
connect(&this->ui.loginButton, &QPushButton::clicked, []() {
connect(&this->ui_.loginButton, &QPushButton::clicked, []() {
printf("open login in browser\n");
QDesktopServices::openUrl(QUrl("https://chatterino.com/client_login"));
});
connect(&this->ui.pasteCodeButton, &QPushButton::clicked, [this]() {
connect(&this->ui_.pasteCodeButton, &QPushButton::clicked, [this]() {
QClipboard *clipboard = QGuiApplication::clipboard();
QString clipboardString = clipboard->text();
QStringList parameters = clipboardString.split(';');
@@ -115,78 +115,80 @@ BasicLoginWidget::BasicLoginWidget()
AdvancedLoginWidget::AdvancedLoginWidget()
{
this->setLayout(&this->ui.layout);
this->setLayout(&this->ui_.layout);
this->ui.instructionsLabel.setText("1. Fill in your username\n2. Fill in your user ID or press "
"the 'Get user ID from username' button\n3. Fill in your "
"Client ID\n4. Fill in your OAuth Token\n5. Press Add User");
this->ui.instructionsLabel.setWordWrap(true);
this->ui_.instructionsLabel.setText(
"1. Fill in your username\n2. Fill in your user ID or press "
"the 'Get user ID from username' button\n3. Fill in your "
"Client ID\n4. Fill in your OAuth Token\n5. Press Add User");
this->ui_.instructionsLabel.setWordWrap(true);
this->ui.layout.addWidget(&this->ui.instructionsLabel);
this->ui.layout.addLayout(&this->ui.formLayout);
this->ui.layout.addLayout(&this->ui.buttonUpperRow.layout);
this->ui.layout.addLayout(&this->ui.buttonLowerRow.layout);
this->ui_.layout.addWidget(&this->ui_.instructionsLabel);
this->ui_.layout.addLayout(&this->ui_.formLayout);
this->ui_.layout.addLayout(&this->ui_.buttonUpperRow.layout);
this->ui_.layout.addLayout(&this->ui_.buttonLowerRow.layout);
this->refreshButtons();
/// Form
this->ui.formLayout.addRow("Username", &this->ui.usernameInput);
this->ui.formLayout.addRow("User ID", &this->ui.userIDInput);
this->ui.formLayout.addRow("Client ID", &this->ui.clientIDInput);
this->ui.formLayout.addRow("Oauth token", &this->ui.oauthTokenInput);
this->ui_.formLayout.addRow("Username", &this->ui_.usernameInput);
this->ui_.formLayout.addRow("User ID", &this->ui_.userIDInput);
this->ui_.formLayout.addRow("Client ID", &this->ui_.clientIDInput);
this->ui_.formLayout.addRow("Oauth token", &this->ui_.oauthTokenInput);
this->ui.oauthTokenInput.setEchoMode(QLineEdit::Password);
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
connect(&this->ui.userIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui.usernameInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui.clientIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui.oauthTokenInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
/// Upper button row
this->ui.buttonUpperRow.addUserButton.setText("Add user");
this->ui.buttonUpperRow.clearFieldsButton.setText("Clear fields");
this->ui_.buttonUpperRow.addUserButton.setText("Add user");
this->ui_.buttonUpperRow.clearFieldsButton.setText("Clear fields");
this->ui.buttonUpperRow.layout.addWidget(&this->ui.buttonUpperRow.addUserButton);
this->ui.buttonUpperRow.layout.addWidget(&this->ui.buttonUpperRow.clearFieldsButton);
this->ui_.buttonUpperRow.layout.addWidget(&this->ui_.buttonUpperRow.addUserButton);
this->ui_.buttonUpperRow.layout.addWidget(&this->ui_.buttonUpperRow.clearFieldsButton);
connect(&this->ui.buttonUpperRow.clearFieldsButton, &QPushButton::clicked, [=]() {
this->ui.userIDInput.clear();
this->ui.usernameInput.clear();
this->ui.clientIDInput.clear();
this->ui.oauthTokenInput.clear();
connect(&this->ui_.buttonUpperRow.clearFieldsButton, &QPushButton::clicked, [=]() {
this->ui_.userIDInput.clear();
this->ui_.usernameInput.clear();
this->ui_.clientIDInput.clear();
this->ui_.oauthTokenInput.clear();
});
connect(&this->ui.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
std::string userID = this->ui.userIDInput.text().toStdString();
std::string username = this->ui.usernameInput.text().toStdString();
std::string clientID = this->ui.clientIDInput.text().toStdString();
std::string oauthToken = this->ui.oauthTokenInput.text().toStdString();
connect(&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
std::string userID = this->ui_.userIDInput.text().toStdString();
std::string username = this->ui_.usernameInput.text().toStdString();
std::string clientID = this->ui_.clientIDInput.text().toStdString();
std::string oauthToken = this->ui_.oauthTokenInput.text().toStdString();
LogInWithCredentials(userID, username, clientID, oauthToken);
});
/// Lower button row
this->ui.buttonLowerRow.fillInUserIDButton.setText("Get user ID from username");
this->ui_.buttonLowerRow.fillInUserIDButton.setText("Get user ID from username");
this->ui.buttonLowerRow.layout.addWidget(&this->ui.buttonLowerRow.fillInUserIDButton);
this->ui_.buttonLowerRow.layout.addWidget(&this->ui_.buttonLowerRow.fillInUserIDButton);
connect(&this->ui.buttonLowerRow.fillInUserIDButton, &QPushButton::clicked, [=]() {
twitchApiGetUserID(this->ui.usernameInput.text(), this, [=](const QString &userID) {
this->ui.userIDInput.setText(userID); //
connect(&this->ui_.buttonLowerRow.fillInUserIDButton, &QPushButton::clicked, [=]() {
twitchApiGetUserID(this->ui_.usernameInput.text(), this, [=](const QString &userID) {
this->ui_.userIDInput.setText(userID); //
});
});
}
void AdvancedLoginWidget::refreshButtons()
{
this->ui.buttonLowerRow.fillInUserIDButton.setEnabled(!this->ui.usernameInput.text().isEmpty());
this->ui_.buttonLowerRow.fillInUserIDButton.setEnabled(
!this->ui_.usernameInput.text().isEmpty());
if (this->ui.userIDInput.text().isEmpty() || this->ui.usernameInput.text().isEmpty() ||
this->ui.clientIDInput.text().isEmpty() || this->ui.oauthTokenInput.text().isEmpty()) {
this->ui.buttonUpperRow.addUserButton.setEnabled(false);
if (this->ui_.userIDInput.text().isEmpty() || this->ui_.usernameInput.text().isEmpty() ||
this->ui_.clientIDInput.text().isEmpty() || this->ui_.oauthTokenInput.text().isEmpty()) {
this->ui_.buttonUpperRow.addUserButton.setEnabled(false);
} else {
this->ui.buttonUpperRow.addUserButton.setEnabled(true);
this->ui_.buttonUpperRow.addUserButton.setEnabled(true);
}
}
@@ -197,21 +199,21 @@ LoginWidget::LoginWidget()
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#endif
this->setLayout(&this->ui.mainLayout);
this->setLayout(&this->ui_.mainLayout);
this->ui.mainLayout.addWidget(&this->ui.tabWidget);
this->ui_.mainLayout.addWidget(&this->ui_.tabWidget);
this->ui.tabWidget.addTab(&this->ui.basic, "Basic");
this->ui_.tabWidget.addTab(&this->ui_.basic, "Basic");
this->ui.tabWidget.addTab(&this->ui.advanced, "Advanced");
this->ui_.tabWidget.addTab(&this->ui_.advanced, "Advanced");
this->ui.buttonBox.setStandardButtons(QDialogButtonBox::Close);
this->ui_.buttonBox.setStandardButtons(QDialogButtonBox::Close);
QObject::connect(&this->ui.buttonBox, &QDialogButtonBox::rejected, [this]() {
QObject::connect(&this->ui_.buttonBox, &QDialogButtonBox::rejected, [this]() {
this->close(); //
});
this->ui.mainLayout.addWidget(&this->ui.buttonBox);
this->ui_.mainLayout.addWidget(&this->ui_.buttonBox);
}
} // namespace chatterino
+3 -3
View File
@@ -29,7 +29,7 @@ public:
QHBoxLayout horizontalLayout;
QPushButton loginButton;
QPushButton pasteCodeButton;
} ui;
} ui_;
};
class AdvancedLoginWidget : public QWidget
@@ -63,7 +63,7 @@ public:
QPushButton fillInUserIDButton;
} buttonLowerRow;
} ui;
} ui_;
};
class LoginWidget : public QDialog
@@ -82,7 +82,7 @@ private:
BasicLoginWidget basic;
AdvancedLoginWidget advanced;
} ui;
} ui_;
};
} // namespace chatterino
+5 -5
View File
@@ -16,15 +16,15 @@ public:
void setInfo(std::shared_ptr<Channel> channel, QString userName);
private:
ChannelView *channelView_ = nullptr;
ChannelPtr channel_ = Channel::getEmpty();
QString userName_;
void initLayout();
void setMessages(std::vector<MessagePtr> &messages);
void getOverrustleLogs();
void getLogviewerLogs();
ChannelView *channelView_ = nullptr;
ChannelPtr channel_ = Channel::getEmpty();
QString userName_;
};
} // namespace chatterino
+5 -5
View File
@@ -10,17 +10,17 @@ namespace chatterino {
NotificationPopup::NotificationPopup()
: BaseWindow((QWidget *)nullptr, BaseWindow::Frameless)
, channel(std::make_shared<Channel>("notifications", Channel::Type::None))
, channel_(std::make_shared<Channel>("notifications", Channel::Type::None))
{
this->channelView = new ChannelView(this);
this->channelView_ = new ChannelView(this);
auto *layout = new QVBoxLayout(this);
this->setLayout(layout);
layout->addWidget(this->channelView);
layout->addWidget(this->channelView_);
this->channelView->setChannel(this->channel);
this->channelView_->setChannel(this->channel_);
this->setScaleIndependantSize(300, 150);
}
@@ -40,7 +40,7 @@ void NotificationPopup::updatePosition()
void NotificationPopup::addMessage(MessagePtr msg)
{
this->channel->addMessage(msg);
this->channel_->addMessage(msg);
// QTimer::singleShot(5000, this, [this, msg] { this->channel->remove });
}
+2 -2
View File
@@ -18,8 +18,8 @@ public:
void updatePosition();
private:
ChannelView *channelView;
ChannelPtr channel;
ChannelView *channelView_;
ChannelPtr channel_;
};
} // namespace chatterino
+3 -3
View File
@@ -5,7 +5,7 @@
namespace chatterino {
QualityPopup::QualityPopup(const QString &_channelName, QStringList options)
: channelName(_channelName)
: channelName_(_channelName)
{
this->ui_.okButton.setText("OK");
this->ui_.cancelButton.setText("Cancel");
@@ -41,10 +41,10 @@ void QualityPopup::showDialog(const QString &channelName, QStringList options)
void QualityPopup::okButtonClicked()
{
QString channelURL = "twitch.tv/" + this->channelName;
QString channelURL = "twitch.tv/" + this->channelName_;
try {
OpenStreamlink(channelURL, this->ui_.selector.currentText());
openStreamlink(channelURL, this->ui_.selector.currentText());
} catch (const Exception &ex) {
Log("Exception caught trying to open streamlink: {}", ex.what());
}
+4 -4
View File
@@ -16,6 +16,9 @@ public:
static void showDialog(const QString &_channelName, QStringList options);
private:
void okButtonClicked();
void cancelButtonClicked();
struct {
QVBoxLayout vbox;
QComboBox selector;
@@ -24,10 +27,7 @@ private:
QPushButton cancelButton;
} ui_;
QString channelName;
void okButtonClicked();
void cancelButtonClicked();
QString channelName_;
};
} // namespace chatterino
+14 -14
View File
@@ -17,11 +17,11 @@ namespace chatterino {
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
: BaseWindow(parent, BaseWindow::EnableCustomFrame)
, selectedChannel(Channel::getEmpty())
, selectedChannel_(Channel::getEmpty())
{
this->setWindowTitle("Select a channel to join");
this->tabFilter.dialog = this;
this->tabFilter_.dialog = this;
LayoutCreator<QWidget> layoutWidget(this->getLayoutContainer());
auto layout = layoutWidget.setLayoutType<QVBoxLayout>().withoutMargin();
@@ -50,8 +50,8 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
channel_lbl->setVisible(enabled);
});
channel_btn->installEventFilter(&this->tabFilter);
channel_edit->installEventFilter(&this->tabFilter);
channel_btn->installEventFilter(&this->tabFilter_);
channel_edit->installEventFilter(&this->tabFilter_);
// whispers_btn
auto whispers_btn =
@@ -61,7 +61,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
.hidden();
whispers_lbl->setWordWrap(true);
whispers_btn->installEventFilter(&this->tabFilter);
whispers_btn->installEventFilter(&this->tabFilter_);
QObject::connect(whispers_btn.getElement(), &QRadioButton::toggled,
[=](bool enabled) mutable { whispers_lbl->setVisible(enabled); });
@@ -74,7 +74,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
.hidden();
mentions_lbl->setWordWrap(true);
mentions_btn->installEventFilter(&this->tabFilter);
mentions_btn->installEventFilter(&this->tabFilter_);
QObject::connect(mentions_btn.getElement(), &QRadioButton::toggled,
[=](bool enabled) mutable { mentions_lbl->setVisible(enabled); });
@@ -86,7 +86,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
vbox.emplace<QLabel>("Requires the chatterino browser extension.").hidden();
watching_lbl->setWordWrap(true);
watching_btn->installEventFilter(&this->tabFilter);
watching_btn->installEventFilter(&this->tabFilter_);
QObject::connect(watching_btn.getElement(), &QRadioButton::toggled,
[=](bool enabled) mutable { watching_lbl->setVisible(enabled); });
@@ -138,7 +138,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
void SelectChannelDialog::ok()
{
this->_hasSelectedChannel = true;
this->hasSelectedChannel_ = true;
this->close();
}
@@ -148,7 +148,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
assert(channel);
this->selectedChannel = channel;
this->selectedChannel_ = channel;
switch (_channel.getType()) {
case Channel::Type::Twitch: {
@@ -174,13 +174,13 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
}
}
this->_hasSelectedChannel = false;
this->hasSelectedChannel_ = false;
}
IndirectChannel SelectChannelDialog::getSelectedChannel() const
{
if (!this->_hasSelectedChannel) {
return this->selectedChannel;
if (!this->hasSelectedChannel_) {
return this->selectedChannel_;
}
auto app = getApp();
@@ -199,12 +199,12 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
}
}
return this->selectedChannel;
return this->selectedChannel_;
}
bool SelectChannelDialog::hasSeletedChannel() const
{
return this->_hasSelectedChannel;
return this->hasSelectedChannel_;
}
bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched, QEvent *event)
+4 -4
View File
@@ -16,7 +16,7 @@ class SelectChannelDialog : public BaseWindow
public:
SelectChannelDialog(QWidget *parent = nullptr);
void setSelectedChannel(IndirectChannel selectedChannel);
void setSelectedChannel(IndirectChannel selectedChannel_);
IndirectChannel getSelectedChannel() const;
bool hasSeletedChannel() const;
@@ -47,10 +47,10 @@ private:
} twitch;
} ui_;
EventFilter tabFilter;
EventFilter tabFilter_;
ChannelPtr selectedChannel;
bool _hasSelectedChannel = false;
ChannelPtr selectedChannel_;
bool hasSelectedChannel_ = false;
void ok();
friend class EventFilter;
+16 -18
View File
@@ -28,7 +28,6 @@ SettingsDialog::SettingsDialog()
: BaseWindow(nullptr, BaseWindow::DisableCustomScaling)
{
this->initUi();
this->addTabs();
this->scaleChangedEvent(this->getScale());
@@ -63,10 +62,9 @@ void SettingsDialog::initUi()
this->ui_.tabContainerContainer->setObjectName("tabWidget");
this->ui_.pageStack->setObjectName("pages");
QObject::connect(this->ui_.okButton, &QPushButton::clicked, this,
&SettingsDialog::okButtonClicked);
QObject::connect(this->ui_.okButton, &QPushButton::clicked, this, &SettingsDialog::onOkClicked);
QObject::connect(this->ui_.cancelButton, &QPushButton::clicked, this,
&SettingsDialog::cancelButtonClicked);
&SettingsDialog::onCancelClicked);
}
SettingsDialog *SettingsDialog::getHandle()
@@ -111,25 +109,25 @@ void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment)
this->ui_.pageStack->addWidget(page);
this->ui_.tabContainer->addWidget(tab, 0, alignment);
this->tabs.push_back(tab);
this->tabs_.push_back(tab);
if (this->tabs.size() == 1) {
this->select(tab);
if (this->tabs_.size() == 1) {
this->selectTab(tab);
}
}
void SettingsDialog::select(SettingsDialogTab *tab)
void SettingsDialog::selectTab(SettingsDialogTab *tab)
{
this->ui_.pageStack->setCurrentWidget(tab->getSettingsPage());
if (this->selectedTab != nullptr) {
this->selectedTab->setSelected(false);
this->selectedTab->setStyleSheet("color: #FFF");
if (this->selectedTab_ != nullptr) {
this->selectedTab_->setSelected(false);
this->selectedTab_->setStyleSheet("color: #FFF");
}
tab->setSelected(true);
tab->setStyleSheet("background: #555; color: #FFF");
this->selectedTab = tab;
this->selectedTab_ = tab;
}
void SettingsDialog::showDialog(PreferredTab preferredTab)
@@ -139,7 +137,7 @@ void SettingsDialog::showDialog(PreferredTab preferredTab)
switch (preferredTab) {
case SettingsDialog::PreferredTab::Accounts: {
instance->select(instance->tabs.at(0));
instance->selectTab(instance->tabs_.at(0));
} break;
}
@@ -153,7 +151,7 @@ void SettingsDialog::refresh()
{
getApp()->settings->saveSnapshot();
for (auto *tab : this->tabs) {
for (auto *tab : this->tabs_) {
tab->getSettingsPage()->onShow();
}
}
@@ -166,7 +164,7 @@ void SettingsDialog::scaleChangedEvent(float newDpi)
styleSheet.replace("<font-size>", QString::number(int(14 * newDpi)));
styleSheet.replace("<checkbox-size>", QString::number(int(14 * newDpi)));
for (SettingsDialogTab *tab : this->tabs) {
for (SettingsDialogTab *tab : this->tabs_) {
tab->setFixedHeight(int(30 * newDpi));
}
@@ -185,14 +183,14 @@ void SettingsDialog::themeChangedEvent()
}
///// Widget creation helpers
void SettingsDialog::okButtonClicked()
void SettingsDialog::onOkClicked()
{
this->close();
}
void SettingsDialog::cancelButtonClicked()
void SettingsDialog::onCancelClicked()
{
for (auto &tab : this->tabs) {
for (auto &tab : this->tabs_) {
tab->getSettingsPage()->cancel();
}
+12 -16
View File
@@ -32,9 +32,18 @@ protected:
virtual void themeChangedEvent() override;
private:
void refresh();
static SettingsDialog *handle;
void refresh();
void initUi();
void addTabs();
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
void selectTab(SettingsDialogTab *tab);
void onOkClicked();
void onCancelClicked();
struct {
QWidget *tabContainerContainer;
QVBoxLayout *tabContainer;
@@ -42,23 +51,10 @@ private:
QPushButton *okButton;
QPushButton *cancelButton;
} ui_;
std::vector<SettingsDialogTab *> tabs;
void initUi();
void addTabs();
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
void select(SettingsDialogTab *tab);
SettingsDialogTab *selectedTab = nullptr;
void okButtonClicked();
void cancelButtonClicked();
std::vector<SettingsDialogTab *> tabs_;
SettingsDialogTab *selectedTab_ = nullptr;
friend class SettingsDialogTab;
// static void setChildrensFont(QLayout *object, QFont &font, int indent = 0);
};
} // namespace chatterino
+28 -18
View File
@@ -5,40 +5,50 @@ namespace chatterino {
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
, _vbox(this)
, _okButton("OK")
, _cancelButton("Cancel")
, vbox_(this)
, okButton_("OK")
, cancelButton_("Cancel")
{
_vbox.addWidget(&_lineEdit);
_vbox.addLayout(&_buttonBox);
_buttonBox.addStretch(1);
_buttonBox.addWidget(&_okButton);
_buttonBox.addWidget(&_cancelButton);
this->vbox_.addWidget(&lineEdit_);
this->vbox_.addLayout(&buttonBox_);
this->buttonBox_.addStretch(1);
this->buttonBox_.addWidget(&okButton_);
this->buttonBox_.addWidget(&cancelButton_);
QObject::connect(&_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
QObject::connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
QObject::connect(&this->okButton_, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
QObject::connect(&this->cancelButton_, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
Qt::MSWindowsFixedSizeDialogHint);
this->setWindowFlags((this->windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
Qt::MSWindowsFixedSizeDialogHint);
}
QString TextInputDialog::getText() const
{
return this->lineEdit_.text();
}
void TextInputDialog::setText(const QString &text)
{
this->lineEdit_.setText(text);
}
void TextInputDialog::okButtonClicked()
{
accept();
close();
this->accept();
this->close();
}
void TextInputDialog::cancelButtonClicked()
{
reject();
close();
this->reject();
this->close();
}
void TextInputDialog::highlightText()
{
this->_lineEdit.selectAll();
this->lineEdit_.selectAll();
}
} // namespace chatterino
+7 -14
View File
@@ -16,24 +16,17 @@ class TextInputDialog : public QDialog
public:
TextInputDialog(QWidget *parent = nullptr);
QString getText() const
{
return _lineEdit.text();
}
void setText(const QString &text)
{
_lineEdit.setText(text);
}
QString getText() const;
void setText(const QString &text);
void highlightText();
private:
QVBoxLayout _vbox;
QLineEdit _lineEdit;
QHBoxLayout _buttonBox;
QPushButton _okButton;
QPushButton _cancelButton;
QVBoxLayout vbox_;
QLineEdit lineEdit_;
QHBoxLayout buttonBox_;
QPushButton okButton_;
QPushButton cancelButton_;
private slots:
void okButtonClicked();
+3 -3
View File
@@ -94,7 +94,7 @@ UserInfoPopup::UserInfoPopup()
[this] { this->channel_->sendMessage("/unmod " + this->userName_); });
// userstate
this->userStateChanged.connect([this, mod, unmod]() mutable {
this->userStateChanged_.connect([this, mod, unmod]() mutable {
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
if (twitchChannel) {
@@ -118,7 +118,7 @@ UserInfoPopup::UserInfoPopup()
{
auto timeout = moderation.emplace<TimeoutWidget>();
this->userStateChanged.connect([this, lineMod, timeout]() mutable {
this->userStateChanged_.connect([this, lineMod, timeout]() mutable {
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
if (twitchChannel) {
@@ -232,7 +232,7 @@ void UserInfoPopup::setData(const QString &name, const ChannelPtr &channel)
this->updateUserData();
this->userStateChanged.invoke();
this->userStateChanged_.invoke();
}
void UserInfoPopup::updateUserData()
+5 -6
View File
@@ -24,6 +24,10 @@ protected:
virtual void themeChangedEvent() override;
private:
void installEvents();
void updateUserData();
void loadAvatar(const QUrl &url);
bool isMod_;
bool isBroadcaster_;
@@ -31,12 +35,7 @@ private:
QString userId_;
ChannelPtr channel_;
pajlada::Signals::NoArgSignal userStateChanged;
void installEvents();
void updateUserData();
void loadAvatar(const QUrl &url);
pajlada::Signals::NoArgSignal userStateChanged_;
std::shared_ptr<bool> hack_;