mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-30 18:39:23 +00:00
feat(src/app/App): show window if a secondary instance is created
This commit is contained in:
parent
52cba384b9
commit
1d53011f8d
2 changed files with 18 additions and 11 deletions
|
|
@ -60,7 +60,7 @@ inline bool installLocale (App &app, QTranslator &translator, const QLocale &loc
|
|||
return translator.load(locale, LANGUAGES_PATH) && app.installTranslator(&translator);
|
||||
}
|
||||
|
||||
App::App (int &argc, char *argv[]) : SingleApplication(argc, argv) {
|
||||
App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
|
||||
setApplicationVersion("4.0");
|
||||
setWindowIcon(QIcon(WINDOW_ICON_PATH));
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ void App::initContentApp () {
|
|||
}
|
||||
}
|
||||
|
||||
// Register types and create sub-windows.
|
||||
// Register types.
|
||||
registerTypes();
|
||||
|
||||
// Enable notifications.
|
||||
|
|
@ -155,7 +155,9 @@ void App::initContentApp () {
|
|||
core->setParent(this);
|
||||
}
|
||||
|
||||
// Create sub windows.
|
||||
createSubWindows();
|
||||
|
||||
// Load main view.
|
||||
qInfo() << "Loading main view...";
|
||||
m_engine.load(QUrl(QML_VIEW_MAIN_WINDOW));
|
||||
|
|
@ -177,6 +179,13 @@ void App::initContentApp () {
|
|||
|
||||
if (m_parser.isSet("selftest"))
|
||||
QTimer::singleShot(300, this, &App::quit);
|
||||
|
||||
QObject::connect(
|
||||
this, &App::receivedMessage, this, [this](int, QByteArray message) {
|
||||
if (message == "show")
|
||||
getMainWindow()->showNormal();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -32,23 +32,21 @@ using namespace std;
|
|||
int main (int argc, char *argv[]) {
|
||||
Logger::init();
|
||||
|
||||
// Force OpenGLES & shader version 2.0.
|
||||
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES, true);
|
||||
|
||||
// Force shader version 2.0.
|
||||
QSurfaceFormat fmt;
|
||||
fmt.setVersion(2, 0);
|
||||
QSurfaceFormat::setDefaultFormat(fmt);
|
||||
|
||||
/*
|
||||
* TODO: Uncomment me in the future!
|
||||
* Disabled for a moment.
|
||||
* `QXcbConnection: XCB error` errors on Cinnamon.
|
||||
* QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
*/
|
||||
|
||||
App app(argc, argv);
|
||||
|
||||
app.parseArgs();
|
||||
|
||||
if (app.isSecondary()) {
|
||||
app.sendMessage("show", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
app.initContentApp();
|
||||
|
||||
// Run!
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue