Internal
Public Access
77 lines
2.3 KiB
C++
77 lines
2.3 KiB
C++
#ifndef ORBITHUB_PROFILES_WINDOW_H
|
|
#define ORBITHUB_PROFILES_WINDOW_H
|
|
|
|
#include "profile_repository.h"
|
|
|
|
#include <QMainWindow>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QtGlobal>
|
|
|
|
#include <memory>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <QPointer>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
|
|
class QTreeWidget;
|
|
class QTreeWidgetItem;
|
|
class QLineEdit;
|
|
class QPushButton;
|
|
class QComboBox;
|
|
class QPoint;
|
|
class SessionWindow;
|
|
class ProfilesTreeWidget;
|
|
|
|
class ProfilesWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ProfilesWindow(QWidget* parent = nullptr);
|
|
~ProfilesWindow() override;
|
|
|
|
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;
|
|
QPointer<SessionWindow> m_sessionWindow;
|
|
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
|