mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
style selector
Unfortunately Qt developers removed some old native skins from support, only 3 skins are supported on Linux. Number of native skins depends on OS and Qt built system.
This commit is contained in:
parent
1d31244273
commit
c716b615c8
|
@ -135,6 +135,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");
|
||||
|
@ -239,6 +240,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");
|
||||
|
@ -356,6 +358,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;
|
||||
|
|
|
@ -52,6 +52,9 @@ public:
|
|||
bool getAutostartInTray() const;
|
||||
void setAutostartInTray(bool newValue);
|
||||
|
||||
QString getStyle() const;
|
||||
void setStyle(const QString& newValue);
|
||||
|
||||
bool getUseTranslations() const;
|
||||
void setUseTranslations(bool newValue);
|
||||
|
||||
|
@ -192,6 +195,7 @@ private:
|
|||
QByteArray windowGeometry;
|
||||
QByteArray windowState;
|
||||
QByteArray splitterState;
|
||||
QString style;
|
||||
|
||||
// ChatView
|
||||
int firstColumnHandlePos;
|
||||
|
|
|
@ -11,6 +11,10 @@ QLabel
|
|||
QGroupBox::title
|
||||
{
|
||||
color: black;
|
||||
}
|
||||
|
||||
QGroupBox
|
||||
{
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "misc/settings.h"
|
||||
#include "misc/smileypack.h"
|
||||
#include <QMessageBox>
|
||||
#include <QStyleFactory>
|
||||
|
||||
GeneralForm::GeneralForm() :
|
||||
GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png"))
|
||||
|
@ -39,6 +40,13 @@ GeneralForm::GeneralForm() :
|
|||
}
|
||||
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
||||
|
||||
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();
|
||||
|
@ -58,6 +66,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()
|
||||
|
@ -85,6 +94,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();
|
||||
|
|
|
@ -42,6 +42,7 @@ private slots:
|
|||
void onProxyAddrEdited();
|
||||
void onProxyPortEdited(int port);
|
||||
void onUseProxyUpdated();
|
||||
void onStyleSelected(QString style);
|
||||
|
||||
private:
|
||||
Ui::GeneralSettings *bodyUI;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<height>369</height>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -72,6 +72,16 @@
|
|||
<item>
|
||||
<widget class="QComboBox" name="smileyPackBrowser"/>
|
||||
</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>
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <QThread>
|
||||
#include <QFileDialog>
|
||||
#include <tox/tox.h>
|
||||
#include <QStyleFactory>
|
||||
|
||||
Widget *Widget::instance{nullptr};
|
||||
|
||||
|
@ -74,6 +75,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"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user