119 lines
2.9 KiB
C++
119 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QApplication>
|
|
#include <QLabel>
|
|
#include <QSlider>
|
|
#include <QGridLayout>
|
|
#include <QPushButton>
|
|
#include <QCheckBox>
|
|
/*
|
|
* #else
|
|
* class QSlider;
|
|
* class QLabel;
|
|
* class QGridLayout;
|
|
* class QPushButton;
|
|
* class QWidget;
|
|
* class QMainWindow;
|
|
* #endif
|
|
*/
|
|
|
|
#include "global.h"
|
|
#include "contclasses.h"
|
|
//class EndpointHandler;
|
|
|
|
/*
|
|
* class ToggleButton : public QAbstractButton {
|
|
* Q_OBJECT
|
|
*
|
|
* public:
|
|
* ToggleButton(QWidget *parent = nullptr);
|
|
* void checkStateSet();
|
|
* bool hitButton(const QPoint &pos) const;
|
|
* void nextCheckState();
|
|
* void changeEvent(QEvent *e) override;
|
|
* bool event(QEvent *e) override;
|
|
* void focusInEvent(QFocusEvent *e) override;
|
|
* void focusOutEvent(QFocusEvent *e) override;
|
|
* void keyPressEvent(QKeyEvent *e) override;
|
|
* void keyReleaseEvent(QKeyEvent *e) override;
|
|
* void mouseMoveEvent(QMouseEvent *e) override;
|
|
* void mousePressEvent(QMouseEvent *e) override;
|
|
* void mouseReleaseEvent(QMouseEvent *e) override;
|
|
* void paintEvent(QPaintEvent *e) override = 0;
|
|
* void timerEvent(QTimerEvent *e) override;
|
|
* ToggleButton(QWidget *parent = nullptr);
|
|
* };
|
|
*/
|
|
|
|
class EndpointWidget : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
EndpointWidget(EndpointHandler* eph, QWidget *parent = nullptr);
|
|
//TODO: get();
|
|
EndpointHandler* eph;
|
|
void setIndex(uint64_t idx);
|
|
uint64_t getIndex();
|
|
|
|
void setVolume(int channel, float volume);
|
|
|
|
QCheckBox *muteButton = nullptr;
|
|
QLabel *mainLabel = nullptr, *leftChannelLabel = nullptr, *rightChannelLabel = nullptr;
|
|
QSlider *mainSlider = nullptr;
|
|
std::vector<QSlider*> channelSliders;
|
|
std::vector<QLabel*> channelLabels;
|
|
QGridLayout *layout = nullptr;
|
|
QGridLayout *mainMuteLayout = nullptr;
|
|
void updateMainVolume(float newValue);
|
|
void updateChannelVolume(uint32_t channel, float newValue);
|
|
void updateMute(bool muted);
|
|
//void toggleFrontEvents(bool active);
|
|
|
|
//void populateEndpointWidget(EndpointHandler *eph);
|
|
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
|
|
|
public slots:
|
|
void updateMainVolume(int newValue);
|
|
void updateMute(int checked);
|
|
|
|
private:
|
|
uint64_t idx;
|
|
//std::vector<EndpointHandler*> *ephs;
|
|
//std::vector<QSlider> *sliders;
|
|
|
|
//signals:
|
|
//void valueChanged(int value);
|
|
|
|
};
|
|
|
|
class MainWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
//QWidget *centralWidget;
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
void reloadEndpointWidgets();
|
|
|
|
//TODO: destroy/empty existing EndpointWidgets
|
|
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
|
|
|
private:
|
|
//std::vector<EndpointHandler*> *ephs;
|
|
std::vector<EndpointWidget*> ews;
|
|
QWidget *widget;
|
|
QGridLayout *layout;
|
|
//QLabel *pintas;
|
|
|
|
//public slots:
|
|
// void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
|
|
|
|
//signals:
|
|
//void valueChanged(int value);
|
|
|
|
};
|
|
|
|
#endif
|