anpstudio 0.4.0
ANP Studio — Analytic Network Process desktop application
Loading...
Searching...
No Matches
ratings_panel.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include "anpcpp/ratings.hpp"
9#include "ratings/rating_preset.hpp"
10
11#include <QWidget>
12
13#include <optional>
14
15class Document;
16class RatingPresetStore;
17class QComboBox;
18class QTableWidget;
19class QLabel;
20class QDoubleSpinBox;
21class QStackedWidget;
22class QPushButton;
23class QFrame;
24class QToolButton;
25
29class RatingsPanel : public QWidget {
30 Q_OBJECT
31public:
32 explicit RatingsPanel(Document* doc, QWidget* parent = nullptr);
33
34public slots:
35 void refresh();
36 void selectLink(const QString& parent, const QString& destCluster);
37
38private slots:
39 void onScaleActivated(int index);
40 void onAdvancedToggled(bool on);
41 void onAdvModeChanged();
42 void onAdvInterpreterChanged();
43 void onAddCategory();
44 void onAddKnot();
45 void onVoteComboChanged(int row);
46 void onVoteValueChanged(int row, int col);
47 void onSavePreset();
48 void onManagePresets();
49 void onImportPresets();
50 void rebuildScaleMenu();
51
52private:
53 anpcpp::RatingsPrioritizer* activeRatings();
54 void setEnabledUi(bool on);
55 void rebuildVotes();
56 void loadAdvancedFromActive();
57 void commitAdvancedIfNeeded();
58 void applyPreset(const RatingPreset& preset);
59 void setScaleDisplay(const QString& name, const QString& presetId);
60 void showCustomScaleInCombo();
61 [[nodiscard]] RatingPreset draftPresetFromAdvanced() const;
62 [[nodiscard]] std::vector<anpcpp::RatingCategory> readCategoryTable() const;
63 [[nodiscard]] anpcpp::ScoreInterpreter readInterpreter() const;
64 void updateNumericAdvancedVisibility();
65
66 Document* doc_ = nullptr;
67 RatingPresetStore* store_ = nullptr;
68 QString parent_;
69 QString destCluster_;
70
71 QLabel* header_ = nullptr;
72 QFrame* scaleBlock_ = nullptr;
73 QComboBox* scaleBox_ = nullptr;
74 QLabel* modeHint_ = nullptr;
75 QToolButton* advancedBtn_ = nullptr;
76 QWidget* advancedPanel_ = nullptr;
77
78 QComboBox* advModeBox_ = nullptr;
79 QStackedWidget* advStack_ = nullptr;
80 QTableWidget* catTable_ = nullptr;
81 QComboBox* interpreterBox_ = nullptr;
82 QDoubleSpinBox* constantSpin_ = nullptr;
83 QLabel* constantLabel_ = nullptr;
84 QTableWidget* knotTable_ = nullptr;
85 QLabel* knotLabel_ = nullptr;
86 QPushButton* addKnotBtn_ = nullptr;
87
88 QTableWidget* votesTable_ = nullptr;
89 QLabel* votesLabel_ = nullptr;
90
91 QString currentPresetId_;
92 int scaleBoxGuardIndex_ = 0;
93 bool updating_ = false;
94 bool applyingScale_ = false;
95 bool scaleIsCustom_ = false;
96 bool advancedOpen_ = false;
97};
Owns the root anpcpp::AnpNetwork, undo stack, file path, and dirty flag.
Definition document.hpp:71
RatingsPrioritizer editor with preset-first Scale + Advanced popout.
Definition ratings_panel.hpp:29