Skip to content

Commit

Permalink
Initial round of UI improvents. This commit addresses widgets being t…
Browse files Browse the repository at this point in the history
…oo big on smaller screens and makes entire app resizble.
  • Loading branch information
covarianttensor committed Sep 28, 2019
1 parent 4608e77 commit 1a84315
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
16 changes: 15 additions & 1 deletion CasterSoundboard/CasterBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions CasterSoundboard/CasterPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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; "
Expand All @@ -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; "
Expand Down
26 changes: 11 additions & 15 deletions CasterSoundboard/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <QToolBar>
#include <QPushButton>
#include <QTableWidget>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QString>
#include <QStringList>
Expand Down Expand Up @@ -64,39 +65,36 @@ 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~~
addNewTabButton = new QPushButton;
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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1a84315

Please sign in to comment.