52class ThemeColorEditor :
public QWidget
56 explicit ThemeColorEditor(QWidget *parent =
nullptr);
82 int invalidCount()
const {
return static_cast<int>(pending_.size()); }
105 bool selectToken(ThemeManager::ThemeToken token,
bool *filter_cleared =
nullptr);
108 QString
tokenLabel(ThemeManager::ThemeToken token)
const;
111 QIcon
tokenSwatch(ThemeManager::ThemeToken token)
const;
121 enum class RowKind { Color,
Graph, NoGraphs, Derived };
122 enum class RowState { None, Edited, Changed, Required };
125 RowKind kind = RowKind::Color;
126 ThemeManager::ThemeToken token = ThemeManager::NoRole;
132 bool required =
false;
133 RowState state = RowState::None;
134 QTreeWidgetItem *item =
nullptr;
137 int id()
const {
return rowIdFor(kind, token, graph); }
140 bool editable()
const {
return kind == RowKind::Color || kind == RowKind::Graph; }
143 using ResolvedMap = QHash<ThemeManager::ThemeToken, QColor>;
145 static int rowIdFor(RowKind kind, ThemeManager::ThemeToken token,
int graph);
146 static QString graphDescription();
147 static QString tokenName(ThemeManager::ThemeToken token);
149 static QString chooseTitle(
const Row &row,
int side);
150 static void resolveBoth(
const ThemeDraft &
draft, ResolvedMap out[2],
157 void updateDetail(
bool force_fields);
158 void updateField(
int side);
160 const Row *currentRow()
const;
161 QColor inputColor(
const Row &row,
int side,
bool *is_set =
nullptr)
const;
162 QColor shownColor(
const Row &row,
int side)
const;
163 QString rowDescription(
const Row &row)
const;
165 QString derivedText(ThemeManager::ThemeToken token)
const;
167 QString autoValueText(
const QColor &shown)
const;
168 QStringList affectedTokens(ThemeManager::ThemeToken token)
const;
173 QList<ThemeManager::ThemeToken> sourceTokens(
const Row &row)
const;
175 bool offersSources(
const Row &row)
const;
176 void setColor(
const Row &row,
int side,
const QColor &color);
177 void dropPending(
int row_id);
178 void shiftGraphPending(
int from,
int delta);
179 void removeGraphSlot(
int slot);
186 void finishChange(
bool force_fields =
false);
192 bool sideValueEdited(
const Row &row,
int side)
const;
194 bool sideEdited(
const Row &row,
int side)
const;
196 void currentItemChanged(QTreeWidgetItem *current);
197 void hexEdited(
int side,
const QString &text);
198 void hexEditingFinished(
int side);
199 void chooseColor(
int side);
202 void revertSide(
int side);
203 void showContextMenu(
const QPoint &pos);
204 void addGraphColor();
205 void removeGraphColor();
210 ResolvedMap base_resolved_[2];
211 ResolvedMap draft_resolved_[2];
214 int current_row_id_ = -1;
217 QHash<int, int> row_index_;
218 QList<QTreeWidgetItem *> group_items_;
220 QMap<QPair<int, int>, QString> pending_;
222 Ui::ThemeColorEditor *ui_;
224 QWidget *side_widget_[2];
225 QLabel *swatch_label_[2];
226 SyntaxLineEdit *hex_edit_[2];
227 QPushButton *choose_button_[2];
228 QPushButton *revert_button_[2];
Represents a single data graph within a QCustomPlot, managing its data, visual style,...
Definition graph.h:25
QLineEdit subclass that adds syntax-state colouring, error messaging, and partial token-based autocom...
Definition syntax_line_edit.h:28