From 5de0ae095b1a87dadedafa52fc48b35a941495c5 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 12 Feb 2024 02:16:22 -0800 Subject: [PATCH] feat: rename project to quickshell --- CMakeLists.txt | 16 ++++++++-------- Justfile | 2 +- src/cpp/layershell.cpp | 6 +++--- src/cpp/layershell.hpp | 6 +++--- src/cpp/main.cpp | 5 ++--- src/cpp/qmlglobal.cpp | 30 +++++++++++++++--------------- src/cpp/qmlglobal.hpp | 16 ++++++++-------- src/cpp/qmlscreen.cpp | 18 +++++++++--------- src/cpp/qmlscreen.hpp | 8 ++++---- src/cpp/rootwrapper.cpp | 2 +- 10 files changed, 54 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed13a704..c372f145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -project(qtshell VERSION "0.0.1") +project(quickshell VERSION "0.0.1") set(QT_MIN_VERSION "6.6.0") set(CMAKE_CXX_STANDARD 20) @@ -27,7 +27,7 @@ endif() qt_standard_project_setup(REQUIRES 6.6) -qt_add_executable(qtshell +qt_add_executable(quickshell src/cpp/main.cpp src/cpp/shell.cpp src/cpp/variants.cpp @@ -40,16 +40,16 @@ qt_add_executable(qtshell src/cpp/watcher.cpp ) -qt_add_qml_module(qtshell URI QtShell) +qt_add_qml_module(quickshell URI QuickShell) # qml type registration requires this -target_include_directories(qtshell PRIVATE src/cpp) +target_include_directories(quickshell PRIVATE src/cpp) -target_link_libraries(qtshell PRIVATE Qt6::Gui Qt6::Qml Qt6::Quick Qt6::QuickControls2) +target_link_libraries(quickshell PRIVATE Qt6::Gui Qt6::Qml Qt6::Quick Qt6::QuickControls2) if (LAYERSHELL) - target_link_libraries(qtshell PRIVATE LayerShellQtInterface) - target_compile_definitions(qtshell PRIVATE CONF_LAYERSHELL) + target_link_libraries(quickshell PRIVATE LayerShellQtInterface) + target_compile_definitions(quickshell PRIVATE CONF_LAYERSHELL) - target_sources(qtshell PRIVATE src/cpp/layershell.cpp) + target_sources(quickshell PRIVATE src/cpp/layershell.cpp) endif() diff --git a/Justfile b/Justfile index 99b5da77..c4ffa6e4 100644 --- a/Justfile +++ b/Justfile @@ -30,4 +30,4 @@ clean: rm -rf {{builddir}} run *ARGS='': build - {{builddir}}/qtshell {{ARGS}} + {{builddir}}/quickshell {{ARGS}} diff --git a/src/cpp/layershell.cpp b/src/cpp/layershell.cpp index 8e761d9e..ca1b099e 100644 --- a/src/cpp/layershell.cpp +++ b/src/cpp/layershell.cpp @@ -92,12 +92,12 @@ qint32 ProxyShellWindow::height() { return this->complete ? this->ProxyWindowBase::height() : this->requestedHeight; } -void ProxyShellWindow::setScreen(QtShellScreenInfo* screen) { +void ProxyShellWindow::setScreen(QuickShellScreenInfo* screen) { this->window->setScreen(screen->screen); } -QtShellScreenInfo* ProxyShellWindow::screen() const { - return new QtShellScreenInfo( +QuickShellScreenInfo* ProxyShellWindow::screen() const { + return new QuickShellScreenInfo( const_cast(this), // NOLINT this->window->screen() ); diff --git a/src/cpp/layershell.hpp b/src/cpp/layershell.hpp index 4155a1ea..3d9e4540 100644 --- a/src/cpp/layershell.hpp +++ b/src/cpp/layershell.hpp @@ -84,7 +84,7 @@ Q_ENUM_NS(Enum); class ProxyShellWindow: public ProxyWindowBase { // clang-format off Q_OBJECT; - Q_PROPERTY(QtShellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged); + Q_PROPERTY(QuickShellScreenInfo* screen READ screen WRITE setScreen NOTIFY screenChanged); Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged); Q_PROPERTY(qint32 exclusionZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged) Q_PROPERTY(Margins margins READ margins WRITE setMargins NOTIFY marginsChanged) @@ -115,8 +115,8 @@ public: void setHeight(qint32 height) override; qint32 height() override; - void setScreen(QtShellScreenInfo* screen); - [[nodiscard]] QtShellScreenInfo* screen() const; + void setScreen(QuickShellScreenInfo* screen); + [[nodiscard]] QuickShellScreenInfo* screen() const; void setAnchors(Anchors anchors); [[nodiscard]] Anchors anchors() const; diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 1368c32c..edeeb86f 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -16,11 +16,10 @@ int main(int argc, char** argv) { const auto app = QGuiApplication(argc, argv); - QGuiApplication::setApplicationName("qtshell"); + QGuiApplication::setApplicationName("quickshell"); QGuiApplication::setApplicationVersion("0.0.1"); QCommandLineParser parser; - parser.setApplicationDescription("Qt based desktop shell"); parser.addHelpOption(); parser.addVersionOption(); @@ -33,7 +32,7 @@ int main(int argc, char** argv) { configPath = parser.value(configOption); } else { configPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); - configPath = QDir(QDir(configPath).filePath("qtshell")).filePath("config.qml"); + configPath = QDir(QDir(configPath).filePath("quickshell")).filePath("shell.qml"); } qInfo() << "config file path:" << configPath; diff --git a/src/cpp/qmlglobal.cpp b/src/cpp/qmlglobal.cpp index 84657506..3c4e427b 100644 --- a/src/cpp/qmlglobal.cpp +++ b/src/cpp/qmlglobal.cpp @@ -14,39 +14,39 @@ #include "qmlscreen.hpp" #include "rootwrapper.hpp" -QtShellGlobal::QtShellGlobal(QObject* parent): QObject(parent) { +QuickShellGlobal::QuickShellGlobal(QObject* parent): QObject(parent) { auto* app = QCoreApplication::instance(); auto* guiApp = qobject_cast(app); if (guiApp != nullptr) { // clang-format off - QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &QtShellGlobal::updateScreens); - QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &QtShellGlobal::updateScreens); - QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &QtShellGlobal::updateScreens); + QObject::connect(guiApp, &QGuiApplication::primaryScreenChanged, this, &QuickShellGlobal::updateScreens); + QObject::connect(guiApp, &QGuiApplication::screenAdded, this, &QuickShellGlobal::updateScreens); + QObject::connect(guiApp, &QGuiApplication::screenRemoved, this, &QuickShellGlobal::updateScreens); // clang-format on this->updateScreens(); } } -qsizetype QtShellGlobal::screensCount(QQmlListProperty* prop) { - return static_cast(prop->object)->mScreens.size(); // NOLINT +qsizetype QuickShellGlobal::screensCount(QQmlListProperty* prop) { + return static_cast(prop->object)->mScreens.size(); // NOLINT } -QtShellScreenInfo* QtShellGlobal::screenAt(QQmlListProperty* prop, qsizetype i) { - return static_cast(prop->object)->mScreens.at(i); // NOLINT +QuickShellScreenInfo* QuickShellGlobal::screenAt(QQmlListProperty* prop, qsizetype i) { + return static_cast(prop->object)->mScreens.at(i); // NOLINT } -QQmlListProperty QtShellGlobal::screens() { - return QQmlListProperty( +QQmlListProperty QuickShellGlobal::screens() { + return QQmlListProperty( this, nullptr, - &QtShellGlobal::screensCount, - &QtShellGlobal::screenAt + &QuickShellGlobal::screensCount, + &QuickShellGlobal::screenAt ); } -void QtShellGlobal::reload(bool hard) { +void QuickShellGlobal::reload(bool hard) { auto* rootobj = QQmlEngine::contextForObject(this)->engine()->parent(); auto* root = qobject_cast(rootobj); @@ -58,7 +58,7 @@ void QtShellGlobal::reload(bool hard) { root->reloadGraph(hard); } -void QtShellGlobal::updateScreens() { +void QuickShellGlobal::updateScreens() { auto screens = QGuiApplication::screens(); this->mScreens.resize(screens.size()); @@ -68,7 +68,7 @@ void QtShellGlobal::updateScreens() { this->mScreens[i]->setParent(nullptr); // delete if not owned by the js engine } - this->mScreens[i] = new QtShellScreenInfo(this, screens[i]); + this->mScreens[i] = new QuickShellScreenInfo(this, screens[i]); } emit this->screensChanged(); diff --git a/src/cpp/qmlglobal.hpp b/src/cpp/qmlglobal.hpp index 5f11e0ec..b94ecda6 100644 --- a/src/cpp/qmlglobal.hpp +++ b/src/cpp/qmlglobal.hpp @@ -9,16 +9,16 @@ #include "qmlscreen.hpp" -class QtShellGlobal: public QObject { +class QuickShellGlobal: public QObject { Q_OBJECT; - Q_PROPERTY(QQmlListProperty screens READ screens NOTIFY screensChanged); + Q_PROPERTY(QQmlListProperty screens READ screens NOTIFY screensChanged); QML_SINGLETON; - QML_NAMED_ELEMENT(QtShell); + QML_NAMED_ELEMENT(QuickShell); public: - QtShellGlobal(QObject* parent = nullptr); + QuickShellGlobal(QObject* parent = nullptr); - QQmlListProperty screens(); + QQmlListProperty screens(); signals: void screensChanged(); @@ -28,8 +28,8 @@ public slots: void updateScreens(); private: - static qsizetype screensCount(QQmlListProperty* prop); - static QtShellScreenInfo* screenAt(QQmlListProperty* prop, qsizetype i); + static qsizetype screensCount(QQmlListProperty* prop); + static QuickShellScreenInfo* screenAt(QQmlListProperty* prop, qsizetype i); - QVector mScreens; + QVector mScreens; }; diff --git a/src/cpp/qmlscreen.cpp b/src/cpp/qmlscreen.cpp index 42e71e45..485e15d9 100644 --- a/src/cpp/qmlscreen.cpp +++ b/src/cpp/qmlscreen.cpp @@ -5,13 +5,13 @@ #include #include -bool QtShellScreenInfo::operator==(QtShellScreenInfo& other) const { +bool QuickShellScreenInfo::operator==(QuickShellScreenInfo& other) const { return this->screen == other.screen; } void warnNull() { qWarning() << "attempted to use dangling screen object"; } -QString QtShellScreenInfo::name() const { +QString QuickShellScreenInfo::name() const { if (this->screen == nullptr) { warnNull(); return "{ DANGLING SCREEN POINTER }"; @@ -20,7 +20,7 @@ QString QtShellScreenInfo::name() const { return this->screen->name(); } -qint32 QtShellScreenInfo::width() const { +qint32 QuickShellScreenInfo::width() const { if (this->screen == nullptr) { warnNull(); return 0; @@ -29,7 +29,7 @@ qint32 QtShellScreenInfo::width() const { return this->screen->size().width(); } -qint32 QtShellScreenInfo::height() const { +qint32 QuickShellScreenInfo::height() const { if (this->screen == nullptr) { warnNull(); return 0; @@ -38,7 +38,7 @@ qint32 QtShellScreenInfo::height() const { return this->screen->size().height(); } -qreal QtShellScreenInfo::pixelDensity() const { +qreal QuickShellScreenInfo::pixelDensity() const { if (this->screen == nullptr) { warnNull(); return 0.0; @@ -47,7 +47,7 @@ qreal QtShellScreenInfo::pixelDensity() const { return this->screen->physicalDotsPerInch() / 25.4; } -qreal QtShellScreenInfo::logicalPixelDensity() const { +qreal QuickShellScreenInfo::logicalPixelDensity() const { if (this->screen == nullptr) { warnNull(); return 0.0; @@ -56,7 +56,7 @@ qreal QtShellScreenInfo::logicalPixelDensity() const { return this->screen->logicalDotsPerInch() / 25.4; } -qreal QtShellScreenInfo::devicePixelRatio() const { +qreal QuickShellScreenInfo::devicePixelRatio() const { if (this->screen == nullptr) { warnNull(); return 0.0; @@ -65,7 +65,7 @@ qreal QtShellScreenInfo::devicePixelRatio() const { return this->screen->devicePixelRatio(); } -Qt::ScreenOrientation QtShellScreenInfo::orientation() const { +Qt::ScreenOrientation QuickShellScreenInfo::orientation() const { if (this->screen == nullptr) { warnNull(); return Qt::PrimaryOrientation; @@ -74,7 +74,7 @@ Qt::ScreenOrientation QtShellScreenInfo::orientation() const { return this->screen->orientation(); } -Qt::ScreenOrientation QtShellScreenInfo::primaryOrientation() const { +Qt::ScreenOrientation QuickShellScreenInfo::primaryOrientation() const { if (this->screen == nullptr) { warnNull(); return Qt::PrimaryOrientation; diff --git a/src/cpp/qmlscreen.hpp b/src/cpp/qmlscreen.hpp index 6cf1b924..c89e3e76 100644 --- a/src/cpp/qmlscreen.hpp +++ b/src/cpp/qmlscreen.hpp @@ -8,10 +8,10 @@ #include // unfortunately QQuickScreenInfo is private. -class QtShellScreenInfo: public QObject { +class QuickShellScreenInfo: public QObject { Q_OBJECT; QML_ELEMENT; - QML_UNCREATABLE("QtShellScreenInfo can only be obtained via QtShell.screens"); + QML_UNCREATABLE("QuickShellScreenInfo can only be obtained via QuickShell.screens"); // clang-format off Q_PROPERTY(QString name READ name NOTIFY nameChanged); Q_PROPERTY(qint32 width READ width NOTIFY widthChanged); @@ -24,9 +24,9 @@ class QtShellScreenInfo: public QObject { // clang-format on public: - QtShellScreenInfo(QObject* parent, QScreen* screen): QObject(parent), screen(screen) {} + QuickShellScreenInfo(QObject* parent, QScreen* screen): QObject(parent), screen(screen) {} - bool operator==(QtShellScreenInfo& other) const; + bool operator==(QuickShellScreenInfo& other) const; [[nodiscard]] QString name() const; [[nodiscard]] qint32 width() const; diff --git a/src/cpp/rootwrapper.cpp b/src/cpp/rootwrapper.cpp index d0b5a1a5..886e2aef 100644 --- a/src/cpp/rootwrapper.cpp +++ b/src/cpp/rootwrapper.cpp @@ -44,7 +44,7 @@ void RootWrapper::reloadGraph(bool hard) { auto* newRoot = qobject_cast(obj); if (newRoot == nullptr) { - qWarning() << "root component was not a QtShell"; + qWarning() << "root component was not a QuickShell.ShellRoot"; delete obj; return; }