Skip to content
Newer
Older
100644 65 lines (54 sloc) 2.02 KB
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
1 #include "mainwindow.h"
2
2c8c817 @bzar Changed UI creation to use the same engine and context as the view to…
bzar authored Apr 24, 2011
3 #ifdef ENABLE_OPENGL
6047f48 @bzar Ported to Qt 4.7.2
bzar authored Apr 13, 2011
4 #include <QGLWidget>
5 #endif
b7db157 @dflemstr Made panorama launchable from anywhere, not just from the dir it's in.
dflemstr authored Apr 21, 2011
6 #include <QCoreApplication>
adde673 @dflemstr Added Applications attached object for accessing the application list
dflemstr authored May 11, 2011
7 #include <QDir>
6047f48 @bzar Ported to Qt 4.7.2
bzar authored Apr 13, 2011
8
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
9 MainWindow::MainWindow(QWidget *parent) :
4924061 @dflemstr Some bugfixes for the runtime code.
dflemstr authored May 21, 2011
10 QDeclarativeView(parent), _runtimeObject(this)
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
11 {
bbe6db6 @bzar Added runtime object to allow reacting to window activity status chan…
bzar authored May 21, 2011
12 //Set the runtime object context property
4924061 @dflemstr Some bugfixes for the runtime code.
dflemstr authored May 21, 2011
13 rootContext()->setContextProperty("runtime", &_runtimeObject);
d0f348c @dflemstr Simplified fullscreen handling
dflemstr authored May 21, 2011
14 connect(&_runtimeObject, SIGNAL(fullscreenRequested(bool)),
6814e51 @dflemstr Readded the fullscreen toggle ability
dflemstr authored May 21, 2011
15 this, SLOT(setFullscreen(bool)));
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
16
2c8c817 @bzar Changed UI creation to use the same engine and context as the view to…
bzar authored Apr 24, 2011
17 #ifdef ENABLE_OPENGL
48ea2bb @bzar Removed unneccessary QMainWindow root widget. Moved UI size setting t…
bzar authored May 19, 2011
18 setViewport(new QGLWidget());
6047f48 @bzar Ported to Qt 4.7.2
bzar authored Apr 13, 2011
19 #endif
48ea2bb @bzar Removed unneccessary QMainWindow root widget. Moved UI size setting t…
bzar authored May 19, 2011
20 viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
21 viewport()->setAttribute(Qt::WA_NoSystemBackground);
22 viewport()->setAttribute(Qt::WA_PaintUnclipped);
23 viewport()->setAttribute(Qt::WA_TranslucentBackground, false);
fde704c @dflemstr No longer load applications in a separate thread; there's no need.
dflemstr authored Apr 21, 2011
24
31012e4 @dflemstr Moved PanoramaUI into a plugin
dflemstr authored May 20, 2011
25 setFocusPolicy(Qt::StrongFocus);
26 setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing);
27 setOptimizationFlag(QGraphicsView::DontSavePainterState);
28 setResizeMode(QDeclarativeView::SizeRootObjectToView);
48ea2bb @bzar Removed unneccessary QMainWindow root widget. Moved UI size setting t…
bzar authored May 19, 2011
29 setStyleSheet("border-style: none;");
30 setFrameStyle(0);
31 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
32 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
6e195f4 @bzar More optimization settings, fullscreen option and key combos for full…
bzar authored Apr 13, 2011
33
e0d76eb @dflemstr Massive documentation and style fix commit.
dflemstr authored Dec 29, 2009
34 //Set up UI loading and channel quit() events from QML
48ea2bb @bzar Removed unneccessary QMainWindow root widget. Moved UI size setting t…
bzar authored May 19, 2011
35 connect(engine(), SIGNAL(quit()), this, SLOT(close()));
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
36
31012e4 @dflemstr Moved PanoramaUI into a plugin
dflemstr authored May 19, 2011
37 //Make plugins available
38 engine()->addImportPath(QCoreApplication::applicationDirPath() + "/plugins");
5fb0d92 @dflemstr Move to a new repository layout and use CMake instead of QMake
dflemstr authored Oct 25, 2011
39 engine()->addImportPath(PANORAMA_PREFIX "/lib/panorama/plugins");
716efe9 @dflemstr Initial reorganization
dflemstr authored May 21, 2011
40 engine()->addImportPath(QDir::homePath() + "/.panorama/plugins");
f7d2ff8 @dflemstr Simplified the settings system:
dflemstr authored Apr 21, 2011
41
31012e4 @dflemstr Moved PanoramaUI into a plugin
dflemstr authored May 19, 2011
42 //Load the main QML file
43 setSource(QUrl("qrc:/root.qml"));
f7d2ff8 @dflemstr Simplified the settings system:
dflemstr authored Apr 21, 2011
44
31012e4 @dflemstr Moved PanoramaUI into a plugin
dflemstr authored May 19, 2011
45 //Resize to default size
5fb0d92 @dflemstr Move to a new repository layout and use CMake instead of QMake
dflemstr authored Oct 25, 2011
46 resize(PANORAMA_UI_WIDTH, PANORAMA_UI_HEIGHT);
ad80c6d @dflemstr Built a rudimentary application framework.
dflemstr authored Dec 12, 2009
47 }
48
bbe6db6 @bzar Added runtime object to allow reacting to window activity status chan…
bzar authored May 21, 2011
49 void MainWindow::changeEvent(QEvent *e)
50 {
51 if(e->type() == QEvent::ActivationChange)
52 {
4924061 @dflemstr Some bugfixes for the runtime code.
dflemstr authored May 21, 2011
53 _runtimeObject.setIsActiveWindow(isActiveWindow());
bbe6db6 @bzar Added runtime object to allow reacting to window activity status chan…
bzar authored May 21, 2011
54 }
55 QDeclarativeView::changeEvent(e);
56 }
6814e51 @dflemstr Readded the fullscreen toggle ability
dflemstr authored May 21, 2011
57
58 void MainWindow::setFullscreen(bool fullscreen)
59 {
60 if(fullscreen)
e85e983 @dflemstr Fixed flaw in fullscreen toggling: In QML, "if(someQVariant)..." alwa…
dflemstr authored May 22, 2011
61 setWindowState(windowState() | Qt::WindowFullScreen);
6814e51 @dflemstr Readded the fullscreen toggle ability
dflemstr authored May 21, 2011
62 else
e85e983 @dflemstr Fixed flaw in fullscreen toggling: In QML, "if(someQVariant)..." alwa…
dflemstr authored May 22, 2011
63 setWindowState(windowState() & ~Qt::WindowFullScreen);
6814e51 @dflemstr Readded the fullscreen toggle ability
dflemstr authored May 21, 2011
64 }
Something went wrong with that request. Please try again.