From ae7f310ab29fbd3bbbcb54c4406b6fbdff49fa30 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 28 Sep 2020 18:59:48 +0200 Subject: [PATCH] window: use EntryConfig, not EntryPushButton for slots No point to implicitly convert them, in fact it was a mistake. --- window.cpp | 16 ++++++++-------- window.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/window.cpp b/window.cpp index 5c00ddb..bd95381 100644 --- a/window.cpp +++ b/window.cpp @@ -118,21 +118,21 @@ void Window::populateGrid(const QVector &list) } } -void Window::buttonClick(const EntryPushButton &button) +void Window::buttonClick(const EntryConfig &config) { - QProcess::startDetached(button.getCommand(), button.getArguments()); + QProcess::startDetached(config.command, config.arguments); this->closeWindow(); } -void Window::addToFavourites(const EntryPushButton &button) +void Window::addToFavourites(const EntryConfig &config) { std::pair cell = getNextFreeCell(); - EntryConfig userConfig = button.getEntryConfig(); + EntryConfig userConfig = config; userConfig.userEntry = true; userConfig.row = cell.first; userConfig.col = cell.second; - userConfig.inherit = button.getEntryConfig().entryPath; - QFileInfo fi{button.getEntryConfig().entryPath}; + userConfig.inherit = userConfig.entryPath; + QFileInfo fi{userConfig.entryPath}; QString entryName = fi.completeBaseName() + ".qsrun"; userConfig.entryPath = this->settingsProvider->userEntriesPaths()[0] + "/" + entryName; try @@ -369,7 +369,7 @@ void Window::keyPressEvent(QKeyEvent *event) [&key](const EntryPushButton *y) { return y->getShortcutKey() == key; }); if(it != buttonsInGrid.end()) { - buttonClick(**it); + buttonClick((*it)->getEntryConfig()); } } QWidget::keyPressEvent(event); @@ -443,7 +443,7 @@ void Window::lineEditReturnPressed() if(buttonsInGrid.length() > 0 && this->lineEdit->text().length() > 0) { - buttonClick(*buttonsInGrid[0]); + buttonClick(buttonsInGrid[0]->getEntryConfig()); return; } } diff --git a/window.h b/window.h index c0735e5..efeb232 100644 --- a/window.h +++ b/window.h @@ -63,8 +63,8 @@ class Window : public QWidget void keyReleaseEvent(QKeyEvent *event); QVector generateEntryButtons(const QVector &userEntryButtons); void keyPressEvent(QKeyEvent *event); - void buttonClick(const EntryPushButton &button); - void addToFavourites(const EntryPushButton &button); + void buttonClick(const EntryConfig &button); + void addToFavourites(const EntryConfig &button); void deleteEntry(EntryConfig &config); QLineEdit *lineEdit; QGridLayout *grid;