Initial round of UI improvents. This commit addresses widgets being too big on smaller screens and makes entire app resizble.

This commit is contained in:
Oscar Cerna-Mandujano 2019-09-28 02:25:59 -07:00
parent 4608e77e63
commit 1a84315b3a
3 changed files with 36 additions and 16 deletions

View File

@ -23,21 +23,35 @@
#include "CasterBoard.h"
#include "CasterPlayer.h"
#include "CasterPlayerState.h"
#include <QVBoxLayout>
#include <QGridLayout>
#include <QFile>
#include <QDataStream>
#include <QString>
#include <QScrollArea>
#include "libs/osc/composer/OscMessageComposer.h"
//Constructor=============================================
CasterBoard::CasterBoard(QWidget* parent) : QWidget(parent)
{
QGridLayout *boardLayout = new QGridLayout(this);
// Main Layout
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QScrollArea *playersScrollArea = new QScrollArea();
QWidget *boardWidget = new QWidget();
QGridLayout *boardLayout = new QGridLayout();
boardLayout->setMargin(0);
boardWidget->setMinimumWidth(1700);
boardWidget->setMinimumHeight(900);
boardWidget->setLayout(boardLayout);
playersScrollArea->setWidget(boardWidget);
mainLayout->addWidget(playersScrollArea, 0);
mainLayout->setMargin(0);
//Properties
soundBoardName = new QString("No Name");
profileFilePath = new QString("");
// MAPs
// int_to_player_key
int_to_player_key = new QMap<int,QString>

View File

@ -55,6 +55,12 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
// ID
id = new QString("");
// UI Settings
this->setMinimumWidth(200);
this->setMinimumHeight(200);
this->setMaximumWidth(200);
this->setMaximumHeight(200);
//Set Widget Defaults
this->setAcceptDrops(true);
@ -82,6 +88,7 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
//Set-Up Widget Layout
soundNameLabel = new QLabel("<Drop File>");
soundNameLabel->setStyleSheet("background-color:transparent;color:black;");
soundNameLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
QFont sNLF("Georgia",10,-1,false); sNLF.setBold(true);
soundNameLabel->setFont(sNLF);
@ -94,6 +101,7 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
hotKeyLabel->setStyleSheet("background:url(:/res/img/Key.png) no-repeat;background-attachment:fixed;background-position:center;color:white;");
//hotKeyLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
timeLabel = new QLabel("+00:00\n-00:00");
timeLabel->setStyleSheet("background-color:transparent;color:black;");
timeLabel->setAlignment(Qt::AlignHCenter | Qt::AlignRight);
QFont tLF("Georgia",9,-1,false); tLF.setBold(true);
timeLabel->setFont(tLF);
@ -134,6 +142,7 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
volumeSlider->setValue(100);
volumeSlider->setStyleSheet("QSlider:vertical {"
"min-width: 30px;"
"background-color:transparent;"
"}"
"QSlider::groove:vertical { "
"border: 1px solid #999999; "
@ -151,6 +160,7 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
trackBar->setValue(0);
trackBar->setStyleSheet("QSlider:horizontal {"
"min-height: 30px;"
"background-color:transparent;"
"}"
"QSlider::groove:horizontal { "
"border: 1px solid #999999; "

View File

@ -30,6 +30,7 @@
#include <QToolBar>
#include <QPushButton>
#include <QTableWidget>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QString>
#include <QStringList>
@ -64,9 +65,11 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
//SET WINDOW PROPETIES
this->setWindowTitle("CasterSoundboard");
this->setWindowIcon(QIcon(":/res/img/app.png"));
//this->setStyleSheet("background-color:#4D4D4D;color:white");
//DENFINE LAYOUT
QGridLayout *layout = new QGridLayout;
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
//INIT NEW TAB PUSH BUTTONS
//~~New Tab~~
@ -74,29 +77,24 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
addNewTabButton->setIcon(QIcon(":/res/img/newTab.png"));
addNewTabButton->setIconSize(QSize(40,40));
addNewTabButton->setToolTip("New Tab");
//addNewTabButton->setFixedSize(30,30);
//layout->addWidget(addNewTabButton,0,2, Qt::AlignRight);
//~~Open Tab~~
openTabButton = new QPushButton;
openTabButton->setIcon(QIcon(":/res/img/open.png"));
openTabButton->setIconSize(QSize(40,40));
openTabButton->setToolTip("Open Tab");
//openTabButton->setFixedSize(30,30);
//~~Save Tab~~
saveTabButton = new QPushButton;
saveTabButton->setIcon(QIcon(":/res/img/save.png"));
saveTabButton->setIconSize(QSize(40,40));
saveTabButton->setToolTip("Save Tab");
//saveTabButton->setFixedSize(30,30);
//~~Save As Tab~~
saveAsTabButton = new QPushButton;
saveAsTabButton->setIcon(QIcon(":/res/img/save_as.png"));
saveAsTabButton->setIconSize(QSize(40,40));
saveAsTabButton->setToolTip("Save Tab As");
//saveAsTabButton->setFixedSize(40,40);
//~~Stop ALL Sounds~~
stopAllSoundsButton = new QPushButton;
@ -127,8 +125,6 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
aboutButton->setIcon(QIcon(":/res/img/about.png"));
aboutButton->setIconSize(QSize(40,40));
aboutButton->setToolTip("About");
//aboutButton->setFixedSize(30,30);
//layout->addWidget(aboutButton,0,0, Qt::AlignLeft);
//======Main Toolbar=========
mainToolbar = new QToolBar;
@ -143,12 +139,12 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
mainToolbar->addWidget(openSoundControlButton);
mainToolbar->addWidget(aboutButton);
// Add toolbar to layout
layout->addWidget(mainToolbar, 0, 0, Qt::AlignLeft);
layout->addWidget(mainToolbar, 0, Qt::AlignLeft);
//INIT MAIN TAB CONTAINER
mainTabContainer = new QTabWidget;
mainTabContainer->setTabsClosable(true);
layout->addWidget(mainTabContainer,1,0, 2, 0);
layout->addWidget(mainTabContainer,0);
// Status Bar
main_statusbar = new QStatusBar;
@ -245,7 +241,7 @@ void MainWindow::addNewTab()
//ASK FOR SOUNDBOARD TAB
bool ok;
QString text = QInputDialog::getText(
this,
Q_NULLPTR,
tr("String"),
tr("Enter a tab name:"),
QLineEdit::Normal,
@ -277,7 +273,7 @@ void MainWindow::openProfile()
{
//File Diag
QString _filePath = QFileDialog::getOpenFileName(
this, "Open Sound Board Profile", "",
Q_NULLPTR, "Open Sound Board Profile", "",
"Sound Board Profile (*.caster)");
if (!_filePath.isNull())
@ -324,7 +320,7 @@ void MainWindow::saveTab()
file.close();
} else {
/* Save As.. */
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
QString _filePath = QFileDialog::getSaveFileName(Q_NULLPTR, "Save Sound Board Profile As...", "",
"Sound Board Profile (*.caster)");
if (!_filePath.isNull())
@ -354,7 +350,7 @@ void MainWindow::saveAsTab()
if(mainTabContainer->count() > 0)
{
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
QString _filePath = QFileDialog::getSaveFileName(Q_NULLPTR, "Save Sound Board Profile As...", "",
"Sound Board Profile (*.caster)");
if (!_filePath.isNull())
@ -386,7 +382,7 @@ void MainWindow::renameCurrentTab()
//ASK FOR SOUNDBOARD TAB
bool ok;
QString text = QInputDialog::getText(
this,
Q_NULLPTR,
tr("String"),
tr("Enter a new tab name:"),
QLineEdit::Normal,