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(const QString &name, const QPixmap &icon) : formName(name), formIcon(icon) {;}
|
||||||
~GenericForm() {;}
|
~GenericForm() {;}
|
||||||
|
|
||||||
virtual void show(SettingsWidget& sw)
|
virtual void updateContent() {;}
|
||||||
{
|
|
||||||
// sw.body->layout()->addWidget(&body);
|
|
||||||
// body.show();
|
|
||||||
// sw.head->layout()->addWidget(&head);
|
|
||||||
// head.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getFormName() {return formName;}
|
QString getFormName() {return formName;}
|
||||||
QPixmap getFormIcon() {return formIcon;}
|
QPixmap getFormIcon() {return formIcon;}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
See the COPYING file for more details.
|
See the COPYING file for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core.h"
|
||||||
#include "ui_identitysettings.h"
|
#include "ui_identitysettings.h"
|
||||||
#include "identityform.h"
|
#include "identityform.h"
|
||||||
#include "widget/form/settingswidget.h"
|
#include "widget/form/settingswidget.h"
|
||||||
|
@ -65,20 +66,17 @@ void IdentityForm::copyIdClicked()
|
||||||
|
|
||||||
void IdentityForm::onUserNameEdited()
|
void IdentityForm::onUserNameEdited()
|
||||||
{
|
{
|
||||||
emit userNameChanged(bodyUI->userName->text());
|
Core::getInstance()->setUsername(bodyUI->userName->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdentityForm::onStatusMessageEdited()
|
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());
|
toxId->setText(Core::getInstance()->getSelfId().toString());
|
||||||
GenericForm::show(sw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdentityForm::setUserName(const QString &name)
|
void IdentityForm::setUserName(const QString &name)
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
void setUserName(const QString &name);
|
void setUserName(const QString &name);
|
||||||
void setStatusMessage(const QString &msg);
|
void setStatusMessage(const QString &msg);
|
||||||
|
|
||||||
void show(SettingsWidget& sw);
|
virtual void updateContent();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void userNameChanged(QString);
|
void userNameChanged(QString);
|
||||||
|
|
|
@ -33,7 +33,7 @@ SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent)
|
||||||
QVBoxLayout *bodyLayout = new QVBoxLayout();
|
QVBoxLayout *bodyLayout = new QVBoxLayout();
|
||||||
body->setLayout(bodyLayout);
|
body->setLayout(bodyLayout);
|
||||||
|
|
||||||
QTabWidget *settingsTabs = new QTabWidget();
|
settingsTabs = new QTabWidget();
|
||||||
bodyLayout->addWidget(settingsTabs);
|
bodyLayout->addWidget(settingsTabs);
|
||||||
|
|
||||||
GeneralForm *gfrm = new GeneralForm;
|
GeneralForm *gfrm = new GeneralForm;
|
||||||
|
@ -46,6 +46,8 @@ SettingsWidget::SettingsWidget(Camera* cam, QWidget* parent)
|
||||||
{
|
{
|
||||||
settingsTabs->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
settingsTabs->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(settingsTabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsWidget::~SettingsWidget()
|
SettingsWidget::~SettingsWidget()
|
||||||
|
@ -59,3 +61,8 @@ void SettingsWidget::show(Ui::MainWindow& ui)
|
||||||
body->show();
|
body->show();
|
||||||
head->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 IdentityForm;
|
||||||
class PrivacyForm;
|
class PrivacyForm;
|
||||||
class AVForm;
|
class AVForm;
|
||||||
|
class QTabWidget;
|
||||||
|
|
||||||
namespace Ui {class MainWindow;}
|
namespace Ui {class MainWindow;}
|
||||||
|
|
||||||
|
@ -38,9 +39,13 @@ public:
|
||||||
void show(Ui::MainWindow &ui);
|
void show(Ui::MainWindow &ui);
|
||||||
IdentityForm *getIdentityForm() {return ifrm;}
|
IdentityForm *getIdentityForm() {return ifrm;}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onTabChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *head, *body; // keep the others private
|
QWidget *head, *body; // keep the others private
|
||||||
IdentityForm *ifrm;
|
IdentityForm *ifrm;
|
||||||
|
QTabWidget *settingsTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSWIDGET_H
|
#endif // SETTINGSWIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user