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
d96ef1a970
commit
14ea88c070
|
@ -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;
|
||||
|
|
|
@ -51,6 +51,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,7 +205,8 @@ private:
|
|||
QByteArray windowGeometry;
|
||||
QByteArray windowState;
|
||||
QByteArray splitterState;
|
||||
|
||||
QString style;
|
||||
|
||||
// ChatView
|
||||
int firstColumnHandlePos;
|
||||
int secondColumnHandlePosFromRight;
|
||||
|
|
|
@ -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"))
|
||||
|
@ -39,7 +40,14 @@ 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();
|
||||
|
|
|
@ -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>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>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <QInputDialog>
|
||||
#include <QTimer>
|
||||
#include <tox/tox.h>
|
||||
#include <QStyleFactory>
|
||||
|
||||
Widget *Widget::instance{nullptr};
|
||||
|
||||
|
@ -75,7 +76,16 @@ Widget::Widget(QWidget *parent)
|
|||
ui->mainHead->setLayout(new QVBoxLayout());
|
||||
ui->mainHead->layout()->setMargin(0);
|
||||
ui->mainHead->layout()->setSpacing(0);
|
||||
ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
|
||||
|
||||
|
||||
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"));
|
||||
|
||||
contactListWidget = new FriendListWidget();
|
||||
|
|
|
@ -11,7 +11,11 @@ QLabel
|
|||
QGroupBox::title
|
||||
{
|
||||
color: black;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
QGroupBox
|
||||
{
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
QWidget
|
||||
|
|
Loading…
Reference in New Issue
Block a user