dynamic height + width 1st commit

This commit is contained in:
Hane 2024-04-03 23:53:33 +02:00
commit 90286b6853
3 changed files with 97 additions and 118 deletions

View file

@ -1,7 +1,7 @@
#pragma once
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
//#ifndef MAINWINDOW_H
//#define MAINWINDOW_H
#include <QMainWindow>
#include <QApplication>
@ -38,31 +38,6 @@
#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);
* };
*/
enum SpawnPos {
LEFT = (1 << 1),
@ -117,8 +92,7 @@ private:
QLabel *mainLabel = nullptr;
QSlider *mainSlider = nullptr;
uint64_t idx;
//QGridLayout *layout = nullptr;
QHBoxLayout *layout = nullptr;
QHBoxLayout *widgetLayout = nullptr;
QCheckBox *muteButton = nullptr;
SessionHandler* sh;
QTimer* volumePoller = nullptr;
@ -137,7 +111,7 @@ private:
uint32_t channelCount;
std::vector<QSlider*> channelSliders;
std::vector<QLabel*> channelLabels;
QGridLayout *layout;
QGridLayout *widgetLayout;
};
@ -181,7 +155,7 @@ private:
QSlider *mainSlider = nullptr;
std::vector<QSlider*> channelSliders;
std::vector<QLabel*> channelLabels;
QGridLayout *layout = nullptr;
QGridLayout *widgetLayout = nullptr;
QGridLayout *mainMuteLayout = nullptr;
std::map<Roles, ExtendedCheckBox*> defaultRolesCheckBoxes;
@ -205,25 +179,8 @@ Q_OBJECT
public:
HeaderWidget(QWidget *parent = nullptr);
//~HeaderWidget();
//void updateMainVolume(float newValue);
//void updateVolume(uint32_t channel, float newValue);
//void updateMute(bool muted);
//void populateEndpointWidget(EndpointHandler *eph);
//void setEndpointHandlers(std::vector<EndpointHandler*> *ephs);
//public slots:
//protected:
//void customEvent(QEvent* ev) override;
//private slots:
//void addSessionWidget(CustomWidgetEvent<SessionHandler*>* ev);
//void removeSessionWidget(CustomWidgetEvent<SessionHandler*>* ev);
private:
QGridLayout *layout;
QGridLayout *widgetLayout;
QPushButton *about;
#ifdef WIN32
QPushButton *openCP;
@ -238,11 +195,12 @@ class MainWindow : public QMainWindow {
public:
MainWindow(QWidget *parent = nullptr);
void reloadEndpointWidgets();
void calculateChildWidgetsSize();
protected:
void closeEvent(QCloseEvent *event) override;
void customEvent(QEvent* ev) override;
QRect setSizePosition();
QRect setSizePosition(int width, int height);
private slots:
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
@ -256,7 +214,7 @@ private:
//std::vector<EndpointHandler*> *ephs;
std::vector<EndpointWidget*> ews;
QWidget *widget;
QGridLayout *layout;
QGridLayout *widgetLayout;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
@ -283,4 +241,4 @@ private:
};
#endif
//#endif