Browse Source

Fix SingleApplication static functions called from instance

pull/764/head
EmmanuelMess 2 months ago
committed by Jonas Kvinge
parent
commit
68c44daef2
  1. 4
      ext/libstrawberry-common/core/workerpool.h
  2. 2
      ext/strawberry-tagreader/tagreaderworker.cpp
  3. 4
      src/core/mainwindow.cpp
  4. 2
      src/core/mpris2.cpp
  5. 4
      src/globalshortcuts/globalshortcut-x11.cpp
  6. 6
      src/main.cpp
  7. 4
      src/osd/osdpretty.cpp

4
ext/libstrawberry-common/core/workerpool.h

@ -233,9 +233,9 @@ void WorkerPool<HandlerType>::DoStart() {
executable_path_ = executable_name_;
QStringList search_path;
search_path << qApp->applicationDirPath();
search_path << QCoreApplication::applicationDirPath();
#if defined(Q_OS_MACOS) && defined(USE_BUNDLE)
search_path << qApp->applicationDirPath() + "/" + USE_BUNDLE_DIR;
search_path << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR;
#endif
for (const QString &path_prefix : search_path) {

2
ext/strawberry-tagreader/tagreaderworker.cpp

@ -59,5 +59,5 @@ void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
void TagReaderWorker::DeviceClosed() {
AbstractMessageHandler<spb::tagreader::Message>::DeviceClosed();
qApp->exit();
QCoreApplication::exit();
}

4
src/core/mainwindow.cpp

@ -1197,7 +1197,7 @@ void MainWindow::Exit() {
if (exit_count_ > 1) {
exit_ = true;
qApp->quit();
QCoreApplication::quit();
}
else {
if (app_->player()->engine()->is_fadeout_enabled()) {
@ -1227,7 +1227,7 @@ void MainWindow::DoExit() {
void MainWindow::ExitFinished() {
exit_ = true;
qApp->quit();
QCoreApplication::quit();
}

2
src/core/mpris2.cpp

@ -298,7 +298,7 @@ QStringList Mpris2::SupportedMimeTypes() {
void Mpris2::Raise() { emit RaiseMainWindow(); }
void Mpris2::Quit() { qApp->quit(); }
void Mpris2::Quit() { QCoreApplication::quit(); }
QString Mpris2::PlaybackStatus() const {
return PlaybackStatus(app_->player()->GetState());

4
src/globalshortcuts/globalshortcut-x11.cpp

@ -72,7 +72,7 @@ Display *X11Display() {
if (!qApp) return nullptr;
QPlatformNativeInterface *native = qApp->platformNativeInterface();
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if (!native) return nullptr;
void *display = native->nativeResourceForIntegration("display");
@ -105,7 +105,7 @@ quint32 AppRootWindow() {
if (!qApp) return 0;
QPlatformNativeInterface *native = qApp->platformNativeInterface();
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if (!native) return 0;
QScreen *screen = QGuiApplication::primaryScreen();

6
src/main.cpp

@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
}
return 0;
}
a.setQuitOnLastWindowClosed(false);
QGuiApplication::setQuitOnLastWindowClosed(false);
#if defined(USE_BUNDLE) && (defined(Q_OS_LINUX) || defined(Q_OS_MACOS))
qLog(Debug) << "Looking for resources in" << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR;
@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
#endif
translations->LoadTranslation("strawberry", ":/translations", language);
translations->LoadTranslation("strawberry", TRANSLATIONS_DIR, language);
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
translations->LoadTranslation("strawberry", QCoreApplication::applicationDirPath(), language);
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
#ifdef HAVE_QTSPARKLE
@ -313,7 +313,7 @@ int main(int argc, char *argv[]) {
#endif
QObject::connect(&a, &SingleApplication::receivedMessage, &w, QOverload<quint32, const QByteArray&>::of(&MainWindow::CommandlineOptionsReceived));
int ret = a.exec();
int ret = QCoreApplication::exec();
return ret;
}

4
src/osd/osdpretty.cpp

@ -166,7 +166,7 @@ OSDPretty::~OSDPretty() {
void OSDPretty::showEvent(QShowEvent *e) {
screens_.clear();
for(QScreen *screen : qApp->screens()) {
for(QScreen *screen : QGuiApplication::screens()) {
screens_.insert(screen->name(), screen);
}
@ -221,7 +221,7 @@ bool OSDPretty::IsTransparencyAvailable() {
return QX11Info::isCompositingManagerRunning();
#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
if (qApp) {
QPlatformNativeInterface *native = qApp->platformNativeInterface();
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_;
if (native && screen) {
return native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen);

Loading…
Cancel
Save