Skip to content

Commit

Permalink
Warn that Natural keymap is not exportable. Fix #448
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Jun 26, 2024
1 parent cd31480 commit f3c7ecf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gui/qt/keypad/qtkeypadbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ Qt::KeyboardModifiers QtKeypadBridge::toModifierValue(QString m) {
}

bool QtKeypadBridge::keymapExport(const QString &path) {
if (!keymap) {
return false;
}

QSettings config(path, QSettings::IniFormat);
config.clear();

Expand Down
1 change: 1 addition & 0 deletions gui/qt/keypad/qtkeypadbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class QtKeypadBridge : public QObject {

explicit QtKeypadBridge(QObject *parent = Q_NULLPTR) : QObject(parent) {}

KeymapMode getKeymapMode() const { return m_mode; }
bool setKeymap(KeymapMode map);
void skEvent(QKeyEvent *event, bool press);
void kEvent(QString text, int key = 0, bool repeat = false);
Expand Down
5 changes: 5 additions & 0 deletions gui/qt/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,11 @@ void MainWindow::guiImport() {
}

void MainWindow::keymapExport() {
if (keypadBridge->getKeymapMode() == QtKeypadBridge::KEYMAP_NATURAL) {
QMessageBox::warning(this, MSG_WARNING, tr("Natural keymap is not exportable"));
return;
}

QString filter = tr("Keymap Config (*.ini)");
QString path = QFileDialog::getSaveFileName(this, tr("Save keymap configuration"),
m_dir.absolutePath(), filter, &filter);
Expand Down

0 comments on commit f3c7ecf

Please sign in to comment.