Wholesale copy of all Kindred Create additions that don't conflict with upstream FreeCAD code: - kindred-icons/ (1444 Catppuccin Mocha SVG icon overrides) - src/Mod/Create/ (Kindred Create workbench) - src/Gui/ Kindred source files (FileOrigin, OriginManager, OriginSelectorWidget, CommandOrigin, BreadcrumbToolBar, EditingContext) - src/Gui/Icons/ (Kindred branding and silo icons) - src/Gui/PreferencePacks/KindredCreate/ - src/Gui/Stylesheets/ (KindredCreate.qss, images_dark-light/) - package/ (rattler-build recipe) - docs/ (architecture, guides, specifications) - .gitea/ (CI workflows, issue templates) - mods/silo, mods/ztools submodules - .gitmodules (Kindred submodule URLs) - resources/ (kindred-create.desktop, kindred-create.xml) - banner-logo-light.png, CONTRIBUTING.md
96 lines
3.7 KiB
C++
96 lines
3.7 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2025 Kindred Systems *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef GUI_ORIGINSELECTORWIDGET_H
|
|
#define GUI_ORIGINSELECTORWIDGET_H
|
|
|
|
#include <QToolButton>
|
|
#include <QMenu>
|
|
#include <QActionGroup>
|
|
#include <fastsignals/signal.h>
|
|
#include <FCGlobal.h>
|
|
|
|
namespace Gui {
|
|
|
|
class FileOrigin;
|
|
|
|
/**
|
|
* @brief Toolbar widget for selecting the current file origin
|
|
*
|
|
* OriginSelectorWidget displays the currently selected origin and provides
|
|
* a dropdown menu to switch between available origins (Local Files, Silo
|
|
* instances, etc.).
|
|
*
|
|
* Visual design:
|
|
* Collapsed (toolbar state):
|
|
* ┌──────────────────┐
|
|
* │ ☁️ Work ▼ │ ~70-100px wide
|
|
* └──────────────────┘
|
|
*
|
|
* Expanded (dropdown open):
|
|
* ┌──────────────────┐
|
|
* │ ✓ ☁️ Work │ ← Current selection (checkmark)
|
|
* │ ☁️ Prod │
|
|
* │ 📁 Local │
|
|
* ├──────────────────┤
|
|
* │ ⚙️ Manage... │ ← Opens config dialog
|
|
* └──────────────────┘
|
|
*/
|
|
class GuiExport OriginSelectorWidget : public QToolButton
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit OriginSelectorWidget(QWidget* parent = nullptr);
|
|
~OriginSelectorWidget() override;
|
|
|
|
private Q_SLOTS:
|
|
void onOriginActionTriggered(QAction* action);
|
|
void onManageOriginsClicked();
|
|
|
|
private:
|
|
void setupUi();
|
|
void connectSignals();
|
|
void disconnectSignals();
|
|
|
|
void onOriginRegistered(const std::string& originId);
|
|
void onOriginUnregistered(const std::string& originId);
|
|
void onCurrentOriginChanged(const std::string& originId);
|
|
|
|
void updateDisplay();
|
|
void rebuildMenu();
|
|
QIcon iconForOrigin(FileOrigin* origin) const;
|
|
|
|
QMenu* m_menu;
|
|
QActionGroup* m_originActions;
|
|
QAction* m_manageAction;
|
|
|
|
// Signal connections
|
|
fastsignals::scoped_connection m_connRegistered;
|
|
fastsignals::scoped_connection m_connUnregistered;
|
|
fastsignals::scoped_connection m_connChanged;
|
|
};
|
|
|
|
} // namespace Gui
|
|
|
|
#endif // GUI_ORIGINSELECTORWIDGET_H
|