From 7d84fbfc1d81ca58cf9217af1906e402d51c69ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Thu, 21 Dec 2017 16:16:43 +0100 Subject: [PATCH] Remove Omnibar Commands --- README.md | 1 - src/MainWindow.cpp | 4 -- src/widgets/Omnibar.cpp | 117 ++-------------------------------------- src/widgets/Omnibar.h | 2 - 4 files changed, 4 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index cd60e59b..04293e00 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ Cutter is developed on OS X, Linux and Windows. The first release for users will | Global shortcuts: || | . | Focus console input | | G & S | Focus search bar | -| : | Show commands | | F5 | Refresh contents | | Disassembly view: || | Esc | Seek to previous position | diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 6554a3cf..3a6f5435 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -301,10 +301,6 @@ void MainWindow::initUI() QShortcut *seek_shortcut = new QShortcut(QKeySequence(Qt::Key_S), this); connect(seek_shortcut, SIGNAL(activated()), this->omnibar, SLOT(setFocus())); - // : goes to goto entry - QShortcut *commands_shortcut = new QShortcut(QKeySequence(Qt::Key_Colon), this); - connect(commands_shortcut, SIGNAL(activated()), this->omnibar, SLOT(showCommands())); - QShortcut *refresh_shortcut = new QShortcut(QKeySequence(QKeySequence::Refresh), this); connect(refresh_shortcut, SIGNAL(activated()), this, SLOT(refreshAll())); diff --git a/src/widgets/Omnibar.cpp b/src/widgets/Omnibar.cpp index afed28d7..778ee784 100644 --- a/src/widgets/Omnibar.cpp +++ b/src/widgets/Omnibar.cpp @@ -9,27 +9,7 @@ Omnibar::Omnibar(MainWindow *main, QWidget *parent) : QLineEdit(parent), - main(main), - commands( -{ - ": Comments toggle", - ": Dashboard toggle", - ": Exports toggle", - ": Flags toggle", - ": Functions toggle", - ": Imports toggle", - ": Lock/Unlock interface", - ": Notepad toggle", - ": Refresh contents", - ": Relocs toggle", - ": Run Script", - ": Sections toggle", - ": Strings toggle", - ": Symbols toggle", - ": Tabs up/down", - ": Theme switch", - ": Web server start/stop" -}) + main(main) { // QLineEdit basic features this->setMinimumHeight(16); @@ -51,7 +31,7 @@ Omnibar::Omnibar(MainWindow *main, QWidget *parent) : void Omnibar::setupCompleter() { // Set gotoEntry completer for jump history - QCompleter *completer = new QCompleter(flags + commands, this); + QCompleter *completer = new QCompleter(flags, this); completer->setMaxVisibleItems(20); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); @@ -74,23 +54,6 @@ void Omnibar::restoreCompleter() completer->setFilterMode(Qt::MatchContains); } -void Omnibar::showCommands() -{ - this->setFocus(); - this->setText(": "); - - QCompleter *completer = this->completer(); - completer->setCompletionMode(QCompleter::PopupCompletion); - completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); - completer->setCaseSensitivity(Qt::CaseInsensitive); - completer->setFilterMode(Qt::MatchStartsWith); - - completer->setMaxVisibleItems(20); - - completer->setCompletionPrefix(": "); - completer->complete(); -} - void Omnibar::clear() { QLineEdit::clear(); @@ -103,83 +66,11 @@ void Omnibar::clear() void Omnibar::on_gotoEntry_returnPressed() { QString str = this->text(); - if (str.length() > 0) + if (!str.isEmpty()) { - if (str.contains(": ")) - { - if (str.contains("Lock")) - { - this->main->on_actionLock_triggered(); - } - else if (str.contains("Functions")) - { - this->main->on_actionFunctions_triggered(); - } - else if (str.contains("Flags")) - { - this->main->on_actionFlags_triggered(); - } - else if (str.contains("Sections")) - { - this->main->on_actionSections_triggered(); - } - else if (str.contains("Strings")) - { - this->main->on_actionStrings_triggered(); - } - else if (str.contains("Imports")) - { - this->main->on_actionImports_triggered(); - } - else if (str.contains("Exports")) - { - this->main->on_actionExports_triggered(); - } - else if (str.contains("Symbols")) - { - this->main->on_actionSymbols_triggered(); - } - else if (str.contains("Refresh")) - { - this->main->refreshAll(); - } - else if (str.contains("Relocs")) - { - this->main->on_actionReloc_triggered(); - } - else if (str.contains("Comments")) - { - this->main->on_actionComents_triggered(); - } - else if (str.contains("Notepad")) - { - this->main->on_actionNotepad_triggered(); - } - else if (str.contains("Dashboard")) - { - this->main->on_actionDashboard_triggered(); - } - else if (str.contains("Theme")) - { - this->main->toggleTheme(); - } - else if (str.contains("Script")) - { - this->main->on_actionRun_Script_triggered(); - } - else if (str.contains("Tabs")) - { - this->main->on_actionTabs_triggered(); - } - } - else - { - Core()->seek(text()); - } + Core()->seek(str); } - // check which tab is open? update all tabs? hex, graph? - //refreshMem( this->gotoEntry->text() ); this->setText(""); this->clearFocus(); this->restoreCompleter(); diff --git a/src/widgets/Omnibar.h b/src/widgets/Omnibar.h index db21dd87..34aff83c 100644 --- a/src/widgets/Omnibar.h +++ b/src/widgets/Omnibar.h @@ -19,14 +19,12 @@ private slots: void restoreCompleter(); public slots: - void showCommands(); void clear(); private: void setupCompleter(); MainWindow *main; - const QStringList commands; QStringList flags; };