Skip to content

Commit

Permalink
init shortcut variables inside functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Sep 15, 2024
1 parent 58e0397 commit 5dab713
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ShortcutManager/shortcutmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include <QStandardPaths>

#ifdef _WIN32
const QString shortcutName = "HeadsetControl-Qt.lnk";
const QString applicationPath = QCoreApplication::applicationFilePath();
const QString startupPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + QDir::separator() + "Startup";
const QString shortcutPath = startupPath + QDir::separator() + shortcutName;

void manageShortcut(bool state)
{
QString shortcutName = "HeadsetControl-Qt.lnk";
QString applicationPath = QCoreApplication::applicationFilePath();
QString startupPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + QDir::separator() + "Startup";
QString shortcutPath = startupPath + QDir::separator() + shortcutName;

if (state) {
QFile::link(applicationPath, shortcutPath);
} else {
Expand All @@ -25,6 +25,10 @@ void manageShortcut(bool state)

bool isShortcutPresent()
{
QString shortcutName = "HeadsetControl-Qt.lnk";
QString startupPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + QDir::separator() + "Startup";
QString shortcutPath = startupPath + QDir::separator() + shortcutName;

return QFile::exists(shortcutPath);
}

Expand Down

0 comments on commit 5dab713

Please sign in to comment.