window: use EntryConfig, not EntryPushButton for slots
No point to implicitly convert them, in fact it was a mistake.
This commit is contained in:
parent
2ab0750f3a
commit
ae7f310ab2
16
window.cpp
16
window.cpp
@ -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();
|
this->closeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::addToFavourites(const EntryPushButton &button)
|
void Window::addToFavourites(const EntryConfig &config)
|
||||||
{
|
{
|
||||||
std::pair<int, int> cell = getNextFreeCell();
|
std::pair<int, int> cell = getNextFreeCell();
|
||||||
EntryConfig userConfig = button.getEntryConfig();
|
EntryConfig userConfig = config;
|
||||||
userConfig.userEntry = true;
|
userConfig.userEntry = true;
|
||||||
userConfig.row = cell.first;
|
userConfig.row = cell.first;
|
||||||
userConfig.col = cell.second;
|
userConfig.col = cell.second;
|
||||||
userConfig.inherit = button.getEntryConfig().entryPath;
|
userConfig.inherit = userConfig.entryPath;
|
||||||
QFileInfo fi{button.getEntryConfig().entryPath};
|
QFileInfo fi{userConfig.entryPath};
|
||||||
QString entryName = fi.completeBaseName() + ".qsrun";
|
QString entryName = fi.completeBaseName() + ".qsrun";
|
||||||
userConfig.entryPath = this->settingsProvider->userEntriesPaths()[0] + "/" + entryName;
|
userConfig.entryPath = this->settingsProvider->userEntriesPaths()[0] + "/" + entryName;
|
||||||
try
|
try
|
||||||
@ -369,7 +369,7 @@ void Window::keyPressEvent(QKeyEvent *event)
|
|||||||
[&key](const EntryPushButton *y) { return y->getShortcutKey() == key; });
|
[&key](const EntryPushButton *y) { return y->getShortcutKey() == key; });
|
||||||
if(it != buttonsInGrid.end())
|
if(it != buttonsInGrid.end())
|
||||||
{
|
{
|
||||||
buttonClick(**it);
|
buttonClick((*it)->getEntryConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QWidget::keyPressEvent(event);
|
QWidget::keyPressEvent(event);
|
||||||
@ -443,7 +443,7 @@ void Window::lineEditReturnPressed()
|
|||||||
|
|
||||||
if(buttonsInGrid.length() > 0 && this->lineEdit->text().length() > 0)
|
if(buttonsInGrid.length() > 0 && this->lineEdit->text().length() > 0)
|
||||||
{
|
{
|
||||||
buttonClick(*buttonsInGrid[0]);
|
buttonClick(buttonsInGrid[0]->getEntryConfig());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
window.h
4
window.h
@ -63,8 +63,8 @@ class Window : public QWidget
|
|||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
QVector<EntryPushButton *> generateEntryButtons(const QVector<EntryConfig> &userEntryButtons);
|
QVector<EntryPushButton *> generateEntryButtons(const QVector<EntryConfig> &userEntryButtons);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void buttonClick(const EntryPushButton &button);
|
void buttonClick(const EntryConfig &button);
|
||||||
void addToFavourites(const EntryPushButton &button);
|
void addToFavourites(const EntryConfig &button);
|
||||||
void deleteEntry(EntryConfig &config);
|
void deleteEntry(EntryConfig &config);
|
||||||
QLineEdit *lineEdit;
|
QLineEdit *lineEdit;
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
|
Loading…
Reference in New Issue
Block a user