summaryrefslogtreecommitdiff
path: root/qt/RGBController/controllerwindow.h
blob: 8b4456b24612cf2efbd4c11bc2de84bbfbfd2fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef CONTROLLERWINDOW_H
#define CONTROLLERWINDOW_H

/* includes */

#include <QMainWindow>
#include <QDebug>
#include <QFile>
#include <QSerialPortInfo>
#include <QTextStream>
#include <QMessageBox>
#include "serial_communication.h"
#include "ui_controllerwindow.h"

namespace Ui {
	class controllerWindow;
}

class controllerWindow : public QMainWindow
{
	Q_OBJECT

	public:
		explicit controllerWindow(QWidget *parent = 0);
		~controllerWindow();

		/* public functions */
		void info_log(QString text);
		void populate_serial_list();
		void load_presets();
		void save_preset(QString name);
		void delete_preset(QString name);
		void serial_rgb_change(int r, int g, int b);
		void show_msgbox(QString message);
		int show_question_box(QString message, QString omessage);
		/*public variables */
		/* these three ints will hold the current value (0 - 255) of each slider */
		int r, g, b;
		/* this list will contain all the presets loaded from file */
		QStringList presets;
		/* this string will hold our selected serial port */
		QString port;
		/* this int will contain the current preset index selected */
		int preset_index;

		private slots:
			/* these slots are used to trigger button clicks and drop down items selections etc */
			void on_connect_button_clicked();

			void on_disconnect_button_clicked();
	
			void on_refresh_port_button_clicked();

			void on_reload_preset_button_clicked();
	
			void on_r_slider_valueChanged(int value);

			void on_g_slider_valueChanged(int value);

			void on_b_slider_valueChanged(int value);

			void on_red_button_clicked();

			void on_green_button_clicked();

			void on_blue_button_clicked();

			void on_off_button_clicked();

			void on_set_preset_button_clicked();

			void on_presets_dropdown_currentIndexChanged(int index);

			void on_preset_save_button_clicked();

			void on_preset_delete_button_clicked();

            void on_red_fade_button_clicked();

            void on_green_fade_button_clicked();

            void on_blue_fade_button_clicked();

            void on_speed_button_clicked();

            void on_r_speed_slider_valueChanged(int value);

            void on_g_speed_slider_valueChanged(int value);

            void on_b_speed_slider_valueChanged(int value);

            void on_rfrom_valueChanged(int arg1);

            void on_rto_valueChanged(int arg1);

            void on_gfrom_valueChanged(int arg1);

            void on_gto_valueChanged(int arg1);

            void on_bfrom_valueChanged(int arg1);

            void on_bto_valueChanged(int arg1);

private:
		Ui::controllerWindow *ui;
		/* serial communication object */
		serial_communication portf;
};

#endif // CONTROLLERWINDOW_H