Internal
Public Access
ProfilesWindow and SessionWindow were two independent top-level windows, coordinated through a QPointer and manual show/create-or-reuse logic, with duplicated Help menus and a path where Quit didn't actually quit if a SessionWindow happened to be open. ProfilesWindow is now an embedded QWidget shown as a permanent, unclosable "Profiles" tab inside SessionWindow's tab widget; SessionWindow is the app's sole top-level window. Double-clicking a profile opens a session tab in the same window instead of finding-or-creating a second one, and closing all session tabs falls back to the Profiles tab rather than closing the app. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
80 lines
2.4 KiB
C++
80 lines
2.4 KiB
C++
#ifndef ORBITHUB_PROFILES_WINDOW_H
|
|
#define ORBITHUB_PROFILES_WINDOW_H
|
|
|
|
#include "profile_repository.h"
|
|
|
|
#include <QWidget>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QtGlobal>
|
|
|
|
#include <memory>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
|
|
class QTreeWidget;
|
|
class QTreeWidgetItem;
|
|
class QLineEdit;
|
|
class QPushButton;
|
|
class QComboBox;
|
|
class QPoint;
|
|
class ProfilesTreeWidget;
|
|
|
|
class ProfilesWindow : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ProfilesWindow(QWidget* parent = nullptr);
|
|
~ProfilesWindow() override;
|
|
|
|
void createProfileInCurrentContext();
|
|
void createFolderInCurrentContext();
|
|
|
|
signals:
|
|
void connectRequested(const Profile& profile);
|
|
|
|
private:
|
|
QLineEdit* m_searchBox;
|
|
QComboBox* m_viewModeBox;
|
|
QComboBox* m_sortBox;
|
|
QComboBox* m_protocolFilterBox;
|
|
QComboBox* m_tagFilterBox;
|
|
ProfilesTreeWidget* m_profilesTree;
|
|
QPushButton* m_newButton;
|
|
QPushButton* m_editButton;
|
|
QPushButton* m_deleteButton;
|
|
std::unique_ptr<ProfileRepository> m_repository;
|
|
std::unordered_map<qint64, Profile> m_profileCache;
|
|
QString m_pendingTagFilterPreference;
|
|
|
|
void setupUi();
|
|
void loadProfiles();
|
|
ProfileSortOrder selectedSortOrder() const;
|
|
bool isFolderViewEnabled() const;
|
|
QString selectedProtocolFilter() const;
|
|
QString selectedTagFilter() const;
|
|
void updateTagFilterOptions(const std::vector<Profile>& profiles);
|
|
QTreeWidgetItem* upsertFolderNode(const QStringList& folderParts,
|
|
std::map<QString, QTreeWidgetItem*>& folderNodes);
|
|
void addProfileNode(QTreeWidgetItem* parent, const Profile& profile);
|
|
QString folderPathForItem(const QTreeWidgetItem* item) const;
|
|
void showTreeContextMenu(const QPoint& pos);
|
|
void createFolderInContext(const QString& baseFolderPath);
|
|
void persistFolderAssignmentsFromTree();
|
|
void collectProfileAssignments(const QTreeWidgetItem* item,
|
|
const QString& parentFolderPath,
|
|
std::unordered_map<qint64, QString>& assignments) const;
|
|
void loadUiPreferences();
|
|
void saveUiPreferences() const;
|
|
std::optional<Profile> selectedProfile() const;
|
|
void createProfile(const QString& defaultFolderPath = QString());
|
|
void editSelectedProfile();
|
|
void deleteSelectedProfile();
|
|
void openSessionForItem(QTreeWidgetItem* item);
|
|
};
|
|
|
|
#endif
|