Fix SingleApplication static functions called from instance

This commit is contained in:
EmmanuelMess 2021-09-09 20:46:13 -03:00 committed by Jonas Kvinge
parent 8ca0b54b18
commit 68c44daef2
7 changed files with 13 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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