This commit is contained in:
cutefishd 2021-03-16 17:23:27 +08:00
parent a2b98f661d
commit a195f05080
5 changed files with 19 additions and 22 deletions

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(PROJECT_NAME cyber-dock) set(PROJECT_NAME cutefish-dock)
project(${PROJECT_NAME}) project(${PROJECT_NAME})
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

View file

@ -169,7 +169,7 @@ Item {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
interactive: false interactive: false
model: trayModel model: trayModel
spacing: Meui.Units.smallSpacing spacing: Meui.Units.smallSpacing / 2
clip: true clip: true
StatusNotifierModel { StatusNotifierModel {

View file

@ -27,9 +27,6 @@ ApplicationModel::ApplicationModel(QObject *parent)
, m_iface(XWindowInterface::instance()) , m_iface(XWindowInterface::instance())
, m_sysAppMonitor(SystemAppMonitor::self()) , m_sysAppMonitor(SystemAppMonitor::self())
{ {
m_sysAppMonitor->moveToThread(qApp->thread());
this->moveToThread(qApp->thread());
connect(m_iface, &XWindowInterface::windowAdded, this, &ApplicationModel::onWindowAdded); connect(m_iface, &XWindowInterface::windowAdded, this, &ApplicationModel::onWindowAdded);
connect(m_iface, &XWindowInterface::windowRemoved, this, &ApplicationModel::onWindowRemoved); connect(m_iface, &XWindowInterface::windowRemoved, this, &ApplicationModel::onWindowRemoved);
connect(m_iface, &XWindowInterface::activeChanged, this, &ApplicationModel::onActiveChanged); connect(m_iface, &XWindowInterface::activeChanged, this, &ApplicationModel::onActiveChanged);

View file

@ -26,11 +26,26 @@
#include "applicationmodel.h" #include "applicationmodel.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "volumemanager.h"
#include "battery.h"
#include "brightness.h"
#include "controlcenterdialog.h"
#include "statusnotifier/statusnotifiermodel.h"
#include "appearance.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv); QApplication app(argc, argv);
qmlRegisterType<DockSettings>("Cyber.Dock", 1, 0, "DockSettings");
qmlRegisterType<VolumeManager>("Cyber.Dock", 1, 0, "Volume");
qmlRegisterType<Battery>("Cyber.Dock", 1, 0, "Battery");
qmlRegisterType<Brightness>("Cyber.Dock", 1, 0, "Brightness");
qmlRegisterType<ControlCenterDialog>("Cyber.Dock", 1, 0, "ControlCenterDialog");
qmlRegisterType<StatusNotifierModel>("Cyber.Dock", 1, 0, "StatusNotifierModel");
qmlRegisterType<Appearance>("Cyber.Dock", 1, 0, "Appearance");
QString qmFilePath = QString("%1/%2.qm").arg("/usr/share/cyber-dock/translations/").arg(QLocale::system().name()); QString qmFilePath = QString("%1/%2.qm").arg("/usr/share/cyber-dock/translations/").arg(QLocale::system().name());
if (QFile::exists(qmFilePath)) { if (QFile::exists(qmFilePath)) {
QTranslator *translator = new QTranslator(QApplication::instance()); QTranslator *translator = new QTranslator(QApplication::instance());

View file

@ -18,18 +18,12 @@
*/ */
#include "mainwindow.h" #include "mainwindow.h"
#include "iconthemeimageprovider.h"
#include "processprovider.h" #include "processprovider.h"
#include "volumemanager.h"
#include "battery.h"
#include "brightness.h"
#include "controlcenterdialog.h"
#include "statusnotifier/statusnotifiermodel.h"
#include "appearance.h"
#include <QGuiApplication> #include <QGuiApplication>
#include <QScreen> #include <QScreen>
#include <QQmlEngine>
#include <QQmlContext> #include <QQmlContext>
#include <QQmlProperty> #include <QQmlProperty>
#include <QQuickItem> #include <QQuickItem>
@ -45,15 +39,7 @@ MainWindow::MainWindow(QQuickView *parent)
, m_appModel(new ApplicationModel) , m_appModel(new ApplicationModel)
, m_fakeWindow(nullptr) , m_fakeWindow(nullptr)
{ {
qmlRegisterType<DockSettings>("Cyber.Dock", 1, 0, "DockSettings"); // setDefaultAlphaBuffer(false);
qmlRegisterType<VolumeManager>("Cyber.Dock", 1, 0, "Volume");
qmlRegisterType<Battery>("Cyber.Dock", 1, 0, "Battery");
qmlRegisterType<Brightness>("Cyber.Dock", 1, 0, "Brightness");
qmlRegisterType<ControlCenterDialog>("Cyber.Dock", 1, 0, "ControlCenterDialog");
qmlRegisterType<StatusNotifierModel>("Cyber.Dock", 1, 0, "StatusNotifierModel");
qmlRegisterType<Appearance>("Cyber.Dock", 1, 0, "Appearance");
setDefaultAlphaBuffer(false);
setColor(Qt::transparent); setColor(Qt::transparent);
setFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
@ -66,7 +52,6 @@ MainWindow::MainWindow(QQuickView *parent)
engine()->rootContext()->setContextProperty("mainWindow", this); engine()->rootContext()->setContextProperty("mainWindow", this);
setResizeMode(QQuickView::SizeRootObjectToView); setResizeMode(QQuickView::SizeRootObjectToView);
// setClearBeforeRendering(true);
setScreen(qApp->primaryScreen()); setScreen(qApp->primaryScreen());
setSource(QUrl(QStringLiteral("qrc:/qml/main.qml"))); setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));
setVisible(true); setVisible(true);