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:
commit
ff12166753
|
@ -137,6 +137,7 @@ void Settings::load()
|
||||||
timestampFormat = s.value("timestampFormat", "hh:mm").toString();
|
timestampFormat = s.value("timestampFormat", "hh:mm").toString();
|
||||||
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
||||||
useNativeStyle = s.value("nativeStyle", false).toBool();
|
useNativeStyle = s.value("nativeStyle", false).toBool();
|
||||||
|
style = s.value("style", "None").toString();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
@ -243,6 +244,7 @@ void Settings::save(QString path)
|
||||||
s.setValue("timestampFormat", timestampFormat);
|
s.setValue("timestampFormat", timestampFormat);
|
||||||
s.setValue("minimizeOnClose", minimizeOnClose);
|
s.setValue("minimizeOnClose", minimizeOnClose);
|
||||||
s.setValue("nativeStyle", useNativeStyle);
|
s.setValue("nativeStyle", useNativeStyle);
|
||||||
|
s.setValue("style",style);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
@ -360,6 +362,16 @@ bool Settings::getAutostartInTray() const
|
||||||
return autostartInTray;
|
return autostartInTray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Settings::getStyle() const
|
||||||
|
{
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setStyle(const QString& newStyle)
|
||||||
|
{
|
||||||
|
style = newStyle;
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::setAutostartInTray(bool newValue)
|
void Settings::setAutostartInTray(bool newValue)
|
||||||
{
|
{
|
||||||
autostartInTray = newValue;
|
autostartInTray = newValue;
|
||||||
|
|
|
@ -52,6 +52,9 @@ public:
|
||||||
bool getAutostartInTray() const;
|
bool getAutostartInTray() const;
|
||||||
void setAutostartInTray(bool newValue);
|
void setAutostartInTray(bool newValue);
|
||||||
|
|
||||||
|
QString getStyle() const;
|
||||||
|
void setStyle(const QString& newValue);
|
||||||
|
|
||||||
QString getCurrentProfile() const;
|
QString getCurrentProfile() const;
|
||||||
void setCurrentProfile(QString profile);
|
void setCurrentProfile(QString profile);
|
||||||
|
|
||||||
|
@ -202,6 +205,7 @@ private:
|
||||||
QByteArray windowGeometry;
|
QByteArray windowGeometry;
|
||||||
QByteArray windowState;
|
QByteArray windowState;
|
||||||
QByteArray splitterState;
|
QByteArray splitterState;
|
||||||
|
QString style;
|
||||||
|
|
||||||
// ChatView
|
// ChatView
|
||||||
int firstColumnHandlePos;
|
int firstColumnHandlePos;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
#include "src/misc/smileypack.h"
|
#include "src/misc/smileypack.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
GeneralForm::GeneralForm() :
|
GeneralForm::GeneralForm() :
|
||||||
GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png"))
|
GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png"))
|
||||||
|
@ -40,6 +41,13 @@ GeneralForm::GeneralForm() :
|
||||||
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
||||||
reloadSmiles();
|
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->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP());
|
||||||
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
|
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
|
||||||
int port = Settings::getInstance().getProxyPort();
|
int port = Settings::getInstance().getProxyPort();
|
||||||
|
@ -59,6 +67,7 @@ GeneralForm::GeneralForm() :
|
||||||
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
|
connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
|
||||||
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
|
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
|
||||||
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
|
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
|
||||||
|
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralForm::~GeneralForm()
|
GeneralForm::~GeneralForm()
|
||||||
|
@ -86,6 +95,12 @@ void GeneralForm::onSetAutostartInTray()
|
||||||
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
|
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)
|
void GeneralForm::onSmileyBrowserIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
||||||
|
|
|
@ -42,6 +42,7 @@ private slots:
|
||||||
void onProxyAddrEdited();
|
void onProxyAddrEdited();
|
||||||
void onProxyPortEdited(int port);
|
void onProxyPortEdited(int port);
|
||||||
void onUseProxyUpdated();
|
void onUseProxyUpdated();
|
||||||
|
void onStyleSelected(QString style);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>527</width>
|
<width>527</width>
|
||||||
<height>421</height>
|
<height>397</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -126,6 +126,16 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="styleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Style</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="styleBrowser"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
Widget *Widget::instance{nullptr};
|
Widget *Widget::instance{nullptr};
|
||||||
|
|
||||||
|
@ -75,6 +76,15 @@ Widget::Widget(QWidget *parent)
|
||||||
ui->mainHead->setLayout(new QVBoxLayout());
|
ui->mainHead->setLayout(new QVBoxLayout());
|
||||||
ui->mainHead->layout()->setMargin(0);
|
ui->mainHead->layout()->setMargin(0);
|
||||||
ui->mainHead->layout()->setSpacing(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->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
|
||||||
ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
|
ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ QLabel
|
||||||
QGroupBox::title
|
QGroupBox::title
|
||||||
{
|
{
|
||||||
color: black;
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGroupBox
|
||||||
|
{
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user