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

Merge branch 'pr421'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-16 15:29:12 +02:00
commit ff12166753
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
7 changed files with 61 additions and 5 deletions

View File

@ -137,6 +137,7 @@ void Settings::load()
timestampFormat = s.value("timestampFormat", "hh:mm").toString();
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
useNativeStyle = s.value("nativeStyle", false).toBool();
style = s.value("style", "None").toString();
s.endGroup();
s.beginGroup("State");
@ -243,6 +244,7 @@ void Settings::save(QString path)
s.setValue("timestampFormat", timestampFormat);
s.setValue("minimizeOnClose", minimizeOnClose);
s.setValue("nativeStyle", useNativeStyle);
s.setValue("style",style);
s.endGroup();
s.beginGroup("State");
@ -360,6 +362,16 @@ bool Settings::getAutostartInTray() const
return autostartInTray;
}
QString Settings::getStyle() const
{
return style;
}
void Settings::setStyle(const QString& newStyle)
{
style = newStyle;
}
void Settings::setAutostartInTray(bool newValue)
{
autostartInTray = newValue;

View File

@ -52,6 +52,9 @@ public:
bool getAutostartInTray() const;
void setAutostartInTray(bool newValue);
QString getStyle() const;
void setStyle(const QString& newValue);
QString getCurrentProfile() const;
void setCurrentProfile(QString profile);
@ -202,6 +205,7 @@ private:
QByteArray windowGeometry;
QByteArray windowState;
QByteArray splitterState;
QString style;
// ChatView
int firstColumnHandlePos;

View File

@ -21,6 +21,7 @@
#include "src/misc/settings.h"
#include "src/misc/smileypack.h"
#include <QMessageBox>
#include <QStyleFactory>
GeneralForm::GeneralForm() :
GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png"))
@ -40,6 +41,13 @@ GeneralForm::GeneralForm() :
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
reloadSmiles();
bodyUI->styleBrowser->addItems(QStyleFactory::keys());
bodyUI->styleBrowser->addItem("None");
if(QStyleFactory::keys().contains(Settings::getInstance().getStyle()))
bodyUI->styleBrowser->setCurrentText(Settings::getInstance().getStyle());
else
bodyUI->styleBrowser->setCurrentText("None");
bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP());
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
int port = Settings::getInstance().getProxyPort();
@ -59,6 +67,7 @@ GeneralForm::GeneralForm() :
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
}
GeneralForm::~GeneralForm()
@ -86,6 +95,12 @@ void GeneralForm::onSetAutostartInTray()
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
}
void GeneralForm::onStyleSelected(QString style)
{
Settings::getInstance().setStyle(style);
this->setStyle(QStyleFactory::create(style));
}
void GeneralForm::onSmileyBrowserIndexChanged(int index)
{
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();

View File

@ -42,6 +42,7 @@ private slots:
void onProxyAddrEdited();
void onProxyPortEdited(int port);
void onUseProxyUpdated();
void onStyleSelected(QString style);
private:
Ui::GeneralSettings *bodyUI;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>527</width>
<height>421</height>
<height>397</height>
</rect>
</property>
<property name="windowTitle">
@ -126,6 +126,16 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="styleLabel">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="styleBrowser"/>
</item>
</layout>
</widget>
</item>

View File

@ -44,6 +44,7 @@
#include <QInputDialog>
#include <QTimer>
#include <tox/tox.h>
#include <QStyleFactory>
Widget *Widget::instance{nullptr};
@ -75,6 +76,15 @@ Widget::Widget(QWidget *parent)
ui->mainHead->setLayout(new QVBoxLayout());
ui->mainHead->layout()->setMargin(0);
ui->mainHead->layout()->setSpacing(0);
if(QStyleFactory::keys().contains(Settings::getInstance().getStyle())
&& Settings::getInstance().getStyle() != "None")
{
ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
}
ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));

View File

@ -11,6 +11,10 @@ QLabel
QGroupBox::title
{
color: black;
}
QGroupBox
{
background-color: white;
}