1 // checksum 0xfd0b version 0x20001
3 This file was generated by the Mobile Qt Application wizard of Qt Creator.
4 MainWindow is a convenience class containing mobile device specific code
5 such as screen orientation handling.
6 It is recommended not to modify this file, since newer versions of Qt Creator
7 may offer an updated version of it.
10 #include "mainwindow.h"
11 #include "ui_mainwindow.h"
13 #include "setupdialog.h"
15 #include "constants.h"
18 #include <QCoreApplication>
20 #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
25 #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK
27 MainWindow::MainWindow(QWidget *parent)
28 : QMainWindow(parent), m_ui(new Ui::MainWindow)
31 m_xbmc = new Xbmc(this);
40 MainWindow::~MainWindow()
50 void MainWindow::setupScreen()
55 bool disable_screensaver = settings.value(SETUP_SCREEN_DISABLE_SCREENSAVER, SETUP_SCREEN_DISABLE_SCREENSAVER_DEFAULT).toBool();
57 if (disable_screensaver) {
58 if (m_screenSaver == 0) {
59 m_screenSaver = new QSystemScreenSaver(this);
60 bool result = m_screenSaver->setScreenSaverInhibit();
61 qDebug("disabling the screensaver: %s", (result?"ok":"failed"));
67 qDebug("screensaver enabled");
73 void MainWindow::setOrientation(ScreenOrientation orientation)
76 if (orientation != ScreenOrientationAuto) {
77 #if defined(ORIENTATIONLOCK)
78 const CAknAppUiBase::TAppUiOrientation uiOrientation =
79 (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
80 : CAknAppUi::EAppUiOrientationLandscape;
81 CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
84 appUi->SetOrientationL(uiOrientation);
87 #else // ORIENTATIONLOCK
88 qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
89 #endif // ORIENTATIONLOCK
91 #elif defined(Q_WS_MAEMO_5)
92 Qt::WidgetAttribute attribute;
93 switch (orientation) {
94 case ScreenOrientationLockPortrait:
95 attribute = Qt::WA_Maemo5PortraitOrientation;
97 case ScreenOrientationLockLandscape:
98 attribute = Qt::WA_Maemo5LandscapeOrientation;
100 case ScreenOrientationAuto:
102 attribute = Qt::WA_Maemo5AutoOrientation;
105 setAttribute(attribute, true);
106 #else // Q_OS_SYMBIAN
107 Q_UNUSED(orientation);
108 #endif // Q_OS_SYMBIAN
111 void MainWindow::showExpanded()
115 #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
122 void MainWindow::on_actionSetup_triggered()
126 if(dialog.exec() == QDialog::Accepted) {
133 void MainWindow::on_rightBtn_clicked()
135 m_xbmc->actionRight();
138 void MainWindow::on_leftBtn_clicked()
140 m_xbmc->actionLeft();
143 void MainWindow::on_upBtn_clicked()
148 void MainWindow::on_downBtn_clicked()
150 m_xbmc->actionDown();
153 void MainWindow::on_playBtn_clicked()
155 m_xbmc->actionPlay();
158 void MainWindow::on_muteBtn_clicked()
160 m_xbmc->actionMute();
163 void MainWindow::on_volumeUpBtn_clicked()
165 m_xbmc->actionVolumeUp();
168 void MainWindow::on_volumeDownBtn_clicked()
170 m_xbmc->actionVolumeDown();
173 void MainWindow::on_nextSubtitleBtn_clicked()
175 m_xbmc->actionNextSubtitle();
178 void MainWindow::on_nextLanguageBtn_clicked()
180 m_xbmc->actionNextLanguage();
183 void MainWindow::on_selectButton_clicked()
185 m_xbmc->actionSelect();
188 void MainWindow::on_stopBtn_clicked()
190 m_xbmc->actionStop();
193 void MainWindow::on_showGuiBtn_clicked()
195 m_xbmc->actionShowGui();
198 void MainWindow::on_contextMenuBtn_clicked()
200 m_xbmc->actionContextMenu();
203 void MainWindow::on_sendEscKeyBtn_clicked()
205 m_xbmc->actionSendKeyEsc();