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