aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets
diff options
context:
space:
mode:
authorswirl <swurl@swurl.xyz>2022-02-03 13:53:30 -0500
committerswirl <swurl@swurl.xyz>2022-02-03 13:53:30 -0500
commite8a4902a3dddd08d65bd1284951ae5954439d1f5 (patch)
treeb5936e950cf149366366db156f90e51c25f2257a /launcher/ui/widgets
parentfcc4420cfec3fcd970ff1f35b8848559c7b5b6ef (diff)
parente2952061af24e0b9a4639d5ff1eb24c57f65830a (diff)
downloadPrismLauncher-e8a4902a3dddd08d65bd1284951ae5954439d1f5.tar.gz
PrismLauncher-e8a4902a3dddd08d65bd1284951ae5954439d1f5.tar.bz2
PrismLauncher-e8a4902a3dddd08d65bd1284951ae5954439d1f5.zip
Merge branch 'feature/download_mods' into develop
Diffstat (limited to 'launcher/ui/widgets')
-rw-r--r--launcher/ui/widgets/WideBar.cpp14
-rw-r--r--launcher/ui/widgets/WideBar.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp
index cbd6c617..8d5bd12d 100644
--- a/launcher/ui/widgets/WideBar.cpp
+++ b/launcher/ui/widgets/WideBar.cpp
@@ -76,6 +76,20 @@ void WideBar::addSeparator()
m_entries.push_back(entry);
}
+void WideBar::insertActionBefore(QAction* before, QAction* action){
+ auto iter = std::find_if(m_entries.begin(), m_entries.end(), [before](BarEntry * entry) {
+ return entry->wideAction == before;
+ });
+ if(iter == m_entries.end()) {
+ return;
+ }
+ auto entry = new BarEntry();
+ entry->qAction = insertWidget((*iter)->qAction, new ActionButton(action, this));
+ entry->wideAction = action;
+ entry->type = BarEntry::Action;
+ m_entries.insert(iter, entry);
+}
+
void WideBar::insertSpacer(QAction* action)
{
auto iter = std::find_if(m_entries.begin(), m_entries.end(), [action](BarEntry * entry) {
diff --git a/launcher/ui/widgets/WideBar.h b/launcher/ui/widgets/WideBar.h
index d1b8cbe7..2b676a8c 100644
--- a/launcher/ui/widgets/WideBar.h
+++ b/launcher/ui/widgets/WideBar.h
@@ -18,6 +18,7 @@ public:
void addAction(QAction *action);
void addSeparator();
void insertSpacer(QAction *action);
+ void insertActionBefore(QAction *before, QAction *action);
QMenu *createContextMenu(QWidget *parent = nullptr, const QString & title = QString());
private: