1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

cosmetic fixes

This commit is contained in:
apprb 2014-10-06 03:02:12 +09:00
parent 866f986d04
commit 35aeca5dd0
5 changed files with 89 additions and 47 deletions

View File

@ -24,43 +24,57 @@
<number>15</number>
</property>
<item>
<widget class="QCheckBox" name="cbEnableIPv6">
<property name="text">
<string extracomment="Text on a checkbox to enable IPv6">Enable IPv6 (recommended)</string>
<widget class="QGroupBox" name="generalGroup">
<property name="title">
<string>General Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="cbEnableIPv6">
<property name="text">
<string extracomment="Text on a checkbox to enable IPv6">Enable IPv6 (recommended)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbUseTranslations">
<property name="text">
<string extracomment="Text on a checkbox to enable translations">Use translations</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbMakeToxPortable">
<property name="toolTip">
<string extracomment="describes makeToxPortable checkbox">Save settings to the working directory instead of the usual conf dir</string>
</property>
<property name="text">
<string>Make Tox portable</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbUseTranslations">
<property name="text">
<string extracomment="Text on a checkbox to enable translations">Use translations</string>
<widget class="QGroupBox" name="themeGroup">
<property name="title">
<string>Theme</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="smileyPackLabel">
<property name="text">
<string extracomment="Text on smiley pack label">Smiley Pack</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="smileyPackBrowser"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbMakeToxPortable">
<property name="toolTip">
<string extracomment="describes makeToxPortable checkbox">Save settings to the working directory instead of the usual conf dir</string>
</property>
<property name="text">
<string>Make Tox portable</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="smileLayout">
<item>
<widget class="QLabel" name="smileyPackLabel">
<property name="text">
<string extracomment="Text on smiley pack label">Smiley Pack</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="smileyPackBrowser"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -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);
}

View File

@ -29,7 +29,7 @@ namespace Ui {
class IdentitySettings;
}
class ClickableTE : public QTextEdit
class ClickableTE : public QLineEdit
{
Q_OBJECT
public:

View File

@ -22,19 +22,35 @@
#include "widget/form/settings/identityform.h"
#include "widget/form/settings/privacyform.h"
#include "widget/form/settings/avform.h"
#include <QTabWidget>
#include <QTabBar>
#include <QStackedWidget>
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<GenericForm*>(this->settingsTabs->widget(index))->updateContent();
this->settingsWidgets->setCurrentIndex(index);
GenericForm *currentWidget = static_cast<GenericForm*>(this->settingsWidgets->widget(index));
currentWidget->updateContent();
nameLabel->setText(currentWidget->getFormName());
imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation));
}

View File

@ -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