diff --git a/widget/form/settings/generalsettings.ui b/widget/form/settings/generalsettings.ui index ca01dbc5b..902d41039 100644 --- a/widget/form/settings/generalsettings.ui +++ b/widget/form/settings/generalsettings.ui @@ -24,43 +24,57 @@ 15 - - - Enable IPv6 (recommended) + + + General Settings + + + + + Enable IPv6 (recommended) + + + + + + + Use translations + + + + + + + Save settings to the working directory instead of the usual conf dir + + + Make Tox portable + + + + - - - Use translations + + + Theme + + + + + Smiley Pack + + + + + + + - - - - Save settings to the working directory instead of the usual conf dir - - - Make Tox portable - - - - - - - - - Smiley Pack - - - - - - - - diff --git a/widget/form/settings/identityform.cpp b/widget/form/settings/identityform.cpp index c2dac21b0..5aff0e513 100644 --- a/widget/form/settings/identityform.cpp +++ b/widget/form/settings/identityform.cpp @@ -37,11 +37,11 @@ IdentityForm::IdentityForm() : small.setPixelSize(13); small.setKerning(false); - toxId->setTextInteractionFlags(Qt::TextSelectableByMouse); +// toxId->setTextInteractionFlags(Qt::TextSelectableByMouse); toxId->setReadOnly(true); - toxId->setFrameStyle(QFrame::NoFrame); - toxId->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - toxId->setFixedHeight(toxId->document()->size().height()*2); +// toxId->setFrameStyle(QFrame::NoFrame); +// toxId->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +// toxId->setFixedHeight(toxId->document()->size().height()*2); toxId->setFont(small); bodyUI->toxGroup->layout()->addWidget(toxId); @@ -59,7 +59,7 @@ IdentityForm::~IdentityForm() void IdentityForm::copyIdClicked() { toxId->selectAll(); - QString txt = toxId->toPlainText(); + QString txt = toxId->text(); txt.replace('\n',""); QApplication::clipboard()->setText(txt); } diff --git a/widget/form/settings/identityform.h b/widget/form/settings/identityform.h index c5505e6ea..2a4b07a77 100644 --- a/widget/form/settings/identityform.h +++ b/widget/form/settings/identityform.h @@ -29,7 +29,7 @@ namespace Ui { class IdentitySettings; } -class ClickableTE : public QTextEdit +class ClickableTE : public QLineEdit { Q_OBJECT public: diff --git a/widget/form/settingswidget.cpp b/widget/form/settingswidget.cpp index b4d208f61..434513004 100644 --- a/widget/form/settingswidget.cpp +++ b/widget/form/settingswidget.cpp @@ -22,19 +22,35 @@ #include "widget/form/settings/identityform.h" #include "widget/form/settings/privacyform.h" #include "widget/form/settings/avform.h" -#include +#include +#include SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent) : QWidget(parent) { - body = new QWidget(); - head = new QWidget(); - + body = new QWidget(this); QVBoxLayout *bodyLayout = new QVBoxLayout(); body->setLayout(bodyLayout); - settingsTabs = new QTabWidget(); - bodyLayout->addWidget(settingsTabs); + head = new QWidget(this); + QHBoxLayout *headLayout = new QHBoxLayout(); + head->setLayout(headLayout); + + imgLabel = new QLabel(); + headLayout->addWidget(imgLabel); + + nameLabel = new QLabel(); + QFont bold; + bold.setBold(true); + nameLabel->setFont(bold); + headLayout->addWidget(nameLabel); + headLayout->addStretch(1); + + settingsWidgets = new QStackedWidget; + bodyLayout->addWidget(settingsWidgets); + + tabBar = new QTabBar; + bodyLayout->addWidget(tabBar); GeneralForm *gfrm = new GeneralForm; ifrm = new IdentityForm; @@ -44,10 +60,13 @@ SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent) GenericForm *cfgForms[] = {gfrm, ifrm, pfrm, avfrm}; for (auto cfgForm : cfgForms) { - settingsTabs->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName()); + tabBar->addTab(cfgForm->getFormIcon(), ""); + settingsWidgets->addWidget(cfgForm); } + tabBar->setIconSize(QSize(20, 20)); + tabBar->setShape(QTabBar::RoundedSouth); - connect(settingsTabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int))); + connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int))); } SettingsWidget::~SettingsWidget() @@ -60,9 +79,14 @@ void SettingsWidget::show(Ui::MainWindow& ui) ui.mainHead->layout()->addWidget(head); body->show(); head->show(); + onTabChanged(tabBar->currentIndex()); } void SettingsWidget::onTabChanged(int index) { - static_cast(this->settingsTabs->widget(index))->updateContent(); + this->settingsWidgets->setCurrentIndex(index); + GenericForm *currentWidget = static_cast(this->settingsWidgets->widget(index)); + currentWidget->updateContent(); + nameLabel->setText(currentWidget->getFormName()); + imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation)); } diff --git a/widget/form/settingswidget.h b/widget/form/settingswidget.h index 713eddde8..431e52c1c 100644 --- a/widget/form/settingswidget.h +++ b/widget/form/settingswidget.h @@ -25,7 +25,9 @@ class GeneralForm; class IdentityForm; class PrivacyForm; class AVForm; -class QTabWidget; +class QTabBar; +class QStackedWidget; +class QLabel; namespace Ui {class MainWindow;} @@ -45,7 +47,9 @@ private slots: private: QWidget *head, *body; // keep the others private IdentityForm *ifrm; - QTabWidget *settingsTabs; + QStackedWidget *settingsWidgets; + QTabBar *tabBar; + QLabel *nameLabel, *imgLabel; }; #endif // SETTINGSWIDGET_H