window: use EntryConfig, not EntryPushButton for slots

No point to implicitly convert them, in fact it was a mistake.
This commit is contained in:
Albert S. 2020-09-28 18:59:48 +02:00
parent 2ab0750f3a
commit ae7f310ab2
2 changed files with 10 additions and 10 deletions

View File

@ -118,21 +118,21 @@ void Window::populateGrid(const QVector<EntryPushButton *> &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<int, int> 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;
}
}

View File

@ -63,8 +63,8 @@ class Window : public QWidget
void keyReleaseEvent(QKeyEvent *event);
QVector<EntryPushButton *> generateEntryButtons(const QVector<EntryConfig> &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;