forked from quickshell/quickshell
core/qmlglobal: configDir, configPath() -> shellDir, shellPath()
This commit is contained in:
parent
77de23bb71
commit
63a6d27213
3 changed files with 30 additions and 10 deletions
|
@ -210,10 +210,22 @@ void QuickshellGlobal::onClipboardChanged(QClipboard::Mode mode) {
|
|||
if (mode == QClipboard::Clipboard) emit this->clipboardTextChanged();
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::configDir() const {
|
||||
QString QuickshellGlobal::shellDir() const {
|
||||
return EngineGeneration::findObjectGeneration(this)->rootPath.path();
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::configDir() const {
|
||||
qWarning() << "Quickshell.configDir is deprecated and may be removed in a future release. Use "
|
||||
"Quickshell.shellDir.";
|
||||
return this->shellDir();
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::shellRoot() const {
|
||||
qWarning() << "Quickshell.shellRoot is deprecated and may be removed in a future release. Use "
|
||||
"Quickshell.shellDir.";
|
||||
return this->shellDir();
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::dataDir() const { // NOLINT
|
||||
return QsPaths::instance()->shellDataDir().path();
|
||||
}
|
||||
|
@ -226,8 +238,14 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT
|
|||
return QsPaths::instance()->shellCacheDir().path();
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::shellPath(const QString& path) const {
|
||||
return this->shellDir() % '/' % path;
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::configPath(const QString& path) const {
|
||||
return this->configDir() % '/' % path;
|
||||
qWarning() << "Quickshell.configPath() is deprecated and may be removed in a future release. Use "
|
||||
"Quickshell.shellPath().";
|
||||
return this->shellPath(path);
|
||||
}
|
||||
|
||||
QString QuickshellGlobal::dataPath(const QString& path) const {
|
||||
|
|
|
@ -108,9 +108,11 @@ class QuickshellGlobal: public QObject {
|
|||
///
|
||||
/// The root directory is the folder containing the entrypoint to your shell, often referred
|
||||
/// to as `shell.qml`.
|
||||
Q_PROPERTY(QString shellDir READ shellDir CONSTANT);
|
||||
/// > [!WARNING] Deprecated: Renamed to @@shellDir for clarity.
|
||||
Q_PROPERTY(QString configDir READ configDir CONSTANT);
|
||||
/// > [!WARNING] Deprecated: Returns @@configDir.
|
||||
Q_PROPERTY(QString shellRoot READ configDir CONSTANT);
|
||||
/// > [!WARNING] Deprecated: Renamed to @@shellDir for consistency.
|
||||
Q_PROPERTY(QString shellRoot READ shellRoot CONSTANT);
|
||||
/// Quickshell's working directory. Defaults to whereever quickshell was launched from.
|
||||
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged);
|
||||
/// If true then the configuration will be reloaded whenever any files change.
|
||||
|
@ -198,6 +200,8 @@ public:
|
|||
/// icon if the requested one could not be loaded.
|
||||
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
|
||||
/// Equivalent to `${Quickshell.configDir}/${path}`
|
||||
Q_INVOKABLE [[nodiscard]] QString shellPath(const QString& path) const;
|
||||
/// > [!WARNING] Deprecated: Renamed to @@shellPath() for clarity.
|
||||
Q_INVOKABLE [[nodiscard]] QString configPath(const QString& path) const;
|
||||
/// Equivalent to `${Quickshell.dataDir}/${path}`
|
||||
Q_INVOKABLE [[nodiscard]] QString dataPath(const QString& path) const;
|
||||
|
@ -214,7 +218,9 @@ public:
|
|||
void clearReloadPopupInhibit() { this->mInhibitReloadPopup = false; }
|
||||
[[nodiscard]] bool isReloadPopupInhibited() const { return this->mInhibitReloadPopup; }
|
||||
|
||||
[[nodiscard]] QString shellDir() const;
|
||||
[[nodiscard]] QString configDir() const;
|
||||
[[nodiscard]] QString shellRoot() const;
|
||||
|
||||
[[nodiscard]] QString workingDirectory() const;
|
||||
void setWorkingDirectory(QString workingDirectory);
|
||||
|
|
|
@ -477,9 +477,7 @@ QString DBusDataTransform<MprisPlaybackState::Enum>::toWire(MprisPlaybackState::
|
|||
case MprisPlaybackState::Playing: return "Playing";
|
||||
case MprisPlaybackState::Paused: return "Paused";
|
||||
case MprisPlaybackState::Stopped: return "Stopped";
|
||||
default:
|
||||
qFatal() << "Tried to convert an invalid MprisPlaybackState to String";
|
||||
return QString();
|
||||
default: qFatal() << "Tried to convert an invalid MprisPlaybackState to String"; return QString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,9 +494,7 @@ QString DBusDataTransform<MprisLoopState::Enum>::toWire(MprisLoopState::Enum dat
|
|||
case MprisLoopState::None: return "None";
|
||||
case MprisLoopState::Track: return "Track";
|
||||
case MprisLoopState::Playlist: return "Playlist";
|
||||
default:
|
||||
qFatal() << "Tried to convert an invalid MprisLoopState to String";
|
||||
return QString();
|
||||
default: qFatal() << "Tried to convert an invalid MprisLoopState to String"; return QString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue