2020-12-30 12:03:57 -05:00
|
|
|
/*!
|
2020-08-03 13:27:42 -04:00
|
|
|
* Copyright (C) 2015-2020 by Savoir-faire Linux
|
|
|
|
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
|
|
|
|
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
|
|
|
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
2020-08-28 12:04:45 -04:00
|
|
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
2020-08-03 13:27:42 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mainapplication.h"
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
#include "appsettingsmanager.h"
|
2020-09-17 16:08:52 -04:00
|
|
|
#include "connectivitymonitor.h"
|
2020-08-03 13:27:42 -04:00
|
|
|
#include "globalsystemtray.h"
|
2020-11-27 11:49:34 -05:00
|
|
|
#include "namedirectory.h"
|
2020-09-01 14:31:31 -04:00
|
|
|
#include "qmlregister.h"
|
2020-08-03 13:27:42 -04:00
|
|
|
#include "qrimageprovider.h"
|
|
|
|
#include "tintedbuttonimageprovider.h"
|
2020-10-19 14:51:31 -04:00
|
|
|
#include "avatarimageprovider.h"
|
2020-09-17 16:08:52 -04:00
|
|
|
|
2020-08-31 15:57:10 -04:00
|
|
|
#include <QAction>
|
2020-09-17 16:08:52 -04:00
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QCoreApplication>
|
2020-08-03 13:27:42 -04:00
|
|
|
#include <QFontDatabase>
|
2020-08-31 15:57:10 -04:00
|
|
|
#include <QMenu>
|
2020-08-03 13:27:42 -04:00
|
|
|
#include <QQmlContext>
|
2020-09-14 13:04:57 -04:00
|
|
|
#include <QWindow>
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2020-11-27 11:49:34 -05:00
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
#include "globalinstances.h"
|
|
|
|
#include "dbuserrorhandler.h"
|
|
|
|
#endif
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
#if defined _MSC_VER && !COMPILE_ONLY
|
|
|
|
#include <gnutls/gnutls.h>
|
|
|
|
#endif
|
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
namespace opts {
|
|
|
|
// Keys used to store command-line options.
|
|
|
|
constexpr static const char STARTMINIMIZED[] = "STARTMINIMIZED";
|
|
|
|
constexpr static const char DEBUG[] = "DEBUG";
|
|
|
|
constexpr static const char DEBUGCONSOLE[] = "DEBUGCONSOLE";
|
|
|
|
constexpr static const char DEBUGFILE[] = "DEBUGFILE";
|
|
|
|
constexpr static const char UPDATEURL[] = "UPDATEURL";
|
|
|
|
} // namespace opts
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
static void
|
|
|
|
consoleDebug()
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
AllocConsole();
|
|
|
|
SetConsoleCP(CP_UTF8);
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
FILE* fpstdout = stdout;
|
|
|
|
freopen_s(&fpstdout, "CONOUT$", "w", stdout);
|
|
|
|
FILE* fpstderr = stderr;
|
|
|
|
freopen_s(&fpstderr, "CONOUT$", "w", stderr);
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
COORD coordInfo;
|
|
|
|
coordInfo.X = 130;
|
|
|
|
coordInfo.Y = 9000;
|
|
|
|
|
|
|
|
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coordInfo);
|
|
|
|
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
static void
|
|
|
|
vsConsoleDebug()
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
/*
|
|
|
|
* Print debug to output window if using VS.
|
|
|
|
*/
|
|
|
|
QObject::connect(&LRCInstance::behaviorController(),
|
|
|
|
&lrc::api::BehaviorController::debugMessageReceived,
|
2020-08-18 17:41:05 -04:00
|
|
|
[](const QString& message) {
|
2020-08-03 13:27:42 -04:00
|
|
|
OutputDebugStringA((message + "\n").toStdString().c_str());
|
|
|
|
});
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
static QString
|
|
|
|
getDebugFilePath()
|
|
|
|
{
|
|
|
|
QDir logPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
|
|
|
|
logPath.cdUp();
|
|
|
|
return QString(logPath.absolutePath() + "/jami/jami.log");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fileDebug(QFile* debugFile)
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
|
|
|
QObject::connect(&LRCInstance::behaviorController(),
|
|
|
|
&lrc::api::BehaviorController::debugMessageReceived,
|
2020-08-18 17:41:05 -04:00
|
|
|
[debugFile](const QString& message) {
|
2020-08-03 13:27:42 -04:00
|
|
|
if (debugFile->open(QIODevice::WriteOnly | QIODevice::Append)) {
|
|
|
|
auto msg = (message + "\n").toStdString().c_str();
|
|
|
|
debugFile->write(msg, qstrlen(msg));
|
|
|
|
debugFile->close();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
MainApplication::MainApplication(int& argc, char** argv)
|
|
|
|
: QApplication(argc, argv)
|
|
|
|
, engine_(new QQmlApplicationEngine())
|
2020-09-17 16:08:52 -04:00
|
|
|
, connectivityMonitor_(new ConnectivityMonitor(this))
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
2020-09-01 14:31:31 -04:00
|
|
|
QObject::connect(this, &QApplication::aboutToQuit, [this] { cleanup(); });
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-11-27 11:49:34 -05:00
|
|
|
bool
|
2020-09-01 14:31:31 -04:00
|
|
|
MainApplication::init()
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
2020-09-17 14:17:56 -04:00
|
|
|
setWindowIcon(QIcon(":images/jami.ico"));
|
|
|
|
|
2020-12-30 12:03:57 -05:00
|
|
|
// Lrc web resources
|
|
|
|
QResource::registerResource(QCoreApplication::applicationDirPath() + QDir::separator()
|
|
|
|
+ "webresource.rcc");
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
if (!getenv("QT_QPA_PLATFORMTHEME"))
|
|
|
|
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
|
|
|
|
#endif
|
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
auto results = parseArguments();
|
|
|
|
|
|
|
|
if (results[opts::DEBUG].toBool()) {
|
|
|
|
consoleDebug();
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
Utils::removeOldVersions();
|
|
|
|
loadTranslations();
|
|
|
|
setApplicationFont();
|
|
|
|
|
|
|
|
#if defined _MSC_VER && !COMPILE_ONLY
|
|
|
|
gnutls_global_init();
|
|
|
|
#endif
|
|
|
|
|
2021-01-12 17:22:13 +01:00
|
|
|
initLrc(results[opts::UPDATEURL].toString(), connectivityMonitor_);
|
|
|
|
|
2020-11-27 11:49:34 -05:00
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
GlobalInstances::setDBusErrorHandler(std::make_unique<Interfaces::DBusErrorHandler>());
|
|
|
|
auto dBusErrorHandlerQObject = dynamic_cast<QObject*>(&GlobalInstances::dBusErrorHandler());
|
|
|
|
qmlRegisterSingletonType<Interfaces::DBusErrorHandler>("net.jami.Models",
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
"DBusErrorHandler",
|
|
|
|
[dBusErrorHandlerQObject](QQmlEngine* e,
|
|
|
|
QJSEngine* se)
|
|
|
|
-> QObject* {
|
|
|
|
Q_UNUSED(e)
|
|
|
|
Q_UNUSED(se)
|
|
|
|
return dBusErrorHandlerQObject;
|
|
|
|
});
|
|
|
|
engine_->setObjectOwnership(dBusErrorHandlerQObject, QQmlEngine::CppOwnership);
|
|
|
|
|
|
|
|
if ((!lrc::api::Lrc::isConnected()) || (!lrc::api::Lrc::dbusIsValid())) {
|
|
|
|
engine_->load(QUrl(QStringLiteral("qrc:/src/DaemonReconnectWindow.qml")));
|
|
|
|
exec();
|
|
|
|
|
|
|
|
if ((!lrc::api::Lrc::isConnected()) || (!lrc::api::Lrc::dbusIsValid()))
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
engine_.reset(new QQmlApplicationEngine());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
connect(connectivityMonitor_, &ConnectivityMonitor::connectivityChanged, [] {
|
|
|
|
LRCInstance::connectivityChanged();
|
2020-09-14 13:04:57 -04:00
|
|
|
});
|
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
QObject::connect(
|
|
|
|
&LRCInstance::instance(),
|
|
|
|
&LRCInstance::quitEngineRequested,
|
|
|
|
this,
|
|
|
|
[this] { engine_->quit(); },
|
|
|
|
Qt::DirectConnection);
|
|
|
|
|
|
|
|
if (results[opts::DEBUGFILE].toBool()) {
|
|
|
|
debugFile_.reset(new QFile(getDebugFilePath()));
|
|
|
|
debugFile_->open(QIODevice::WriteOnly | QIODevice::Truncate);
|
|
|
|
debugFile_->close();
|
|
|
|
fileDebug(debugFile_.get());
|
|
|
|
}
|
2020-09-01 14:31:31 -04:00
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
if (results[opts::DEBUGCONSOLE].toBool()) {
|
|
|
|
vsConsoleDebug();
|
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
initSettings();
|
|
|
|
initSystray();
|
|
|
|
initQmlEngine();
|
2020-11-27 11:49:34 -05:00
|
|
|
|
|
|
|
return true;
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MainApplication::loadTranslations()
|
|
|
|
{
|
|
|
|
auto appDir = qApp->applicationDirPath() + "/";
|
|
|
|
const auto locale_name = QLocale::system().name();
|
|
|
|
const auto locale_lang = locale_name.split('_')[0];
|
|
|
|
|
2020-08-18 17:41:05 -04:00
|
|
|
QTranslator* qtTranslator_lang = new QTranslator(this);
|
|
|
|
QTranslator* qtTranslator_name = new QTranslator(this);
|
2020-08-03 13:27:42 -04:00
|
|
|
if (locale_name != locale_lang) {
|
|
|
|
if (qtTranslator_lang->load("qt_" + locale_lang,
|
|
|
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
|
|
|
installTranslator(qtTranslator_lang);
|
|
|
|
}
|
|
|
|
qtTranslator_name->load("qt_" + locale_name,
|
|
|
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
|
|
|
installTranslator(qtTranslator_name);
|
|
|
|
|
2020-08-18 17:41:05 -04:00
|
|
|
QTranslator* lrcTranslator_lang = new QTranslator(this);
|
|
|
|
QTranslator* lrcTranslator_name = new QTranslator(this);
|
2020-08-03 13:27:42 -04:00
|
|
|
if (locale_name != locale_lang) {
|
|
|
|
if (lrcTranslator_lang->load(appDir + "share/libringclient/translations/lrc_" + locale_lang))
|
|
|
|
installTranslator(lrcTranslator_lang);
|
|
|
|
}
|
|
|
|
if (lrcTranslator_name->load(appDir + "share/libringclient/translations/lrc_" + locale_name))
|
|
|
|
installTranslator(lrcTranslator_name);
|
|
|
|
|
2020-08-18 17:41:05 -04:00
|
|
|
QTranslator* mainTranslator_lang = new QTranslator(this);
|
|
|
|
QTranslator* mainTranslator_name = new QTranslator(this);
|
2020-08-03 13:27:42 -04:00
|
|
|
if (locale_name != locale_lang) {
|
|
|
|
if (mainTranslator_lang->load(appDir + "share/ring/translations/ring_client_windows_"
|
|
|
|
+ locale_lang))
|
|
|
|
installTranslator(mainTranslator_lang);
|
|
|
|
}
|
|
|
|
if (mainTranslator_name->load(appDir + "share/ring/translations/ring_client_windows_"
|
|
|
|
+ locale_name))
|
|
|
|
installTranslator(mainTranslator_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-09-17 16:08:52 -04:00
|
|
|
MainApplication::initLrc(const QString& downloadUrl, ConnectivityMonitor* cm)
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Init mainwindow and finish splash when mainwindow shows up.
|
|
|
|
*/
|
|
|
|
std::atomic_bool isMigrating(false);
|
|
|
|
LRCInstance::init(
|
|
|
|
[this, &isMigrating] {
|
|
|
|
/*
|
|
|
|
* TODO: splash screen for account migration.
|
|
|
|
*/
|
|
|
|
isMigrating = true;
|
|
|
|
while (isMigrating) {
|
|
|
|
this->processEvents();
|
|
|
|
}
|
|
|
|
},
|
2020-09-01 14:31:31 -04:00
|
|
|
[&isMigrating] {
|
2020-08-03 13:27:42 -04:00
|
|
|
while (!isMigrating) {
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
|
|
}
|
|
|
|
isMigrating = false;
|
2020-09-17 16:08:52 -04:00
|
|
|
},
|
|
|
|
downloadUrl,
|
|
|
|
cm);
|
2020-08-03 13:27:42 -04:00
|
|
|
LRCInstance::subscribeToDebugReceived();
|
|
|
|
LRCInstance::getAPI().holdConferences = false;
|
|
|
|
}
|
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
const QVariantMap
|
|
|
|
MainApplication::parseArguments()
|
2020-09-11 15:19:19 -04:00
|
|
|
{
|
2020-09-17 16:08:52 -04:00
|
|
|
QVariantMap results;
|
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.addHelpOption();
|
|
|
|
parser.addVersionOption();
|
|
|
|
|
2020-09-29 11:41:38 -04:00
|
|
|
// This option is forced into the arg list.
|
|
|
|
QCommandLineOption webSecurityDisableOption(QStringList() << "disable-web-security");
|
|
|
|
parser.addOption(webSecurityDisableOption);
|
|
|
|
|
|
|
|
QCommandLineOption webDebugOption(QStringList() << "remote-debugging-port",
|
|
|
|
"Web debugging port.",
|
|
|
|
"port");
|
|
|
|
parser.addOption(webDebugOption);
|
|
|
|
|
2020-09-17 16:08:52 -04:00
|
|
|
QCommandLineOption minimizedOption(QStringList() << "m"
|
|
|
|
<< "minimized",
|
|
|
|
"Start minimized.");
|
|
|
|
parser.addOption(minimizedOption);
|
|
|
|
|
|
|
|
QCommandLineOption debugOption(QStringList() << "d"
|
|
|
|
<< "debug",
|
|
|
|
"Debug out.");
|
|
|
|
parser.addOption(debugOption);
|
2020-09-11 15:19:19 -04:00
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
#ifdef Q_OS_WINDOWS
|
2020-09-17 16:08:52 -04:00
|
|
|
QCommandLineOption debugConsoleOption(QStringList() << "c"
|
|
|
|
<< "console",
|
|
|
|
"Debug out to IDE console.");
|
|
|
|
parser.addOption(debugConsoleOption);
|
|
|
|
|
|
|
|
QCommandLineOption debugFileOption(QStringList() << "f"
|
|
|
|
<< "file",
|
|
|
|
"Debug to file.");
|
|
|
|
parser.addOption(debugFileOption);
|
|
|
|
|
|
|
|
QCommandLineOption updateUrlOption(QStringList() << "u"
|
|
|
|
<< "url",
|
|
|
|
"Reference <url> for client versioning.",
|
|
|
|
"url");
|
|
|
|
parser.addOption(updateUrlOption);
|
2020-09-01 14:31:31 -04:00
|
|
|
#endif
|
2020-09-17 16:08:52 -04:00
|
|
|
|
|
|
|
parser.process(*this);
|
|
|
|
|
|
|
|
results[opts::STARTMINIMIZED] = parser.isSet(minimizedOption);
|
|
|
|
results[opts::DEBUG] = parser.isSet(debugOption);
|
|
|
|
#ifdef Q_OS_WINDOWS
|
|
|
|
results[opts::DEBUGCONSOLE] = parser.isSet(debugConsoleOption);
|
|
|
|
results[opts::DEBUGFILE] = parser.isSet(debugFileOption);
|
|
|
|
results[opts::UPDATEURL] = parser.value(updateUrlOption);
|
|
|
|
#endif
|
|
|
|
return results;
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MainApplication::setApplicationFont()
|
|
|
|
{
|
|
|
|
QFont font;
|
|
|
|
font.setFamily("Segoe UI");
|
|
|
|
setFont(font);
|
|
|
|
QFontDatabase::addApplicationFont(":/images/FontAwesome.otf");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-09-01 14:31:31 -04:00
|
|
|
MainApplication::initQmlEngine()
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
2020-09-01 14:31:31 -04:00
|
|
|
registerTypes();
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
engine_->addImageProvider(QLatin1String("qrImage"), new QrImageProvider());
|
|
|
|
engine_->addImageProvider(QLatin1String("tintedPixmap"), new TintedButtonImageProvider());
|
2020-10-19 14:51:31 -04:00
|
|
|
engine_->addImageProvider(QLatin1String("avatarImage"), new AvatarImageProvider());
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-11-27 11:49:34 -05:00
|
|
|
engine_->setObjectOwnership(&LRCInstance::avModel(), QQmlEngine::CppOwnership);
|
|
|
|
engine_->setObjectOwnership(&LRCInstance::pluginModel(), QQmlEngine::CppOwnership);
|
|
|
|
engine_->setObjectOwnership(LRCInstance::getUpdateManager(), QQmlEngine::CppOwnership);
|
|
|
|
engine_->setObjectOwnership(&LRCInstance::instance(), QQmlEngine::CppOwnership);
|
|
|
|
engine_->setObjectOwnership(&NameDirectory::instance(), QQmlEngine::CppOwnership);
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
engine_->load(QUrl(QStringLiteral("qrc:/src/MainApplicationWindow.qml")));
|
|
|
|
}
|
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
void
|
|
|
|
MainApplication::initSettings()
|
2020-08-03 13:27:42 -04:00
|
|
|
{
|
2020-09-01 14:31:31 -04:00
|
|
|
AppSettingsManager::instance().initValues();
|
|
|
|
auto downloadPath = AppSettingsManager::instance().getValue(Settings::Key::DownloadPath);
|
|
|
|
LRCInstance::dataTransferModel().downloadDirectory = downloadPath.toString() + "/";
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
void
|
|
|
|
MainApplication::initSystray()
|
|
|
|
{
|
2020-08-31 15:57:10 -04:00
|
|
|
GlobalSystemTray& sysIcon = GlobalSystemTray::instance();
|
|
|
|
sysIcon.setIcon(QIcon(":images/jami.png"));
|
|
|
|
|
|
|
|
QMenu* systrayMenu = new QMenu();
|
|
|
|
|
|
|
|
QAction* exitAction = new QAction(tr("Exit"), this);
|
2020-09-10 17:40:51 -04:00
|
|
|
connect(exitAction, &QAction::triggered, [this] {
|
|
|
|
engine_->quit();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
connect(&sysIcon, &QSystemTrayIcon::activated, [](QSystemTrayIcon::ActivationReason reason) {
|
|
|
|
if (reason != QSystemTrayIcon::ActivationReason::Context)
|
|
|
|
emit LRCInstance::instance().restoreAppRequested();
|
|
|
|
});
|
2020-08-31 15:57:10 -04:00
|
|
|
|
|
|
|
systrayMenu->addAction(exitAction);
|
|
|
|
sysIcon.setContextMenu(systrayMenu);
|
|
|
|
sysIcon.show();
|
2020-09-01 14:31:31 -04:00
|
|
|
}
|
2020-08-31 15:57:10 -04:00
|
|
|
|
2020-09-01 14:31:31 -04:00
|
|
|
void
|
|
|
|
MainApplication::cleanup()
|
|
|
|
{
|
|
|
|
GlobalSystemTray::instance().hide();
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
FreeConsole();
|
|
|
|
#endif
|
|
|
|
QApplication::exit(0);
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|