From a7e212a804082f01a7b0da4ba55d74fb6eb8fb61 Mon Sep 17 00:00:00 2001 From: soramimi Date: Sat, 18 May 2024 19:54:08 +0900 Subject: [PATCH] =?UTF-8?q?Ctrl+A=E3=82=92=E6=8A=BC=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=81=AE=E6=8C=99=E5=8B=95=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MainWindow.cpp | 19 ++++++++--- src/MainWindow.h | 1 + src/MainWindow.ui | 85 ++++++++++++++++++++++------------------------ 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 931a388e..24de878d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -293,6 +293,7 @@ MainWindow::MainWindow(QWidget *parent) // 右上のアイコンがクリックされたとき、ConfigUserダイアログを表示 connect(ui->widget_avatar_icon, &SimpleImageWidget::clicked, this, &MainWindow::on_action_configure_user_triggered); + // connect(new QShortcut(QKeySequence("Ctrl+A"), this), &QShortcut::activated, this, &MainWindow::onCtrlA); connect(new QShortcut(QKeySequence("Ctrl+T"), this), &QShortcut::activated, this, &MainWindow::test); connect(&m->commit_detail_getter, &CommitDetailGetter::ready, this, &MainWindow::onCommitDetailGetterReady); @@ -591,7 +592,12 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) openSelectedRepository(); return true; } - if (!(e->modifiers() & Qt::ControlModifier)) { + if (e->modifiers() & Qt::ControlModifier) { + if (k == Qt::Key_A) { + on_action_add_repository_triggered(); + return true; + } + } else { if (k >= 0 && k < 128 && QChar((uchar)k).isPrint()) { appendCharToRepoFilter(k); return true; @@ -5807,10 +5813,6 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) void MainWindow::keyPressEvent(QKeyEvent *event) { int c = event->key(); - if (c == Qt::Key_T && (event->modifiers() & Qt::ControlModifier)) { - test(); - return; - } if (c == Qt::Key_F11) { toggleMaximized(); return; @@ -5886,6 +5888,13 @@ void MainWindow::on_action_add_repository_triggered() addRepository(QString()); } +void MainWindow::onCtrlA() +{ + if (QApplication::focusWidget() == ui->treeWidget_repos) { + on_action_add_repository_triggered(); + } +} + void MainWindow::on_toolButton_addrepo_clicked() { ui->action_add_repository->trigger(); diff --git a/src/MainWindow.h b/src/MainWindow.h index 4badc543..fef94e21 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -488,6 +488,7 @@ class MainWindow : public QMainWindow { void updateCommitLogTable(int delay_ms); public slots: void writeLog_(QByteArray ba, bool receive); + void onCtrlA(); private slots: void updateUI(); void onLogVisibilityChanged(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index a76d6f95..0ad5e262 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -1034,7 +1034,7 @@ 0 0 885 - 21 + 28 @@ -1077,7 +1077,7 @@ - &Window + Wi&ndow @@ -1147,7 +1147,7 @@ - Experimental + E&xperimental @@ -1332,7 +1332,7 @@ - Refresh + &Refresh Refresh @@ -1396,7 +1396,7 @@ - Edit global .gitconfig + Ed&it global .gitconfig Edit global .gitconfig @@ -1404,12 +1404,12 @@ - Edit .git/config + E&dit .git/config - Edit .gitignore + &Edit .gitignore @@ -1426,7 +1426,7 @@ :/image/clone.svg:/image/clone.svg - Clone + &Clone Clone @@ -1439,7 +1439,7 @@ - Edit tags... + &Edit tags... Edit tags @@ -1447,7 +1447,7 @@ - Push all tags + Push &all tags @@ -1476,12 +1476,12 @@ - Delete branch... + &Delete branch... - Reset HEAD~1 + &Reset HEAD~1 Reset HEAD~1 @@ -1493,7 +1493,7 @@ :/image/redsquare.svg:/image/redsquare.svg - Stop process + &Stop process @@ -1506,17 +1506,17 @@ - Reflog... + &Reflog... - Property... + &Property... - Set GPG signing + Set &GPG signing Set GPG signing @@ -1524,12 +1524,12 @@ - Delete remote branch... + Delete remote &branch... - Fetch --prune + &Fetch --prune @@ -1538,7 +1538,7 @@ :/image/terminal.svg:/image/terminal.svg - Terminal + &Terminal @@ -1547,42 +1547,42 @@ :/image/explorer.svg:/image/explorer.svg - Explorer + E&xplorer - Clean -df + &Clean -df - Reset --hard + Reset --&hard - Stash + &Stash - Apply + &Apply - Drop + &Drop - Online + &Online - Offline + Offl&ine @@ -1606,7 +1606,7 @@ - Find next + Find &next F3 @@ -1618,7 +1618,7 @@ :/image/status.svg:/image/status.svg - Status + &Status @@ -1631,12 +1631,12 @@ - Merge... + &Merge... - Expand commit log + &Expand commit log Ctrl+2 @@ -1644,7 +1644,7 @@ - Expand file list + Expand &file list Ctrl+3 @@ -1652,7 +1652,7 @@ - Expand diff view + Expand &diff view Ctrl+4 @@ -1663,7 +1663,7 @@ true - Sidebar + &Sidebar Ctrl+1 @@ -1682,7 +1682,7 @@ true - Show labels + Show &labels Ctrl+L @@ -1690,22 +1690,22 @@ - Submodule add... + Submodule &add... - Submodules + &Submodules - Submodule update... + Submodule &update... - Create desktop launcher file... + &Create desktop launcher file... @@ -1716,16 +1716,13 @@ &Add repository... - - Ctrl+A - true - Show graph + &Show graph Ctrl+G @@ -1738,7 +1735,7 @@ - Configure user + &Configure user