Skip to content

Commit

Permalink
Modeless
Browse files Browse the repository at this point in the history
1. Modeless
2. Switch to for loop
3. Check OS
  • Loading branch information
Yida-Lin committed Jul 1, 2017
1 parent bb11655 commit fa62753
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 67 deletions.
4 changes: 2 additions & 2 deletions src/gui_impl/commands/adapt_channel_view_gui_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ void AdaptChannelViewGuiCommand::setAnimationDuration ()
//-------------------------------------------------------------------------
void AdaptChannelViewGuiCommand::showHotkeyDialog()
{
HotkeyDialog* hotkeyDialog = new HotkeyDialog();
hotkeyDialog->exec();
hotkey_dialog_ = new HotkeyDialog();
hotkey_dialog_->show();
}

}
2 changes: 1 addition & 1 deletion src/gui_impl/commands/adapt_channel_view_gui_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private slots:

static GuiActionFactoryRegistrator registrator_;

HotkeyDialog* hotkeyDialog;
HotkeyDialog* hotkey_dialog_;
};

}
Expand Down
118 changes: 54 additions & 64 deletions src/gui_impl/dialogs/hotkey_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fa62753

Please sign in to comment.