X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=forms%2Fpirmacroform.cpp;fp=forms%2Fpirmacroform.cpp;h=a771185a916265cd83c4245f19aa8cb9837df8d5;hb=ca07675aa383be558295fc82411c677bae207257;hp=46463204f20460d56c295427b83a70976971a1eb;hpb=afbbd0cd07a3f63c95969633bae56fcdd58c71b8;p=pierogi diff --git a/forms/pirmacroform.cpp b/forms/pirmacroform.cpp index 4646320..a771185 100644 --- a/forms/pirmacroform.cpp +++ b/forms/pirmacroform.cpp @@ -74,6 +74,7 @@ PIRMacroForm::PIRMacroForm( smd.addPack(mw->getMultitapPack()); // Connect to edit command dialog signals: +/* connect( &ecd, SIGNAL(deleteCommand()), @@ -82,6 +83,14 @@ PIRMacroForm::PIRMacroForm( connect( &ecd, + SIGNAL(copyCommand()), + this, + SLOT(copyCurrentCommand())); +*/ + +/* + connect( + &ecd, SIGNAL(moveCommandUp()), this, SLOT(moveCurrentCommandUp())); @@ -91,6 +100,7 @@ PIRMacroForm::PIRMacroForm( SIGNAL(moveCommandDown()), this, SLOT(moveCurrentCommandDown())); +*/ } @@ -313,9 +323,13 @@ void PIRMacroForm::on_addButton_clicked() } -void PIRMacroForm::deleteCurrentCommand() +//void PIRMacroForm::deleteCurrentCommand() +void PIRMacroForm::on_deleteButton_clicked() { + if (!currentMacro) return; + int index = ui->macroListWidget->currentRow(); + if (currentMacro->deleteCommand(index)) { currentMacro->populateList(ui->macroListWidget); @@ -332,10 +346,23 @@ void PIRMacroForm::deleteCurrentCommand() } -void PIRMacroForm::moveCurrentCommandUp() +//void PIRMacroForm::copyCurrentCommand() +void PIRMacroForm::on_copyButton_clicked() +{ + if (!currentMacro) return; + + // copy constructor dealing with inheritance issues? +} + + +//void PIRMacroForm::moveCurrentCommandUp() +void PIRMacroForm::on_commandUpButton_clicked() { + if (!currentMacro) return; + int index = ui->macroListWidget->currentRow(); - if (currentMacro->moveUp(index)) + + if ((index > 0) && currentMacro->moveUp(index)) { currentMacro->populateList(ui->macroListWidget); ui->macroListWidget->setCurrentRow(index - 1); @@ -345,11 +372,15 @@ void PIRMacroForm::moveCurrentCommandUp() } -void PIRMacroForm::moveCurrentCommandDown() +//void PIRMacroForm::moveCurrentCommandDown() +void PIRMacroForm::on_commandDownIcon_clicked() { + if (!currentMacro) return; + int index = ui->macroListWidget->currentRow(); - if (currentMacro->moveDown(index)) + if ((index < (ui->macroListWidget->count() - 1) && + currentMacro->moveDown(index))) { currentMacro->populateList(ui->macroListWidget); ui->macroListWidget->setCurrentRow(index + 1); @@ -359,7 +390,21 @@ void PIRMacroForm::moveCurrentCommandDown() } +void PIRMacroForm::on_macroListWidget_currentRowChanged(int currentRow) +{ + if (currentRow < 0) + { + ui->deleteButton->setEnabled(false); + } + else + { + ui->deleteButton->setEnabled(true); + } +} + + //void PIRMacroForm::on_macroListWidget_itemClicked(QListWidgetItem *item) +/* void PIRMacroForm::on_macroListWidget_itemClicked() { ecd.setup( @@ -368,6 +413,7 @@ void PIRMacroForm::on_macroListWidget_itemClicked() ecd.exec(); } +*/ /* @@ -400,4 +446,3 @@ void PIRMacroForm::on_newMacroButton_clicked() mainWindow->storeMacros(); } */ -