2013-05-03 11:04:51 -07:00
|
|
|
/* qt-gui.cpp */
|
|
|
|
/* Qt UI implementation */
|
2011-09-20 12:40:34 -07:00
|
|
|
#include "dive.h"
|
|
|
|
#include "display.h"
|
2015-09-03 14:20:19 -03:00
|
|
|
#include "desktop-widgets/mainwindow.h"
|
2013-05-22 23:24:33 -07:00
|
|
|
#include "helpers.h"
|
2015-10-09 19:26:05 -03:00
|
|
|
#include "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
|
|
|
|
2013-04-07 15:20:43 -07:00
|
|
|
|
2015-06-16 06:52:06 -07:00
|
|
|
#include "qt-gui.h"
|
2013-04-02 19:49:17 +03:00
|
|
|
|
2015-06-04 13:36:36 +03:00
|
|
|
#ifdef SUBSURFACE_MOBILE
|
2015-07-12 17:34:52 -07:00
|
|
|
#include <QQuickWindow>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQmlContext>
|
2015-07-22 19:09:49 +03:00
|
|
|
#include <QSortFilterProxyModel>
|
2015-07-12 17:34:52 -07:00
|
|
|
#include "qt-mobile/qmlmanager.h"
|
|
|
|
#include "qt-models/divelistmodel.h"
|
2015-07-17 19:10:32 +03:00
|
|
|
#include "qt-mobile/qmlprofile.h"
|
2015-07-12 17:34:52 -07:00
|
|
|
QObject *qqWindowObject = NULL;
|
2015-06-04 13:36:36 +03:00
|
|
|
#endif
|
|
|
|
|
2015-06-16 06:52:06 -07:00
|
|
|
static MainWindow *window = NULL;
|
2013-04-25 15:28:31 -07: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();
|
|
|
|
|
2013-09-18 10:27:24 -05:00
|
|
|
window = new MainWindow();
|
2013-09-09 05:59:03 -03:00
|
|
|
if (existing_filename && existing_filename[0] != '\0')
|
|
|
|
window->setTitle(MWTF_FILENAME);
|
|
|
|
else
|
|
|
|
window->setTitle(MWTF_DEFAULT);
|
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
|
|
|
{
|
2014-03-11 18:11:34 -03:00
|
|
|
window->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
|
|
|
{
|
2013-09-18 10:27:24 -05:00
|
|
|
delete window;
|
2015-06-16 06:52:06 -07:00
|
|
|
delete qApp;
|
2014-05-12 14:58:15 -03:00
|
|
|
free((void *)existing_filename);
|
2014-12-18 10:47:00 -08:00
|
|
|
free((void *)default_dive_computer_vendor);
|
|
|
|
free((void *)default_dive_computer_product);
|
2014-05-12 14:58:15 -03:00
|
|
|
free((void *)default_dive_computer_device);
|
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
|
|
|
|