Skip to content

Commit 63a6d27

Browse files
committed
core/qmlglobal: configDir, configPath() -> shellDir, shellPath()
1 parent 77de23b commit 63a6d27

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

src/core/qmlglobal.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,22 @@ void QuickshellGlobal::onClipboardChanged(QClipboard::Mode mode) {
210210
if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged();
211211
}
212212

213-
QString QuickshellGlobal::configDir() const {
213+
QString QuickshellGlobal::shellDir() const {
214214
return EngineGeneration::findObjectGeneration(this)->rootPath.path();
215215
}
216216

217+
QString QuickshellGlobal::configDir() const {
218+
qWarning() << "Quickshell.configDir is deprecated and may be removed in a future release. Use "
219+
"Quickshell.shellDir.";
220+
return this->shellDir();
221+
}
222+
223+
QString QuickshellGlobal::shellRoot() const {
224+
qWarning() << "Quickshell.shellRoot is deprecated and may be removed in a future release. Use "
225+
"Quickshell.shellDir.";
226+
return this->shellDir();
227+
}
228+
217229
QString QuickshellGlobal::dataDir() const { // NOLINT
218230
return QsPaths::instance()->shellDataDir().path();
219231
}
@@ -226,8 +238,14 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT
226238
return QsPaths::instance()->shellCacheDir().path();
227239
}
228240

241+
QString QuickshellGlobal::shellPath(const QString& path) const {
242+
return this->shellDir() % '/' % path;
243+
}
244+
229245
QString QuickshellGlobal::configPath(const QString& path) const {
230-
return this->configDir() % '/' % path;
246+
qWarning() << "Quickshell.configPath() is deprecated and may be removed in a future release. Use "
247+
"Quickshell.shellPath().";
248+
return this->shellPath(path);
231249
}
232250

233251
QString QuickshellGlobal::dataPath(const QString& path) const {

src/core/qmlglobal.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ class QuickshellGlobal: public QObject {
108108
///
109109
/// The root directory is the folder containing the entrypoint to your shell, often referred
110110
/// to as `shell.qml`.
111+
Q_PROPERTY(QString shellDir READ shellDir CONSTANT);
112+
/// > [!WARNING] Deprecated: Renamed to @@shellDir for clarity.
111113
Q_PROPERTY(QString configDir READ configDir CONSTANT);
112-
/// > [!WARNING] Deprecated: Returns @@configDir.
113-
Q_PROPERTY(QString shellRoot READ configDir CONSTANT);
114+
/// > [!WARNING] Deprecated: Renamed to @@shellDir for consistency.
115+
Q_PROPERTY(QString shellRoot READ shellRoot CONSTANT);
114116
/// Quickshell's working directory. Defaults to whereever quickshell was launched from.
115117
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged);
116118
/// If true then the configuration will be reloaded whenever any files change.
@@ -198,6 +200,8 @@ class QuickshellGlobal: public QObject {
198200
/// icon if the requested one could not be loaded.
199201
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
200202
/// Equivalent to `${Quickshell.configDir}/${path}`
203+
Q_INVOKABLE [[nodiscard]] QString shellPath(const QString& path) const;
204+
/// > [!WARNING] Deprecated: Renamed to @@shellPath() for clarity.
201205
Q_INVOKABLE [[nodiscard]] QString configPath(const QString& path) const;
202206
/// Equivalent to `${Quickshell.dataDir}/${path}`
203207
Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const;
@@ -214,7 +218,9 @@ class QuickshellGlobal: public QObject {
214218
void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; }
215219
[[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; }
216220

221+
[[nodiscard]] QString shellDir() const;
217222
[[nodiscard]] QString configDir() const;
223+
[[nodiscard]] QString shellRoot() const;
218224

219225
[[nodiscard]] QString workingDirectory() const;
220226
void setWorkingDirectory(QString workingDirectory);

src/services/mpris/player.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ QString DBusDataTransform<MprisPlaybackState::Enum>::toWire(MprisPlaybackState::
477477
case MprisPlaybackState::Playing: return "Playing";
478478
case MprisPlaybackState::Paused: return "Paused";
479479
case MprisPlaybackState::Stopped: return "Stopped";
480-
default:
481-
qFatal() << "Tried to convert an invalid MprisPlaybackState to String";
482-
return QString();
480+
default: qFatal() << "Tried to convert an invalid MprisPlaybackState to String"; return QString();
483481
}
484482
}
485483

@@ -496,9 +494,7 @@ QString DBusDataTransform<MprisLoopState::Enum>::toWire(MprisLoopState::Enum dat
496494
case MprisLoopState::None: return "None";
497495
case MprisLoopState::Track: return "Track";
498496
case MprisLoopState::Playlist: return "Playlist";
499-
default:
500-
qFatal() << "Tried to convert an invalid MprisLoopState to String";
501-
return QString();
497+
default: qFatal() << "Tried to convert an invalid MprisLoopState to String"; return QString();
502498
}
503499
}
504500

0 commit comments

Comments
 (0)