X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=mainwindow.cpp;h=bd556f3cbf46ffde2a3f6acb0aca646f740d52e2;hb=HEAD;hp=f57cde71e2ff24c4c89a4241aa9ab2c6db31a768;hpb=f3809ec697222bd9ad47c725bb72dd7272fd594b;p=pierogi diff --git a/mainwindow.cpp b/mainwindow.cpp index f57cde7..bd556f3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,3 +1,11 @@ +// mainwindow.cpp +// +// For the Pierogi IR remote control app. +// +// Copyright (C) 2012 by John Pietrzak (john@pietrzak.org) +// +// Licensed under the GNU GPL version 2.0 or later. + #include "mainwindow.h" #include "ui_mainwindow.h" @@ -11,6 +19,8 @@ #include #include +//#include "pirtabwidget.h" + #include "pirkeysetmetadata.h" #include "pirkeysetwidgetitem.h" @@ -58,6 +68,9 @@ MainWindow::MainWindow(QWidget *parent) myMacros(0), currentKeyset(1) // Zero is not a valid keyset any more { + // Create the tab widget: +// myTabWidget = new PIRTabWidget(ui->centralWidget, this); + ui->setupUi(this); // Make this a Maemo 5 stacked widget: @@ -561,6 +574,7 @@ void MainWindow::insertCornerButtons() Qt::QueuedConnection); ui->mainTabWidget->setCornerWidget(button, Qt::TopRightCorner); +// myTabWidget->setCornerWidget(button, Qt::TopRightCorner); button = new QPushButton(QIcon(":/icons/align_just_icon&32.png"), ""); @@ -575,24 +589,28 @@ void MainWindow::insertCornerButtons() Qt::QueuedConnection); ui->mainTabWidget->setCornerWidget(button, Qt::TopLeftCorner); +// myTabWidget->setCornerWidget(button, Qt::TopLeftCorner); } void MainWindow::disableUpdates() { ui->mainTabWidget->setUpdatesEnabled(false); +// myTabWidget->setUpdatesEnabled(false); } void MainWindow::enableUpdates() { ui->mainTabWidget->setUpdatesEnabled(true); +// myTabWidget->setUpdatesEnabled(true); } void MainWindow::clearTabs() { ui->mainTabWidget->clear(); +// myTabWidget->clear(); } @@ -601,6 +619,7 @@ void MainWindow::addTab( QString label) { ui->mainTabWidget->addTab(page, label); +// myTabWidget->addTab(page, label); } void MainWindow::setupTabs( @@ -653,6 +672,34 @@ PIRMacroPack *MainWindow::getMultitapPack() } +void MainWindow::handleKeypress( + char key) +{ + myMacros->handleKeypress(key); +} + + +/* +void MainWindow::handleKeyRelease( + char key) +{ +} +*/ + + +void MainWindow::gotoPreviousTabs() +{ + myPanels->gotoPreviousTabs(); +} + + +void MainWindow::gotoNextTabs() +{ + myPanels->gotoNextTabs(); +} + + +/* void MainWindow::keyPressEvent( QKeyEvent *event) { @@ -739,11 +786,60 @@ void MainWindow::keyPressEvent( case Qt::Key_Space: myMacros->handleKeypress(' '); break; + + case Qt::Key_Up: + myPanels->gotoPreviousTabs(); + break; + case Qt::Key_Down: + myPanels->gotoNextTabs(); + break; + + + case Qt::Key_Left: + startRepeating(VolumeDown_Key); + break; + case Qt::Key_Right: + startRepeating(VolumeUp_Key); + break; + + case Qt::Key_Backspace: + startRepeating(Power_Key); + break; + case Qt::Key_Return: + startRepeating(Mute_Key); + break; + default: QMainWindow::keyPressEvent(event); break; } } +*/ + + +/* +void MainWindow::keyReleaseEvent( + QKeyEvent *event) +{ + switch(event->key()) + { + + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Left: + case Qt::Key_Right: + + case Qt::Key_Backspace: + case Qt::Key_Return: + stopRepeating(); + break; + + default: + QMainWindow::keyReleaseEvent(event); + break; + } +} +*/ bool MainWindow::hasMacroButton( @@ -791,3 +887,23 @@ void MainWindow::setMacroBtnFocus( { myMacros->setBtnFocus(index); } + + +void MainWindow::switchToTab( + int tabNumber) +{ + int count = ui->mainTabWidget->count(); + + if (tabNumber < 0) + { + ui->mainTabWidget->setCurrentIndex(0); + } + else if (tabNumber >= count) + { + ui->mainTabWidget->setCurrentIndex(count-1); + } + else + { + ui->mainTabWidget->setCurrentIndex(tabNumber); + } +}