2017-04-27 18:27:59 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-05-03 18:04:51 +00:00
|
|
|
/* qt-gui.cpp */
|
|
|
|
/* Qt UI implementation */
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "core/display.h"
|
2015-09-03 17:20:19 +00:00
|
|
|
#include "desktop-widgets/mainwindow.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "core/helpers.h"
|
|
|
|
#include "core/pluginmanager.h"
|
2011-09-20 19:40:34 +00:00
|
|
|
|
2013-05-03 18:04:51 +00:00
|
|
|
#include <QApplication>
|
2013-05-10 16:24:06 +00:00
|
|
|
#include <QDesktopWidget>
|
2013-07-13 12:42:26 +00:00
|
|
|
#include <QNetworkProxy>
|
2013-10-09 05:25:02 +00:00
|
|
|
#include <QLibraryInfo>
|
2015-05-27 12:36:39 +00:00
|
|
|
|
2016-04-05 05:02:03 +00:00
|
|
|
#include "core/qt-gui.h"
|
2013-04-02 16:49:17 +00:00
|
|
|
|
2015-06-16 13:52:06 +00:00
|
|
|
void init_ui()
|
2014-03-19 16:23:43 +00:00
|
|
|
{
|
2015-06-16 13:52:06 +00:00
|
|
|
init_qt_late();
|
2013-10-10 19:26:03 +00:00
|
|
|
|
2015-10-09 22:26:05 +00:00
|
|
|
PluginManager::instance().loadPlugins();
|
|
|
|
|
2018-02-05 22:43:13 +00:00
|
|
|
MainWindow *window = new MainWindow();
|
2017-12-11 16:43:53 +00:00
|
|
|
window->setTitle();
|
2011-09-20 19:40:34 +00:00
|
|
|
}
|
|
|
|
|
2015-06-16 13:52:06 +00:00
|
|
|
void run_ui()
|
2011-09-20 19:40:34 +00:00
|
|
|
{
|
2018-02-05 22:43:13 +00:00
|
|
|
MainWindow::instance()->show();
|
2015-06-16 13:52:06 +00:00
|
|
|
qApp->exec();
|
2011-09-20 19:40:34 +00:00
|
|
|
}
|
|
|
|
|
2015-06-16 13:52:06 +00:00
|
|
|
void exit_ui()
|
2012-05-02 17:03:48 +00:00
|
|
|
{
|
2018-02-05 22:43:13 +00:00
|
|
|
delete MainWindow::instance();
|
2015-06-16 13:52:06 +00:00
|
|
|
delete qApp;
|
2014-05-12 17:58:15 +00:00
|
|
|
free((void *)existing_filename);
|
2012-05-02 17:03:48 +00:00
|
|
|
}
|
|
|
|
|
2013-05-10 16:24:06 +00:00
|
|
|
double get_screen_dpi()
|
|
|
|
{
|
2015-06-16 13:52:06 +00:00
|
|
|
QDesktopWidget *mydesk = qApp->desktop();
|
2013-05-10 16:24:06 +00:00
|
|
|
return mydesk->physicalDpiX();
|
|
|
|
}
|
2013-05-23 06:24:33 +00:00
|
|
|
|
2013-05-30 21:26:08 +00:00
|
|
|
|