From b3c36d0de74134da922eb3fd230a221298fc0ac6 Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 10:00:46 +0100 Subject: [PATCH 1/6] Fixed system tray icon update bug --- src/mainwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index b7cde85..0813f1f 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -89,13 +89,14 @@ void MainWidget::deviceDisconnect() void MainWidget::deviceConnected(QString message) { - Q_UNUSED(message); #ifndef Q_OS_WIN32 trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon.png")); #else trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16.png")); #endif qDebug("Icon changed - connected"); + setTrayTooltip(message); + receiveMessage(message); } void MainWidget::prepareApplication() @@ -110,8 +111,6 @@ void MainWidget::connectSignals() connect(&dialog, SIGNAL(finished(int)), this, SLOT(dialogResult(int))); connect(&manager, SIGNAL(stopped()), qApp, SLOT(quit())); connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnected(QString))); - connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(receiveMessage(QString))); - connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(setTrayTooltip(QString))); connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect())); connect(&manager, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString))); @@ -177,6 +176,7 @@ void MainWidget::createTrayIcon() trayIconMenu->addSeparator(); trayIconMenu->addAction(about); trayIconMenu->addAction(about_qt); + trayIconMenu->addSeparator(); trayIconMenu->addAction(quit); trayIcon = new QSystemTrayIcon(this); @@ -188,7 +188,7 @@ void MainWidget::createTrayIcon() #endif trayIcon->show(); // try to avoid the iconTray Qt bug - Sleeper::sleep(1); + //Sleeper::sleep(1); } void MainWidget::receiveMessage(QString message) From 8cec4e15491ae6ffc69db1ab134943cfee212714 Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 11:03:01 +0100 Subject: [PATCH 2/6] Added build hash and branch to about dialog --- qcma.pro | 5 +++++ src/mainwidget.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/qcma.pro b/qcma.pro index 803cb79..8e74f46 100644 --- a/qcma.pro +++ b/qcma.pro @@ -90,6 +90,11 @@ TRANSLATIONS += \ VERSION = \\\"'0.2.5'\\\" +unix { + DEFINES += "BUILD_HASH=\"\\\"$$system(git rev-parse --short HEAD)\\\"\"" + DEFINES += "BUILD_BRANCH=\"\\\"$$system(git rev-parse --abbrev-ref HEAD)\\\"\"" +} + DEFINES += "QCMA_VER=$${VERSION}" unix { diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 0813f1f..6424512 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -134,7 +134,11 @@ void MainWidget::showAboutDialog() about.setText(QString("QCMA ") + QCMA_VER); about.setWindowTitle(tr("About QCMA")); +#ifndef BUILD_HASH about.setInformativeText(tr("Copyright (C) 2013 Codestation") + "\n"); +#else + about.setInformativeText(tr("Copyright (C) 2013 Codestation\n\nbuild hash: %1\nbuild branch: %2").arg(BUILD_HASH).arg(BUILD_BRANCH)); +#endif about.setStandardButtons(QMessageBox::Ok); about.setIconPixmap(QPixmap(":/main/resources/images/qcma.png")); about.setDefaultButton(QMessageBox::Ok); From 6178d75cde2e2cd746fa77a1e4f18f879a011e31 Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 12:25:45 +0100 Subject: [PATCH 3/6] Check if account user name is valid --- src/cmaevent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmaevent.cpp b/src/cmaevent.cpp index b70aa54..258595a 100644 --- a/src/cmaevent.cpp +++ b/src/cmaevent.cpp @@ -610,7 +610,10 @@ void CmaEvent::vitaEventGetSettingInfo(vita_event_t *event, int eventId) QSettings settings; // Always refresh the account name - settings.setValue("lastOnlineId", settingsinfo->current_account.userName); + if(qstrcmp(settingsinfo->current_account.userName, "mtpr3InvalidUserName") != 0) { + // wewt, the Vita didn't go full retard again + settings.setValue("lastOnlineId", settingsinfo->current_account.userName); + } if(settings.value("lastAccountId").toString() != settingsinfo->current_account.accountId) { db->setUUID(settingsinfo->current_account.accountId); From 64016fc8ff1b81fd4ca9ea343d178adf21baaa9b Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 17:35:21 +0100 Subject: [PATCH 4/6] Added switch to get git hash and branch name --- qcma.pro | 13 ++++++++----- src/mainwidget.cpp | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qcma.pro b/qcma.pro index 8e74f46..e68885d 100644 --- a/qcma.pro +++ b/qcma.pro @@ -90,13 +90,16 @@ TRANSLATIONS += \ VERSION = \\\"'0.2.5'\\\" -unix { - DEFINES += "BUILD_HASH=\"\\\"$$system(git rev-parse --short HEAD)\\\"\"" - DEFINES += "BUILD_BRANCH=\"\\\"$$system(git rev-parse --abbrev-ref HEAD)\\\"\"" -} - DEFINES += "QCMA_VER=$${VERSION}" +GET_HASHES { + message("Retrieving git hashes") + unix { + DEFINES += "QCMA_BUILD_HASH=\"\\\"$$system(git rev-parse --short HEAD)\\\"\"" + DEFINES += "QCMA_BUILD_BRANCH=\"\\\"$$system(git rev-parse --abbrev-ref HEAD)\\\"\"" + } +} + unix { isEmpty(PREFIX) { PREFIX = /usr/local diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 6424512..cacf6b5 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -134,7 +134,7 @@ void MainWidget::showAboutDialog() about.setText(QString("QCMA ") + QCMA_VER); about.setWindowTitle(tr("About QCMA")); -#ifndef BUILD_HASH +#ifndef QCMA_BUILD_HASH about.setInformativeText(tr("Copyright (C) 2013 Codestation") + "\n"); #else about.setInformativeText(tr("Copyright (C) 2013 Codestation\n\nbuild hash: %1\nbuild branch: %2").arg(BUILD_HASH).arg(BUILD_BRANCH)); From 3f9e82ebf8c6af1e3120d109652d97d19103b47b Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 21:18:25 +0100 Subject: [PATCH 5/6] Added 500ms delay to message popups --- src/mainwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index cacf6b5..00db5cc 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -197,6 +197,9 @@ void MainWidget::createTrayIcon() void MainWidget::receiveMessage(QString message) { + // a timeout is added before the popups are displayed to prevent them from + // appearing in the wrong location + Sleeper::msleep(500); if(trayIcon->isVisible()) { trayIcon->showMessage(tr("Information"), message); } From 8e92fcda21629a8b97f84677b4ac70571285d202 Mon Sep 17 00:00:00 2001 From: Xian Nox Date: Wed, 18 Dec 2013 21:21:19 +0100 Subject: [PATCH 6/6] Fixed wrong build info define names Tray popup delay is now only applied the first time --- src/mainwidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 00db5cc..f01cd1b 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -36,6 +36,8 @@ const QStringList MainWidget::path_list = QStringList() << "photoPath" << "musicPath" << "videoPath" << "appsPath" << "urlPath"; +bool sleptOnce = false; + MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { @@ -137,7 +139,7 @@ void MainWidget::showAboutDialog() #ifndef QCMA_BUILD_HASH about.setInformativeText(tr("Copyright (C) 2013 Codestation") + "\n"); #else - about.setInformativeText(tr("Copyright (C) 2013 Codestation\n\nbuild hash: %1\nbuild branch: %2").arg(BUILD_HASH).arg(BUILD_BRANCH)); + about.setInformativeText(tr("Copyright (C) 2013 Codestation\n\nbuild hash: %1\nbuild branch: %2").arg(QCMA_BUILD_HASH).arg(QCMA_BUILD_BRANCH)); #endif about.setStandardButtons(QMessageBox::Ok); about.setIconPixmap(QPixmap(":/main/resources/images/qcma.png")); @@ -199,7 +201,11 @@ void MainWidget::receiveMessage(QString message) { // a timeout is added before the popups are displayed to prevent them from // appearing in the wrong location - Sleeper::msleep(500); + if(!sleptOnce) { + Sleeper::sleep(1); + sleptOnce = true; + } + if(trayIcon->isVisible()) { trayIcon->showMessage(tr("Information"), message); }