ORE Studio 0.0.4
Loading...
Searching...
No Matches
ConnectionTypes.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_CONNECTION_TYPES_HPP
21#define ORES_QT_CONNECTION_TYPES_HPP
22
23#include <functional>
24#include <vector>
25#include <QString>
26#include <QColor>
27
28namespace ores::qt {
29
35using TestConnectionCallback = std::function<QString(
36 const QString& host, int port, const QString& username, const QString& password)>;
37
41inline const std::vector<QColor> tag_colors = {
42 QColor(59, 130, 246), // Blue
43 QColor(34, 197, 94), // Green
44 QColor(234, 179, 8), // Amber
45 QColor(239, 68, 68), // Red
46 QColor(168, 85, 247), // Purple
47 QColor(236, 72, 153), // Pink
48 QColor(20, 184, 166), // Teal
49 QColor(249, 115, 22), // Orange
50};
51
55inline QColor colorForTag(const QString& name) {
56 uint hash = qHash(name);
57 return tag_colors[hash % tag_colors.size()];
58}
59
60}
61
62#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
std::function< QString(const QString &host, int port, const QString &username, const QString &password)> TestConnectionCallback
Callback type for testing connections.
Definition ConnectionTypes.hpp:36
const std::vector< QColor > tag_colors
Predefined tag colors for consistent UI display.
Definition ConnectionTypes.hpp:41
QColor colorForTag(const QString &name)
Get a color for a tag based on its name.
Definition ConnectionTypes.hpp:55