mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-17 13:37:18 +03:00
Add hotkeys: nextCommit and prevCommit
This commit is contained in:
parent
dac06473c0
commit
770ac3c7a5
@ -28,6 +28,7 @@
|
|||||||
#include "git/Signature.h"
|
#include "git/Signature.h"
|
||||||
#include "git/TagRef.h"
|
#include "git/TagRef.h"
|
||||||
#include "git/Tree.h"
|
#include "git/Tree.h"
|
||||||
|
#include "ui/HotkeyManager.h"
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
@ -1168,6 +1169,12 @@ public:
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
static Hotkey prevCommitHotKey = HotkeyManager::registerHotkey(
|
||||||
|
"J", "commitList/prevCommit", "CommitList/PrevCommit");
|
||||||
|
|
||||||
|
static Hotkey nextCommitHotKey = HotkeyManager::registerHotkey(
|
||||||
|
"K", "commitList/nextCommit", "CommitList/NextCommit");
|
||||||
|
|
||||||
CommitList::CommitList(Index *index, QWidget *parent)
|
CommitList::CommitList(Index *index, QWidget *parent)
|
||||||
: QListView(parent), mIndex(index) {
|
: QListView(parent), mIndex(index) {
|
||||||
Theme *theme = Application::theme();
|
Theme *theme = Application::theme();
|
||||||
@ -1223,6 +1230,18 @@ CommitList::CommitList(Index *index, QWidget *parent)
|
|||||||
connect(this, &CommitList::entered,
|
connect(this, &CommitList::entered,
|
||||||
[this](const QModelIndex &index) { update(index); });
|
[this](const QModelIndex &index) { update(index); });
|
||||||
|
|
||||||
|
QShortcut *shortcut = new QShortcut(this);
|
||||||
|
prevCommitHotKey.use(shortcut);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this] {
|
||||||
|
printf("prevCommit\n");
|
||||||
|
});
|
||||||
|
|
||||||
|
shortcut = new QShortcut(this);
|
||||||
|
nextCommitHotKey.use(shortcut);
|
||||||
|
connect(shortcut, &QShortcut::activated, [this] {
|
||||||
|
printf("nextCommit\n");
|
||||||
|
});
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QFont font = this->font();
|
QFont font = this->font();
|
||||||
font.setPointSize(13);
|
font.setPointSize(13);
|
||||||
|
Loading…
Reference in New Issue
Block a user