diff --git a/src/main.cpp b/src/main.cpp index a336c37c5..e890e6cb1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) { // Only start a core application now, so we can check if there's another instance without requiring an X server. // This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames. QCoreApplication core_app(argc, argv); - KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName); + KDSingleApplication single_app(QCoreApplication::applicationName().toLower(), KDSingleApplication::Option::IncludeUsernameInSocketName); // Parse commandline options - need to do this before starting the full QApplication, so it works without an X server if (!options.Parse()) return 1; logging::SetLevels(options.log_levels()); @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { QGuiApplication::setQuitOnLastWindowClosed(false); QApplication a(argc, argv); - KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName); + KDSingleApplication single_app(QCoreApplication::applicationName().toLower(), KDSingleApplication::Option::IncludeUsernameInSocketName); if (!single_app.isPrimaryInstance()) { if (options.is_empty()) { qLog(Info) << "Strawberry is already running - activating existing window (2)"; diff --git a/src/mpris2/mpris2.cpp b/src/mpris2/mpris2.cpp index dfbb0aa72..2678049ca 100644 --- a/src/mpris2/mpris2.cpp +++ b/src/mpris2/mpris2.cpp @@ -106,8 +106,7 @@ Mpris2::Mpris2(const SharedPtr player, : QObject(parent), player_(player), playlist_manager_(playlist_manager), - current_albumcover_loader_(current_albumcover_loader), - app_name_(QCoreApplication::applicationName()) { + current_albumcover_loader_(current_albumcover_loader) { new Mpris2Root(this); new Mpris2TrackList(this); @@ -135,8 +134,6 @@ Mpris2::Mpris2(const SharedPtr player, QObject::connect(&*playlist_manager_, &PlaylistManager::PlaylistChanged, this, &Mpris2::PlaylistChangedSlot); QObject::connect(&*playlist_manager_, &PlaylistManager::CurrentChanged, this, &Mpris2::PlaylistCollectionChanged); - app_name_[0] = app_name_[0].toUpper(); - QStringList data_dirs = QString::fromUtf8(qgetenv("XDG_DATA_DIRS")).split(u':'); if (!data_dirs.contains("/usr/local/share"_L1)) { @@ -238,7 +235,7 @@ bool Mpris2::CanRaise() const { return true; } bool Mpris2::HasTrackList() const { return true; } -QString Mpris2::Identity() const { return app_name_; } +QString Mpris2::Identity() const { return QCoreApplication::applicationName(); } QString Mpris2::DesktopEntryAbsolutePath() const { diff --git a/src/mpris2/mpris2.h b/src/mpris2/mpris2.h index cfc1071b3..ab32192f0 100644 --- a/src/mpris2/mpris2.h +++ b/src/mpris2/mpris2.h @@ -242,7 +242,6 @@ class Mpris2 : public QObject { const SharedPtr playlist_manager_; const SharedPtr current_albumcover_loader_; - QString app_name_; QString desktopfilepath_; QVariantMap last_metadata_; diff --git a/src/osd/osdbase.cpp b/src/osd/osdbase.cpp index 5f029923a..f251d3267 100644 --- a/src/osd/osdbase.cpp +++ b/src/osd/osdbase.cpp @@ -48,7 +48,6 @@ OSDBase::OSDBase(const SharedPtr tray_icon, QObject *parent) : QObject(parent), tray_icon_(tray_icon), pretty_popup_(new OSDPretty(OSDPretty::Mode::Popup)), - app_name_(QCoreApplication::applicationName()), timeout_msec_(5000), type_(OSDSettings::Type::Native), show_on_volume_change_(false), @@ -59,11 +58,7 @@ OSDBase::OSDBase(const SharedPtr tray_icon, QObject *parent) use_custom_text_(false), force_show_next_(false), ignore_next_stopped_(false), - playing_(false) { - - app_name_[0] = app_name_[0].toUpper(); - -} + playing_(false) {} OSDBase::~OSDBase() { delete pretty_popup_; @@ -264,7 +259,7 @@ void OSDBase::Stopped() { } void OSDBase::StopAfterToggle(const bool stop) { - ShowMessage(app_name_, tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off"))); + ShowMessage(QCoreApplication::applicationName(), tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off"))); } void OSDBase::PlaylistFinished() { @@ -272,7 +267,7 @@ void OSDBase::PlaylistFinished() { // We get a PlaylistFinished followed by a Stopped from the player ignore_next_stopped_ = true; - ShowMessage(app_name_, tr("Playlist finished")); + ShowMessage(QCoreApplication::applicationName(), tr("Playlist finished")); } @@ -290,7 +285,7 @@ void OSDBase::VolumeChanged(const uint value) { } #endif - ShowMessage(app_name_, message); + ShowMessage(QCoreApplication::applicationName(), message); } @@ -346,7 +341,7 @@ void OSDBase::ShuffleModeChanged(const PlaylistSequence::ShuffleMode mode) { case PlaylistSequence::ShuffleMode::InsideAlbum: current_mode = tr("Shuffle tracks in this album"); break; case PlaylistSequence::ShuffleMode::Albums: current_mode = tr("Shuffle albums"); break; } - ShowMessage(app_name_, current_mode); + ShowMessage(QCoreApplication::applicationName(), current_mode); } } @@ -363,7 +358,7 @@ void OSDBase::RepeatModeChanged(const PlaylistSequence::RepeatMode mode) { case PlaylistSequence::RepeatMode::OneByOne: current_mode = tr("Stop after every track"); break; case PlaylistSequence::RepeatMode::Intro: current_mode = tr("Intro tracks"); break; } - ShowMessage(app_name_, current_mode); + ShowMessage(QCoreApplication::applicationName(), current_mode); } } diff --git a/src/osd/osdbase.h b/src/osd/osdbase.h index befea7e2e..ecb9ec6bc 100644 --- a/src/osd/osdbase.h +++ b/src/osd/osdbase.h @@ -53,8 +53,6 @@ class OSDBase : public QObject { virtual bool SupportsNativeNotifications(); virtual bool SupportsTrayPopups(); - QString app_name() { return app_name_; } - public Q_SLOTS: void ReloadSettings(); @@ -88,7 +86,6 @@ class OSDBase : public QObject { const SharedPtr tray_icon_; OSDPretty *pretty_popup_; - QString app_name_; int timeout_msec_; OSDSettings::Type type_; bool show_on_volume_change_; diff --git a/src/osd/osddbus.cpp b/src/osd/osddbus.cpp index 38d6fa060..9e32afafa 100644 --- a/src/osd/osddbus.cpp +++ b/src/osd/osddbus.cpp @@ -170,7 +170,7 @@ void OSDDBus::ShowMessageNative(const QString &summary, const QString &message, id = notification_id_; } - QDBusPendingReply reply = interface_->Notify(app_name(), id, icon, summary_stripped, message, QStringList(), hints, timeout_msec()); + QDBusPendingReply reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary_stripped, message, QStringList(), hints, timeout_msec()); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &OSDDBus::CallFinished); diff --git a/src/systemtrayicon/qtsystemtrayicon.cpp b/src/systemtrayicon/qtsystemtrayicon.cpp index 018222021..3a9592584 100644 --- a/src/systemtrayicon/qtsystemtrayicon.cpp +++ b/src/systemtrayicon/qtsystemtrayicon.cpp @@ -39,7 +39,6 @@ using namespace Qt::Literals::StringLiterals; SystemTrayIcon::SystemTrayIcon(QObject *parent) : QSystemTrayIcon(parent), menu_(new QMenu), - app_name_(QCoreApplication::applicationName()), pixmap_playing_(u":/pictures/tiny-play.png"_s), pixmap_paused_(u":/pictures/tiny-pause.png"_s), action_play_pause_(nullptr), @@ -51,8 +50,6 @@ SystemTrayIcon::SystemTrayIcon(QObject *parent) trayicon_progress_(false), song_progress_(0) { - app_name_[0] = app_name_[0].toUpper(); - const QIcon icon = IconLoader::Load(u"strawberry"_s); const QIcon icon_grey = IconLoader::Load(u"strawberry-grey"_s); pixmap_normal_ = icon.pixmap(48, QIcon::Normal); @@ -66,7 +63,7 @@ SystemTrayIcon::SystemTrayIcon(QObject *parent) if (isSystemTrayAvailable()) { available_ = true; setIcon(icon); - setToolTip(app_name_); + setToolTip(QCoreApplication::applicationName()); } QObject::connect(this, &QSystemTrayIcon::activated, this, &SystemTrayIcon::Clicked); @@ -198,7 +195,7 @@ void SystemTrayIcon::SetNowPlaying(const Song &song, const QUrl &url) { } void SystemTrayIcon::ClearNowPlaying() { - if (available_) setToolTip(app_name_); + if (available_) setToolTip(QCoreApplication::applicationName()); } void SystemTrayIcon::LoveVisibilityChanged(const bool value) { diff --git a/src/systemtrayicon/qtsystemtrayicon.h b/src/systemtrayicon/qtsystemtrayicon.h index 0ec359402..548d27489 100644 --- a/src/systemtrayicon/qtsystemtrayicon.h +++ b/src/systemtrayicon/qtsystemtrayicon.h @@ -82,7 +82,6 @@ class SystemTrayIcon : public QSystemTrayIcon { private: QMenu *menu_; - QString app_name_; QPixmap pixmap_normal_; QPixmap pixmap_grey_; QPixmap pixmap_playing_;