diff --git a/core.cpp b/core.cpp index 876301a63..4b081000a 100644 --- a/core.cpp +++ b/core.cpp @@ -15,9 +15,9 @@ */ #include "core.h" -#include "cdata.h" -#include "cstring.h" -#include "settings.h" +#include "misc/cdata.h" +#include "misc/cstring.h" +#include "misc/settings.h" #include "widget/widget.h" #include diff --git a/main.cpp b/main.cpp index 1cdac827e..8e981baa5 100644 --- a/main.cpp +++ b/main.cpp @@ -15,7 +15,7 @@ */ #include "widget/widget.h" -#include "settings.h" +#include "misc/settings.h" #include #include #include diff --git a/cdata.cpp b/misc/cdata.cpp similarity index 100% rename from cdata.cpp rename to misc/cdata.cpp diff --git a/cdata.h b/misc/cdata.h similarity index 100% rename from cdata.h rename to misc/cdata.h diff --git a/cstring.cpp b/misc/cstring.cpp similarity index 100% rename from cstring.cpp rename to misc/cstring.cpp diff --git a/cstring.h b/misc/cstring.h similarity index 100% rename from cstring.h rename to misc/cstring.h diff --git a/settings.cpp b/misc/settings.cpp similarity index 100% rename from settings.cpp rename to misc/settings.cpp diff --git a/settings.h b/misc/settings.h similarity index 100% rename from settings.h rename to misc/settings.h diff --git a/smileypack.cpp b/misc/smileypack.cpp similarity index 100% rename from smileypack.cpp rename to misc/smileypack.cpp diff --git a/smileypack.h b/misc/smileypack.h similarity index 100% rename from smileypack.h rename to misc/smileypack.h diff --git a/style.cpp b/misc/style.cpp similarity index 100% rename from style.cpp rename to misc/style.cpp diff --git a/style.h b/misc/style.h similarity index 100% rename from style.h rename to misc/style.h diff --git a/qtox.pro b/qtox.pro index 7b52d779c..ce7762e79 100644 --- a/qtox.pro +++ b/qtox.pro @@ -79,7 +79,7 @@ win32 { HEADERS += widget/form/addfriendform.h \ widget/form/chatform.h \ widget/form/groupchatform.h \ - widget/form/settingsform.h \ + widget/form/settingswidget.h \ widget/form/filesform.h \ widget/tool/chattextedit.h \ widget/tool/friendrequestdialog.h \ @@ -89,17 +89,17 @@ HEADERS += widget/form/addfriendform.h \ friend.h \ group.h \ grouplist.h \ - settings.h \ + misc/settings.h \ core.h \ friendlist.h \ - cdata.h \ - cstring.h \ + misc/cdata.h \ + misc/cstring.h \ widget/selfcamview.h \ widget/camera.h \ widget/netcamview.h \ - smileypack.h \ + misc/smileypack.h \ widget/emoticonswidget.h \ - style.h \ + misc/style.h \ widget/adjustingscrollarea.h \ widget/croppinglabel.h \ widget/friendlistwidget.h \ @@ -116,7 +116,7 @@ SOURCES += \ widget/form/addfriendform.cpp \ widget/form/chatform.cpp \ widget/form/groupchatform.cpp \ - widget/form/settingsform.cpp \ + widget/form/settingswidget.cpp \ widget/form/filesform.cpp \ widget/tool/chattextedit.cpp \ widget/tool/friendrequestdialog.cpp \ @@ -129,15 +129,15 @@ SOURCES += \ group.cpp \ grouplist.cpp \ main.cpp \ - settings.cpp \ - cdata.cpp \ - cstring.cpp \ + misc/settings.cpp \ + misc/cdata.cpp \ + misc/cstring.cpp \ widget/selfcamview.cpp \ widget/camera.cpp \ widget/netcamview.cpp \ - smileypack.cpp \ + misc/smileypack.cpp \ widget/emoticonswidget.cpp \ - style.cpp \ + misc/style.cpp \ widget/adjustingscrollarea.cpp \ widget/croppinglabel.cpp \ widget/friendlistwidget.cpp \ diff --git a/widget/emoticonswidget.cpp b/widget/emoticonswidget.cpp index bab7abe8d..b0ffb6028 100644 --- a/widget/emoticonswidget.cpp +++ b/widget/emoticonswidget.cpp @@ -15,8 +15,8 @@ */ #include "emoticonswidget.h" -#include "smileypack.h" -#include "style.h" +#include "misc/smileypack.h" +#include "misc/style.h" #include #include diff --git a/widget/form/genericchatform.cpp b/widget/form/genericchatform.cpp index f5681f1c6..2aff5d2a7 100644 --- a/widget/form/genericchatform.cpp +++ b/widget/form/genericchatform.cpp @@ -17,11 +17,11 @@ #include "genericchatform.h" #include "ui_mainwindow.h" #include -#include "smileypack.h" +#include "misc/smileypack.h" #include "widget/emoticonswidget.h" -#include "style.h" +#include "misc/style.h" #include "widget/widget.h" -#include "settings.h" +#include "misc/settings.h" #include "widget/tool/chataction.h" #include "widget/chatareawidget.h" #include "widget/tool/chattextedit.h" diff --git a/widget/form/settingsform.cpp b/widget/form/settingsform.cpp deleted file mode 100644 index 3d4a213da..000000000 --- a/widget/form/settingsform.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (C) 2014 by Project Tox - - This file is part of qTox, a Qt-based graphical interface for Tox. - - This program is libre software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the COPYING file for more details. -*/ - -#include "settingsform.h" -#include "widget/widget.h" -#include "settings.h" -#include "smileypack.h" -#include "ui_mainwindow.h" -#include -#include -#include -#include -#include - -SettingsForm::SettingsForm() - : QObject() -{ - main = new QWidget(), head = new QWidget(); - QFont bold, small; - bold.setBold(true); - small.setPixelSize(13); - small.setKerning(false); - headLabel.setText(tr("User Settings","\"Headline\" of the window")); - headLabel.setFont(bold); - - nameLabel.setText(tr("Name","Username/nick")); - statusTextLabel.setText(tr("Status","Status message")); - idLabel.setText("Tox ID " + tr("(click here to copy)", "Click on this text to copy TID to clipboard")); - id.setFont(small); - id.setTextInteractionFlags(Qt::TextSelectableByMouse); - id.setReadOnly(true); - id.setFrameStyle(QFrame::NoFrame); - id.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - id.setFixedHeight(id.document()->size().height()*2); - - videoTest.setText(tr("Test video","Text on a button to test the video/webcam")); - enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6")); - enableIPv6.setChecked(Settings::getInstance().getEnableIPv6()); - useTranslations.setText(tr("Use translations","Text on a checkbox to enable translations")); - useTranslations.setChecked(Settings::getInstance().getUseTranslations()); - makeToxPortable.setText(tr("Make Tox portable","Text on a checkbox to make qTox a portable application")); - makeToxPortable.setChecked(Settings::getInstance().getMakeToxPortable()); - makeToxPortable.setToolTip(tr("Save settings to the working directory instead of the usual conf dir","describes makeToxPortable checkbox")); - - smileyPackLabel.setText(tr("Smiley Pack", "Text on smiley pack label")); - for (auto entry : SmileyPack::listSmileyPacks()) - smileyPackBrowser.addItem(entry.first, entry.second); - smileyPackBrowser.setCurrentIndex(smileyPackBrowser.findData(Settings::getInstance().getSmileyPack())); - - main->setLayout(&layout); - layout.addWidget(&nameLabel); - layout.addWidget(&name); - layout.addWidget(&statusTextLabel); - layout.addWidget(&statusText); - layout.addWidget(&idLabel); - layout.addWidget(&id); - layout.addWidget(&videoTest); - layout.addWidget(&enableIPv6); - layout.addWidget(&useTranslations); - layout.addWidget(&makeToxPortable); - layout.addWidget(&smileyPackLabel); - layout.addWidget(&smileyPackBrowser); - layout.addStretch(); - - head->setLayout(&headLayout); - headLayout.addWidget(&headLabel); - - connect(&videoTest, SIGNAL(clicked()), this, SLOT(onTestVideoClicked())); - connect(&enableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated())); - connect(&useTranslations, SIGNAL(stateChanged(int)), this, SLOT(onUseTranslationUpdated())); - connect(&makeToxPortable, SIGNAL(stateChanged(int)), this, SLOT(onMakeToxPortableUpdated())); - connect(&idLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked())); - connect(&smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int))); -} - -SettingsForm::~SettingsForm() -{ -} - -void SettingsForm::setFriendAddress(const QString& friendAddress) -{ - QString txt{friendAddress}; - txt.insert(38,'\n'); - id.setText(txt); -} - -void SettingsForm::show(Ui::MainWindow &ui) -{ - name.setText(ui.nameLabel->text()); - statusText.setText(ui.statusLabel->text()); - ui.mainContent->layout()->addWidget(main); - ui.mainHead->layout()->addWidget(head); - main->show(); - head->show(); -} - -void SettingsForm::onTestVideoClicked() -{ - Widget::getInstance()->showTestCamview(); -} - -void SettingsForm::onEnableIPv6Updated() -{ - Settings::getInstance().setEnableIPv6(enableIPv6.isChecked()); -} - -void SettingsForm::copyIdClicked() -{ - id.selectAll(); - QString txt = id.toPlainText(); - txt.replace('\n',""); - QApplication::clipboard()->setText(txt); -} - -void SettingsForm::onUseTranslationUpdated() -{ - Settings::getInstance().setUseTranslations(useTranslations.isChecked()); -} - -void SettingsForm::onMakeToxPortableUpdated() -{ - Settings::getInstance().setMakeToxPortable(makeToxPortable.isChecked()); -} - -void SettingsForm::onSmileyBrowserIndexChanged(int index) -{ - QString filename = smileyPackBrowser.itemData(index).toString(); - Settings::getInstance().setSmileyPack(filename); -} diff --git a/widget/form/settingswidget.cpp b/widget/form/settingswidget.cpp new file mode 100644 index 000000000..6e2778de8 --- /dev/null +++ b/widget/form/settingswidget.cpp @@ -0,0 +1,164 @@ +/* + Copyright (C) 2014 by Project Tox + + This file is part of qTox, a Qt-based graphical interface for Tox. + + This program is libre software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the COPYING file for more details. +*/ + +#include "settingswidget.h" +#include "widget/widget.h" +#include "ui_mainwindow.h" + +SettingsWidget::SettingsWidget() + : QObject() +{ + main = new QWidget(); + // this crap is copied from ui_mainwindow.h... there's no easy way around + // just straight up copying it like this... oh well + // the layout/icons obviously need to be improved, but it's a working model, + // not a pretty one + QSizePolicy sizePolicy3(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(0); + head = new QWidget(); + head->setObjectName(QStringLiteral("head")); + head->setEnabled(true); + sizePolicy3.setHeightForWidth(head->sizePolicy().hasHeightForWidth()); + head->setSizePolicy(sizePolicy3); + QPalette palette5; + QBrush brush(QColor(255, 255, 255, 255)); + brush.setStyle(Qt::SolidPattern); + QBrush brush1(QColor(28, 28, 28, 255)); + brush1.setStyle(Qt::SolidPattern); + QBrush brush2(QColor(42, 42, 42, 255)); + brush2.setStyle(Qt::SolidPattern); + QBrush brush3(QColor(35, 35, 35, 255)); + brush3.setStyle(Qt::SolidPattern); + QBrush brush4(QColor(14, 14, 14, 255)); + brush4.setStyle(Qt::SolidPattern); + QBrush brush5(QColor(18, 18, 18, 255)); + brush5.setStyle(Qt::SolidPattern); + QBrush brush6(QColor(0, 0, 0, 255)); + brush6.setStyle(Qt::SolidPattern); + QBrush brush7(QColor(255, 255, 220, 255)); + brush7.setStyle(Qt::SolidPattern); + palette5.setBrush(QPalette::Active, QPalette::WindowText, brush); + palette5.setBrush(QPalette::Active, QPalette::Button, brush1); + palette5.setBrush(QPalette::Active, QPalette::Light, brush2); + palette5.setBrush(QPalette::Active, QPalette::Midlight, brush3); + palette5.setBrush(QPalette::Active, QPalette::Dark, brush4); + palette5.setBrush(QPalette::Active, QPalette::Mid, brush5); + palette5.setBrush(QPalette::Active, QPalette::Text, brush); + palette5.setBrush(QPalette::Active, QPalette::BrightText, brush); + palette5.setBrush(QPalette::Active, QPalette::ButtonText, brush); + palette5.setBrush(QPalette::Active, QPalette::Base, brush6); + palette5.setBrush(QPalette::Active, QPalette::Window, brush1); + palette5.setBrush(QPalette::Active, QPalette::Shadow, brush6); + palette5.setBrush(QPalette::Active, QPalette::AlternateBase, brush4); + palette5.setBrush(QPalette::Active, QPalette::ToolTipBase, brush7); + palette5.setBrush(QPalette::Active, QPalette::ToolTipText, brush6); + palette5.setBrush(QPalette::Inactive, QPalette::WindowText, brush); + palette5.setBrush(QPalette::Inactive, QPalette::Button, brush1); + palette5.setBrush(QPalette::Inactive, QPalette::Light, brush2); + palette5.setBrush(QPalette::Inactive, QPalette::Midlight, brush3); + palette5.setBrush(QPalette::Inactive, QPalette::Dark, brush4); + palette5.setBrush(QPalette::Inactive, QPalette::Mid, brush5); + palette5.setBrush(QPalette::Inactive, QPalette::Text, brush); + palette5.setBrush(QPalette::Inactive, QPalette::BrightText, brush); + palette5.setBrush(QPalette::Inactive, QPalette::ButtonText, brush); + palette5.setBrush(QPalette::Inactive, QPalette::Base, brush6); + palette5.setBrush(QPalette::Inactive, QPalette::Window, brush1); + palette5.setBrush(QPalette::Inactive, QPalette::Shadow, brush6); + palette5.setBrush(QPalette::Inactive, QPalette::AlternateBase, brush4); + palette5.setBrush(QPalette::Inactive, QPalette::ToolTipBase, brush7); + palette5.setBrush(QPalette::Inactive, QPalette::ToolTipText, brush6); + palette5.setBrush(QPalette::Disabled, QPalette::WindowText, brush4); + palette5.setBrush(QPalette::Disabled, QPalette::Button, brush1); + palette5.setBrush(QPalette::Disabled, QPalette::Light, brush2); + palette5.setBrush(QPalette::Disabled, QPalette::Midlight, brush3); + palette5.setBrush(QPalette::Disabled, QPalette::Dark, brush4); + palette5.setBrush(QPalette::Disabled, QPalette::Mid, brush5); + palette5.setBrush(QPalette::Disabled, QPalette::Text, brush4); + palette5.setBrush(QPalette::Disabled, QPalette::BrightText, brush); + palette5.setBrush(QPalette::Disabled, QPalette::ButtonText, brush4); + palette5.setBrush(QPalette::Disabled, QPalette::Base, brush1); + palette5.setBrush(QPalette::Disabled, QPalette::Window, brush1); + palette5.setBrush(QPalette::Disabled, QPalette::Shadow, brush6); + palette5.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1); + palette5.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush7); + palette5.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush6); + head->setPalette(palette5); + head->setAutoFillBackground(true); + iconsLayout = new QHBoxLayout(head); + iconsLayout->setSpacing(0); + iconsLayout->setObjectName(QStringLiteral("iconsLayout")); + iconsLayout->setContentsMargins(0, 0, 0, 0); + + generalButton = new QPushButton(head); + generalButton->setObjectName(QStringLiteral("generalButton")); + generalButton->setMinimumSize(QSize(55, 35)); + generalButton->setMaximumSize(QSize(55, 35)); + generalButton->setFocusPolicy(Qt::NoFocus); + QIcon icon1; + icon1.addFile(QStringLiteral(":/img/add.png"), QSize(), QIcon::Normal, QIcon::Off); + generalButton->setIcon(icon1); + generalButton->setFlat(true); + iconsLayout->addWidget(generalButton); + + identityButton = new QPushButton(head); + identityButton->setObjectName(QStringLiteral("identityButton")); + identityButton->setMinimumSize(QSize(55, 35)); + identityButton->setMaximumSize(QSize(55, 35)); + identityButton->setFocusPolicy(Qt::NoFocus); + QIcon icon2; + icon2.addFile(QStringLiteral(":/img/group.png"), QSize(), QIcon::Normal, QIcon::Off); + identityButton->setIcon(icon2); + identityButton->setFlat(true); + iconsLayout->addWidget(identityButton); + + privacyButton = new QPushButton(head); + privacyButton->setObjectName(QStringLiteral("privacyButton")); + privacyButton->setMinimumSize(QSize(55, 35)); + privacyButton->setMaximumSize(QSize(55, 35)); + privacyButton->setFocusPolicy(Qt::NoFocus); + QIcon icon3; + icon3.addFile(QStringLiteral(":/img/transfer.png"), QSize(), QIcon::Normal, QIcon::Off); + privacyButton->setIcon(icon3); + privacyButton->setFlat(true); + iconsLayout->addWidget(privacyButton); + + avButton = new QPushButton(head); + avButton->setObjectName(QStringLiteral("avButton")); + avButton->setMinimumSize(QSize(55, 35)); + avButton->setMaximumSize(QSize(55, 35)); + avButton->setFocusPolicy(Qt::NoFocus); + QIcon icon4; + icon4.addFile(QStringLiteral(":/img/settings.png"), QSize(), QIcon::Normal, QIcon::Off); + avButton->setIcon(icon4); + avButton->setFlat(true); + iconsLayout->addWidget(avButton); + + head->setLayout(iconsLayout); + +} + +SettingsWidget::~SettingsWidget() +{ +} + +void SettingsWidget::show(Ui::MainWindow& ui) +{ + ui.mainContent->layout()->addWidget(main); + ui.mainHead->layout()->addWidget(head); + main->show(); + head->show(); +} diff --git a/widget/form/settingsform.h b/widget/form/settingswidget.h similarity index 60% rename from widget/form/settingsform.h rename to widget/form/settingswidget.h index a081d01fb..a1cee909f 100644 --- a/widget/form/settingsform.h +++ b/widget/form/settingswidget.h @@ -14,8 +14,8 @@ See the COPYING file for more details. */ -#ifndef SETTINGSFORM_H -#define SETTINGSFORM_H +#ifndef SETTINGSWIDGET_H +#define SETTINGSWIDGET_H #include #include @@ -31,37 +31,32 @@ namespace Ui {class MainWindow;} class QString; -class SettingsForm : public QObject +class SettingsWidget : public QObject { Q_OBJECT public: - SettingsForm(); - ~SettingsForm(); + SettingsWidget(); + ~SettingsWidget(); void show(Ui::MainWindow &ui); public slots: - void setFriendAddress(const QString& friendAddress); + //void setFriendAddress(const QString& friendAddress); private slots: - void onTestVideoClicked(); - void onEnableIPv6Updated(); - void onUseTranslationUpdated(); - void onMakeToxPortableUpdated(); - void onSmileyBrowserIndexChanged(int index); - void copyIdClicked(); private: - QLabel headLabel, nameLabel, statusTextLabel, smileyPackLabel; - QTextEdit id; - CroppingLabel idLabel; - QPushButton videoTest; - QCheckBox enableIPv6, useTranslations, makeToxPortable; - QVBoxLayout layout, headLayout; QWidget *main, *head; - QComboBox smileyPackBrowser; + // the code pertaining to the icons is mostly copied from ui_mainwindow.h + QHBoxLayout *iconsLayout; + QPushButton *generalButton; + QPushButton *identityButton; + QPushButton *privacyButton; + QPushButton *avButton; + + // now the actual pages and stuff + // ... public: - QLineEdit name, statusText; }; #endif // SETTINGSFORM_H diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index b8c1cbcc0..0c02db3d2 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -17,7 +17,7 @@ #include "groupwidget.h" #include "grouplist.h" #include "group.h" -#include "settings.h" +#include "misc/settings.h" #include "widget/form/groupchatform.h" #include #include diff --git a/widget/tool/chataction.cpp b/widget/tool/chataction.cpp index 0847abdda..dacde43ee 100644 --- a/widget/tool/chataction.cpp +++ b/widget/tool/chataction.cpp @@ -15,7 +15,7 @@ */ #include "chataction.h" -#include "smileypack.h" +#include "misc/smileypack.h" #include #include #include "filetransferinstance.h" diff --git a/widget/widget.cpp b/widget/widget.cpp index abe14460a..29aef03be 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -17,7 +17,7 @@ #include "widget.h" #include "ui_mainwindow.h" #include "core.h" -#include "settings.h" +#include "misc/settings.h" #include "friend.h" #include "friendlist.h" #include "widget/tool/friendrequestdialog.h" @@ -26,7 +26,7 @@ #include "group.h" #include "widget/groupwidget.h" #include "widget/form/groupchatform.h" -#include "style.h" +#include "misc/style.h" #include "selfcamview.h" #include "widget/friendlistwidget.h" #include "camera.h" @@ -179,7 +179,7 @@ Widget::Widget(QWidget *parent) connect(core, &Core::statusSet, this, &Widget::onStatusSet); connect(core, &Core::usernameSet, this, &Widget::setUsername); connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage); - connect(core, &Core::friendAddressGenerated, &settingsForm, &SettingsForm::setFriendAddress); + //connect(core, &Core::friendAddressGenerated, &settingsWidget, &SettingsWidget::setFriendAddress); connect(core, SIGNAL(fileDownloadFinished(const QString&)), &filesForm, SLOT(onFileDownloadComplete(const QString&))); connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&))); connect(core, &Core::friendAdded, this, &Widget::addFriend); @@ -210,8 +210,6 @@ Widget::Widget(QWidget *parent) connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline())); connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway())); connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy())); - connect(&settingsForm.name, SIGNAL(editingFinished()), this, SLOT(onUsernameChanged())); - connect(&settingsForm.statusText, SIGNAL(editingFinished()), this, SLOT(onStatusMessageChanged())); connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString))); coreThread->start(); @@ -339,7 +337,7 @@ void Widget::onTransferClicked() void Widget::onSettingsClicked() { hideMainForms(); - settingsForm.show(*ui); + settingsWidget.show(*ui); activeChatroomWidget = nullptr; } @@ -357,20 +355,10 @@ void Widget::hideMainForms() } } -void Widget::onUsernameChanged() -{ - const QString newUsername = settingsForm.name.text(); - ui->nameLabel->setText(newUsername); - ui->nameLabel->setToolTip(newUsername); // for overlength names - settingsForm.name.setText(newUsername); - core->setUsername(newUsername); -} - void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername) { ui->nameLabel->setText(oldUsername); // restore old username until Core tells us to set it ui->nameLabel->setToolTip(oldUsername); // for overlength names - settingsForm.name.setText(oldUsername); core->setUsername(newUsername); } @@ -378,23 +366,12 @@ void Widget::setUsername(const QString& username) { ui->nameLabel->setText(username); ui->nameLabel->setToolTip(username); // for overlength names - settingsForm.name.setText(username); -} - -void Widget::onStatusMessageChanged() -{ - const QString newStatusMessage = settingsForm.statusText.text(); - ui->statusLabel->setText(newStatusMessage); - ui->statusLabel->setToolTip(newStatusMessage); // for overlength messsages - settingsForm.statusText.setText(newStatusMessage); - core->setStatusMessage(newStatusMessage); } void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage) { ui->statusLabel->setText(oldStatusMessage); // restore old status message until Core tells us to set it ui->statusLabel->setToolTip(oldStatusMessage); // for overlength messsages - settingsForm.statusText.setText(oldStatusMessage); core->setStatusMessage(newStatusMessage); } @@ -402,7 +379,6 @@ void Widget::setStatusMessage(const QString &statusMessage) { ui->statusLabel->setText(statusMessage); ui->statusLabel->setToolTip(statusMessage); // for overlength messsages - settingsForm.statusText.setText(statusMessage); } void Widget::addFriend(int friendId, const QString &userId) diff --git a/widget/widget.h b/widget/widget.h index 1fbecb412..ec054863c 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -19,7 +19,7 @@ #include #include "widget/form/addfriendform.h" -#include "widget/form/settingsform.h" +#include "widget/form/settingswidget.h" #include "widget/form/filesform.h" #include "corestructs.h" @@ -83,8 +83,6 @@ private slots: void onFailedToStartCore(); void onUsernameChanged(const QString& newUsername, const QString& oldUsername); void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage); - void onUsernameChanged(); - void onStatusMessageChanged(); void setUsername(const QString& username); void setStatusMessage(const QString &statusMessage); void addFriend(int friendId, const QString& userId); @@ -137,7 +135,7 @@ private: Core* core; QThread* coreThread; AddFriendForm friendForm; - SettingsForm settingsForm; + SettingsWidget settingsWidget; FilesForm filesForm; static Widget* instance; GenericChatroomWidget* activeChatroomWidget;