subsurface/subsurface-desktop-helper.cpp
Tomaz Canabrava e62d439bda Start the Plugin Manager
This bit of code will try to load all plugins avaliable.
Now I need to port a Facebook plugin for this new system,
then I'll delete the old preferences widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:51 -07:00

65 lines
1.2 KiB
C++

/* qt-gui.cpp */
/* Qt UI implementation */
#include "dive.h"
#include "display.h"
#include "desktop-widgets/mainwindow.h"
#include "helpers.h"
#include "pluginmanager.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QNetworkProxy>
#include <QLibraryInfo>
#include "qt-gui.h"
#ifdef SUBSURFACE_MOBILE
#include <QQuickWindow>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSortFilterProxyModel>
#include "qt-mobile/qmlmanager.h"
#include "qt-models/divelistmodel.h"
#include "qt-mobile/qmlprofile.h"
QObject *qqWindowObject = NULL;
#endif
static MainWindow *window = NULL;
void init_ui()
{
init_qt_late();
PluginManager::instance().loadPlugins();
window = new MainWindow();
if (existing_filename && existing_filename[0] != '\0')
window->setTitle(MWTF_FILENAME);
else
window->setTitle(MWTF_DEFAULT);
}
void run_ui()
{
window->show();
qApp->exec();
}
void exit_ui()
{
delete window;
delete qApp;
free((void *)existing_filename);
free((void *)default_dive_computer_vendor);
free((void *)default_dive_computer_product);
free((void *)default_dive_computer_device);
}
double get_screen_dpi()
{
QDesktopWidget *mydesk = qApp->desktop();
return mydesk->physicalDpiX();
}