X-Git-Url: http://git.maemo.org/git/?p=simple-xmbc-rem;a=blobdiff_plain;f=simplexbmcremote-0.8.1%2Fmainwindow.cpp;fp=simplexbmcremote-0.8.1%2Fmainwindow.cpp;h=985a62e6d6da86b97e9995822382fb6cc2657f78;hp=0000000000000000000000000000000000000000;hb=a3cf4f79d3cde0b08b3badc0fb2caa5739265b1e;hpb=d328e0caa02487fe504e1aa27147c50eaffcbee3 diff --git a/simplexbmcremote-0.8.1/mainwindow.cpp b/simplexbmcremote-0.8.1/mainwindow.cpp new file mode 100644 index 0000000..985a62e --- /dev/null +++ b/simplexbmcremote-0.8.1/mainwindow.cpp @@ -0,0 +1,157 @@ +// checksum 0xfd0b version 0x20001 +/* + This file was generated by the Mobile Qt Application wizard of Qt Creator. + MainWindow is a convenience class containing mobile device specific code + such as screen orientation handling. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include "setupdialog.h" +#include "xbmc.h" + +#include +#include + +#include + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include +#include +#include +#include +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), m_ui(new Ui::MainWindow) +{ + m_ui->setupUi(this); + m_xbmc = new Xbmc(this); +} + +MainWindow::~MainWindow() +{ + delete m_xbmc; + delete m_ui; +} + +void MainWindow::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void MainWindow::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} + +void MainWindow::on_actionSetup_triggered() +{ + SetupDialog dialog; + dialog.load(); + if(dialog.exec() == QDialog::Accepted) { + dialog.save(); + } +} + +void MainWindow::on_rightBtn_clicked() +{ + m_xbmc->actionRight(); +} + +void MainWindow::on_leftBtn_clicked() +{ + m_xbmc->actionLeft(); +} + +void MainWindow::on_upBtn_clicked() +{ + m_xbmc->actionUp(); +} + +void MainWindow::on_downBtn_clicked() +{ + m_xbmc->actionDown(); +} + +void MainWindow::on_playBtn_clicked() +{ + m_xbmc->actionPlay(); +} + +void MainWindow::on_muteBtn_clicked() +{ + m_xbmc->actionMute(); +} + +void MainWindow::on_volumeUpBtn_clicked() +{ + m_xbmc->actionVolumeUp(); +} + +void MainWindow::on_volumeDownBtn_clicked() +{ + m_xbmc->actionVolumeDown(); +} + +void MainWindow::on_nextSubtitleBtn_clicked() +{ + m_xbmc->actionNextSubtitle(); +} + +void MainWindow::on_nextLanguageBtn_clicked() +{ + m_xbmc->actionNextLanguage(); +} + +void MainWindow::on_selectButton_clicked() +{ + m_xbmc->actionSelect(); +} + +void MainWindow::on_stopBtn_clicked() +{ + m_xbmc->actionStop(); +}