mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
small fixes
This commit is contained in:
parent
0c2bf63b1a
commit
866f986d04
@ -27,14 +27,7 @@ public:
|
||||
GenericForm(const QString &name, const QPixmap &icon) : formName(name), formIcon(icon) {;}
|
||||
~GenericForm() {;}
|
||||
|
||||
virtual void show(SettingsWidget& sw)
|
||||
{
|
||||
// sw.body->layout()->addWidget(&body);
|
||||
// body.show();
|
||||
// sw.head->layout()->addWidget(&head);
|
||||
// head.show();
|
||||
}
|
||||
|
||||
virtual void updateContent() {;}
|
||||
QString getFormName() {return formName;}
|
||||
QPixmap getFormIcon() {return formIcon;}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "core.h"
|
||||
#include "ui_identitysettings.h"
|
||||
#include "identityform.h"
|
||||
#include "widget/form/settingswidget.h"
|
||||
@ -65,20 +66,17 @@ void IdentityForm::copyIdClicked()
|
||||
|
||||
void IdentityForm::onUserNameEdited()
|
||||
{
|
||||
emit userNameChanged(bodyUI->userName->text());
|
||||
Core::getInstance()->setUsername(bodyUI->userName->text());
|
||||
}
|
||||
|
||||
void IdentityForm::onStatusMessageEdited()
|
||||
{
|
||||
emit statusMessageChanged(bodyUI->statusMessage->text());
|
||||
Core::getInstance()->setStatusMessage(bodyUI->statusMessage->text());
|
||||
}
|
||||
|
||||
void IdentityForm::show(SettingsWidget& sw)
|
||||
void IdentityForm::updateContent()
|
||||
{
|
||||
bodyUI->userName->setText(Core::getInstance()->getUsername());
|
||||
bodyUI->statusMessage->setText(Core::getInstance()->getStatusMessage());
|
||||
toxId->setText(Core::getInstance()->getSelfId().toString());
|
||||
GenericForm::show(sw);
|
||||
}
|
||||
|
||||
void IdentityForm::setUserName(const QString &name)
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
void setUserName(const QString &name);
|
||||
void setStatusMessage(const QString &msg);
|
||||
|
||||
void show(SettingsWidget& sw);
|
||||
virtual void updateContent();
|
||||
|
||||
signals:
|
||||
void userNameChanged(QString);
|
||||
|
@ -33,7 +33,7 @@ SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent)
|
||||
QVBoxLayout *bodyLayout = new QVBoxLayout();
|
||||
body->setLayout(bodyLayout);
|
||||
|
||||
QTabWidget *settingsTabs = new QTabWidget();
|
||||
settingsTabs = new QTabWidget();
|
||||
bodyLayout->addWidget(settingsTabs);
|
||||
|
||||
GeneralForm *gfrm = new GeneralForm;
|
||||
@ -46,6 +46,8 @@ SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent)
|
||||
{
|
||||
settingsTabs->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
||||
}
|
||||
|
||||
connect(settingsTabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
|
||||
}
|
||||
|
||||
SettingsWidget::~SettingsWidget()
|
||||
@ -59,3 +61,8 @@ void SettingsWidget::show(Ui::MainWindow& ui)
|
||||
body->show();
|
||||
head->show();
|
||||
}
|
||||
|
||||
void SettingsWidget::onTabChanged(int index)
|
||||
{
|
||||
static_cast<GenericForm*>(this->settingsTabs->widget(index))->updateContent();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ class GeneralForm;
|
||||
class IdentityForm;
|
||||
class PrivacyForm;
|
||||
class AVForm;
|
||||
class QTabWidget;
|
||||
|
||||
namespace Ui {class MainWindow;}
|
||||
|
||||
@ -38,9 +39,13 @@ public:
|
||||
void show(Ui::MainWindow &ui);
|
||||
IdentityForm *getIdentityForm() {return ifrm;}
|
||||
|
||||
private slots:
|
||||
void onTabChanged(int);
|
||||
|
||||
private:
|
||||
QWidget *head, *body; // keep the others private
|
||||
IdentityForm *ifrm;
|
||||
QTabWidget *settingsTabs;
|
||||
};
|
||||
|
||||
#endif // SETTINGSWIDGET_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user