Add an option to change qqc2 style
This commit is contained in:
+38
-1
@@ -18,6 +18,8 @@
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
#include <QFutureWatcher>
|
||||
#include <QQuickStyle>
|
||||
#include <QQuickStyle>
|
||||
#include "addon.h"
|
||||
#include <git2.h>
|
||||
#include <QDebug>
|
||||
@@ -26,7 +28,9 @@
|
||||
|
||||
Control *Control::m_instance = nullptr;
|
||||
|
||||
Control::Control(QObject *parent) : QObject(parent), m_progress(0), m_total(0), m_status(Status::Ready), m_statusMessage(""), m_pool(new QThreadPool(this))
|
||||
Control::Control(QObject *parent) : QObject(parent),
|
||||
m_progress(0), m_total(0), m_status(Status::Ready), m_statusMessage(""), m_pool(new QThreadPool(this)),
|
||||
m_style(QQuickStyle::name()),m_availableStyles(QQuickStyle::availableStyles())
|
||||
{
|
||||
QSettings settings;
|
||||
setAddonsPath(settings.value("addonsPath").toString());
|
||||
@@ -81,6 +85,11 @@ void Control::delegate(QString taskname, auto work)
|
||||
delegate(taskname, work, [](ret_t){});
|
||||
}
|
||||
|
||||
Control::~Control()
|
||||
{
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
QList<QObject *> Control::addons() const
|
||||
{
|
||||
return m_addons;
|
||||
@@ -128,6 +137,16 @@ Control::MinimizeToTray Control::minimizeToTray() const
|
||||
return m_minimizeToTray;
|
||||
}
|
||||
|
||||
QString Control::style() const
|
||||
{
|
||||
return m_style;
|
||||
}
|
||||
|
||||
QStringList Control::availableStyles() const
|
||||
{
|
||||
return m_availableStyles;
|
||||
}
|
||||
|
||||
void Control::setAddons(QList<QObject *> addons)
|
||||
{
|
||||
if (m_addons == addons)
|
||||
@@ -289,3 +308,21 @@ void Control::setMinimizeToTray(MinimizeToTray minimizeToTray)
|
||||
QSettings s;
|
||||
s.setValue("minimizeToTray",(int)minimizeToTray);
|
||||
}
|
||||
|
||||
void Control::setStyle(QString theme)
|
||||
{
|
||||
if (m_style == theme)
|
||||
return;
|
||||
|
||||
m_style = theme;
|
||||
emit styleChanged(m_style);
|
||||
}
|
||||
|
||||
void Control::setAvailableStyles(QStringList availableStyles)
|
||||
{
|
||||
if (m_availableStyles == availableStyles)
|
||||
return;
|
||||
|
||||
m_availableStyles = availableStyles;
|
||||
emit availableStylesChanged(m_availableStyles);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user