diff --git a/src/gui_impl/commands/adapt_channel_view_gui_command.cpp b/src/gui_impl/commands/adapt_channel_view_gui_command.cpp index 2c468aa4..bf64f134 100644 --- a/src/gui_impl/commands/adapt_channel_view_gui_command.cpp +++ b/src/gui_impl/commands/adapt_channel_view_gui_command.cpp @@ -237,8 +237,8 @@ void AdaptChannelViewGuiCommand::setAnimationDuration () //------------------------------------------------------------------------- void AdaptChannelViewGuiCommand::showHotkeyDialog() { - HotkeyDialog* hotkeyDialog = new HotkeyDialog(); - hotkeyDialog->exec(); + hotkey_dialog_ = new HotkeyDialog(); + hotkey_dialog_->show(); } } diff --git a/src/gui_impl/commands/adapt_channel_view_gui_command.h b/src/gui_impl/commands/adapt_channel_view_gui_command.h index 09f5a903..e1e7ebc0 100644 --- a/src/gui_impl/commands/adapt_channel_view_gui_command.h +++ b/src/gui_impl/commands/adapt_channel_view_gui_command.h @@ -81,7 +81,7 @@ private slots: static GuiActionFactoryRegistrator registrator_; - HotkeyDialog* hotkeyDialog; + HotkeyDialog* hotkey_dialog_; }; } diff --git a/src/gui_impl/dialogs/hotkey_dialog.cpp b/src/gui_impl/dialogs/hotkey_dialog.cpp index 777a1521..0a605a99 100644 --- a/src/gui_impl/dialogs/hotkey_dialog.cpp +++ b/src/gui_impl/dialogs/hotkey_dialog.cpp @@ -7,79 +7,69 @@ HotkeyDialog::HotkeyDialog(QWidget *parent) : { ui->setupUi(this); - resize(700, 700); + resize(633, 744); this->setWindowTitle(tr("Hotkeys")); - ui->tableWidget->setRowCount(15); + ui->tableWidget->setRowCount(16); ui->tableWidget->setColumnCount(2); ui->tableWidget->horizontalHeader()->hide(); ui->tableWidget->verticalHeader()->hide(); ui->tableWidget->setShowGrid(false); ui->tableWidget->setFocusPolicy(Qt::NoFocus); - ui->tableWidget->setColumnWidth(0, width() * 0.48); - ui->tableWidget->setColumnWidth(1, width() * 0.48); + ui->tableWidget->setColumnWidth(0, width() * 0.47); + ui->tableWidget->setColumnWidth(1, width() * 0.47); +#if defined(Q_OS_MACOS) + QString ctrl = "Cmd"; +#else QString ctrl = "Ctrl"; +#endif - QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg("Scale Individual Channel Up")); - ui->tableWidget->setItem(0, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + Mousewheel Up")); - ui->tableWidget->setItem(0, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Scale Individual Channel Down")); - ui->tableWidget->setItem(1, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + Mousewheel Down")); - ui->tableWidget->setItem(1, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Info Dialog")); - ui->tableWidget->setItem(2, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + I")); - ui->tableWidget->setItem(2, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Channel Dialog")); - ui->tableWidget->setItem(3, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + C")); - ui->tableWidget->setItem(3, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Event Dialog")); - ui->tableWidget->setItem(4, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + E")); - ui->tableWidget->setItem(4, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Zoom In Horizontal")); - ui->tableWidget->setItem(5, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + +")); - ui->tableWidget->setItem(5, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Zoom Out Horizontal")); - ui->tableWidget->setItem(6, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + -")); - ui->tableWidget->setItem(6, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Zoom In Vertical")); - ui->tableWidget->setItem(7, 0, newItem); - newItem = new QTableWidgetItem(tr("Alt %1").arg(" + +")); - ui->tableWidget->setItem(7, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Zoom Out Vertical")); - ui->tableWidget->setItem(8, 0, newItem); - newItem = new QTableWidgetItem(tr("Alt %1").arg(" + -")); - ui->tableWidget->setItem(8, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Scale All")); - ui->tableWidget->setItem(9, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + A")); - ui->tableWidget->setItem(9, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("New Event Mode")); - ui->tableWidget->setItem(10, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + 1")); - ui->tableWidget->setItem(10, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Edit Event Mode")); - ui->tableWidget->setItem(11, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + 2")); - ui->tableWidget->setItem(11, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Scroll Mode")); - ui->tableWidget->setItem(12, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + 3")); - ui->tableWidget->setItem(12, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("View Options Mode")); - ui->tableWidget->setItem(13, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + 4")); - ui->tableWidget->setItem(13, 1, newItem); - newItem = new QTableWidgetItem(tr("%1").arg("Open File")); - ui->tableWidget->setItem(14, 0, newItem); - newItem = new QTableWidgetItem(tr("%1%2").arg(ctrl).arg(" + O")); - ui->tableWidget->setItem(14, 1, newItem); + QStringList actionDescriptions; + QStringList hotkeys; + + actionDescriptions << "Scale Individual Channel Up" + << "Scale Individual Channel Down" + << "Info Dialog" + << "Channel Dialog" + << "Event Dialog" + << "Open File" + << "Scale All" + << "Zoom In Horizontal" + << "Zoom Out Horizontal" + << "Zoom In Vertical" + << "Zoom Out Vertical" + << "New Event Mode" + << "Edit Event Mode" + << "Scroll Mode" + << "View Options Mode" + << "Exit"; + + hotkeys << ctrl + "+Mousewheel Up" + << ctrl + "+Mousewheel Down" + << ctrl + "+I" + << ctrl + "+C" + << ctrl + "+E" + << ctrl + "+O" + << ctrl + "+A" + << "Alt++" + << "Alt+-" + << ctrl + "++" + << ctrl + "+-" + << ctrl + "+1" + << ctrl + "+2" + << ctrl + "+3" + << ctrl + "+4" + << ctrl + "+F4"; + + for (int row = 0; row < ui->tableWidget->rowCount(); row++) + { + QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(actionDescriptions[row])); + newItem->setFlags(newItem->flags()^Qt::ItemIsEditable); + ui->tableWidget->setItem(row, 0, newItem); + newItem = new QTableWidgetItem(tr("%1").arg(hotkeys[row])); + newItem->setTextAlignment(Qt::AlignRight); + ui->tableWidget->setItem(row, 1, newItem); + } } HotkeyDialog::~HotkeyDialog()