feat(gui): add OriginSelectorWidget for file origin selection (#13)
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
- Create OriginSelectorWidget class (QToolButton with dropdown menu) - Add OriginSelectorAction to create widget in toolbars - Add Std_Origin command registered in CommandStd.cpp - Add widget to File toolbar (before New/Open/Save) - Connect to OriginManager fastsignals for origin changes - Add Catppuccin Mocha styling for the widget - Widget shows current origin name/icon with connection status overlay This implements Issue #13: Origin selector toolbar widget
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
#include "Workbench.h"
|
||||
#include "WorkbenchManager.h"
|
||||
#include "WorkbenchSelector.h"
|
||||
#include "OriginSelectorWidget.h"
|
||||
#include "ShortcutManager.h"
|
||||
#include "Tools.h"
|
||||
|
||||
@@ -1470,4 +1471,25 @@ void WindowAction::addTo(QWidget* widget)
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
OriginSelectorAction::OriginSelectorAction(Command* pcCmd, QObject* parent)
|
||||
: Action(pcCmd, parent)
|
||||
{}
|
||||
|
||||
OriginSelectorAction::~OriginSelectorAction() = default;
|
||||
|
||||
void OriginSelectorAction::addTo(QWidget* widget)
|
||||
{
|
||||
if (widget->inherits("QToolBar")) {
|
||||
auto* toolbar = static_cast<QToolBar*>(widget);
|
||||
auto* selector = new OriginSelectorWidget(widget);
|
||||
toolbar->addWidget(selector);
|
||||
}
|
||||
else {
|
||||
// For menus, just add the action
|
||||
widget->addAction(action());
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_Action.cpp"
|
||||
|
||||
Reference in New Issue
Block a user