feat: rename project to quickshell

This commit is contained in:
outfoxxed 2024-02-12 02:16:22 -08:00
parent ae5363a351
commit 5de0ae095b
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
10 changed files with 54 additions and 55 deletions

View file

@ -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()

View file

@ -30,4 +30,4 @@ clean:
rm -rf {{builddir}}
run *ARGS='': build
{{builddir}}/qtshell {{ARGS}}
{{builddir}}/quickshell {{ARGS}}

View file

@ -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<ProxyShellWindow*>(this), // NOLINT
this->window->screen()
);

View file

@ -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;

View file

@ -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;

View file

@ -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<QGuiApplication*>(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<QtShellScreenInfo>* prop) {
return static_cast<QtShellGlobal*>(prop->object)->mScreens.size(); // NOLINT
qsizetype QuickShellGlobal::screensCount(QQmlListProperty<QuickShellScreenInfo>* prop) {
return static_cast<QuickShellGlobal*>(prop->object)->mScreens.size(); // NOLINT
}
QtShellScreenInfo* QtShellGlobal::screenAt(QQmlListProperty<QtShellScreenInfo>* prop, qsizetype i) {
return static_cast<QtShellGlobal*>(prop->object)->mScreens.at(i); // NOLINT
QuickShellScreenInfo* QuickShellGlobal::screenAt(QQmlListProperty<QuickShellScreenInfo>* prop, qsizetype i) {
return static_cast<QuickShellGlobal*>(prop->object)->mScreens.at(i); // NOLINT
}
QQmlListProperty<QtShellScreenInfo> QtShellGlobal::screens() {
return QQmlListProperty<QtShellScreenInfo>(
QQmlListProperty<QuickShellScreenInfo> QuickShellGlobal::screens() {
return QQmlListProperty<QuickShellScreenInfo>(
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<RootWrapper*>(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();

View file

@ -9,16 +9,16 @@
#include "qmlscreen.hpp"
class QtShellGlobal: public QObject {
class QuickShellGlobal: public QObject {
Q_OBJECT;
Q_PROPERTY(QQmlListProperty<QtShellScreenInfo> screens READ screens NOTIFY screensChanged);
Q_PROPERTY(QQmlListProperty<QuickShellScreenInfo> 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<QtShellScreenInfo> screens();
QQmlListProperty<QuickShellScreenInfo> screens();
signals:
void screensChanged();
@ -28,8 +28,8 @@ public slots:
void updateScreens();
private:
static qsizetype screensCount(QQmlListProperty<QtShellScreenInfo>* prop);
static QtShellScreenInfo* screenAt(QQmlListProperty<QtShellScreenInfo>* prop, qsizetype i);
static qsizetype screensCount(QQmlListProperty<QuickShellScreenInfo>* prop);
static QuickShellScreenInfo* screenAt(QQmlListProperty<QuickShellScreenInfo>* prop, qsizetype i);
QVector<QtShellScreenInfo*> mScreens;
QVector<QuickShellScreenInfo*> mScreens;
};

View file

@ -5,13 +5,13 @@
#include <qnamespace.h>
#include <qtypes.h>
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;

View file

@ -8,10 +8,10 @@
#include <qtypes.h>
// 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;

View file

@ -44,7 +44,7 @@ void RootWrapper::reloadGraph(bool hard) {
auto* newRoot = qobject_cast<ShellRoot*>(obj);
if (newRoot == nullptr) {
qWarning() << "root component was not a QtShell";
qWarning() << "root component was not a QuickShell.ShellRoot";
delete obj;
return;
}