Update button layout and keyboard shortcut

This commit is contained in:
Gary Talent 2022-01-30 18:59:11 -06:00
parent c1cab3e3f3
commit 2d5af03724

View File

@ -15,7 +15,7 @@
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {
move(0, 0);
setFixedSize(590, 555);
setFixedSize(600, 555);
setWindowTitle(tr("Slide Controller 9000"));
const auto mainWidget = new QWidget(this);
const auto rootLyt = new QVBoxLayout;
@ -30,28 +30,28 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {
const auto btnPrevSlide = new QPushButton(tr("Previous Slide (Up)"), this);
const auto btnNextSlide = new QPushButton(tr("Next Slide (Down)"), this);
const auto btnNextSong = new QPushButton(tr("Next Song (Right)"), this);
const auto btnBlankSlides = new QPushButton(tr("Blank Slides (,)"), this);
const auto btnShowSlides = new QPushButton(tr("Show Slides (.)"), this);
controlsLayout->addWidget(btnPrevSlide, 0, 0);
controlsLayout->addWidget(btnNextSlide, 0, 1);
controlsLayout->addWidget(btnPrevSong, 1, 0);
controlsLayout->addWidget(btnNextSong, 1, 1);
controlsLayout->addWidget(btnBlankSlides, 2, 0);
controlsLayout->addWidget(btnShowSlides, 2, 1);
const auto btnOpenLpHideSlides = new QPushButton(tr("Hide in OpenLP (2)"), this);
const auto btnOpenLpShowSlides = new QPushButton(tr("Show in OpenLP (3)"), this);
controlsLayout->addWidget(btnPrevSlide, 0, 1);
controlsLayout->addWidget(btnNextSlide, 0, 2);
controlsLayout->addWidget(btnPrevSong, 0, 0);
controlsLayout->addWidget(btnNextSong, 0, 3);
controlsLayout->addWidget(btnOpenLpHideSlides, 1, 1);
controlsLayout->addWidget(btnOpenLpShowSlides, 1, 2);
btnNextSong->setShortcut(Qt::Key_Right);
btnPrevSong->setShortcut(Qt::Key_Left);
btnNextSlide->setShortcut(Qt::Key_Down);
btnPrevSlide->setShortcut(Qt::Key_Up);
btnBlankSlides->setShortcut(Qt::Key_Comma);
btnShowSlides->setShortcut(Qt::Key_Period);
btnBlankSlides->setToolTip(tr("Also hides slides in OBS"));
btnOpenLpHideSlides->setShortcut(Qt::Key_2);
btnOpenLpShowSlides->setShortcut(Qt::Key_3);
btnOpenLpHideSlides->setToolTip(tr("Also hides slides in OBS"));
connect(btnNextSlide, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::nextSlide);
connect(btnPrevSlide, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::prevSlide);
connect(btnNextSong, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::nextSong);
connect(btnPrevSong, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::prevSong);
connect(btnBlankSlides, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::blankScreen);
connect(btnBlankSlides, &QPushButton::clicked, &m_obsClient, &OBSClient::hideSlides);
connect(btnShowSlides, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::showSlides);
connect(btnOpenLpHideSlides, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::blankScreen);
connect(btnOpenLpHideSlides, &QPushButton::clicked, &m_obsClient, &OBSClient::hideSlides);
connect(btnOpenLpShowSlides, &QPushButton::clicked, &m_openlpClient, &OpenLPClient::showSlides);
connect(&m_openlpClient, &OpenLPClient::pollUpdate, m_slideView, &SlideView::pollUpdate);
connect(&m_openlpClient, &OpenLPClient::songListUpdate, m_slideView, &SlideView::songListUpdate);
connect(&m_openlpClient, &OpenLPClient::slideListUpdate, m_slideView, &SlideView::slideListUpdate);
@ -59,12 +59,12 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {
connect(m_slideView, &SlideView::songChanged, &m_openlpClient, &OpenLPClient::changeSong);
connect(m_slideView, &SlideView::slideChanged, &m_openlpClient, &OpenLPClient::changeSlide);
// setup scene selector
const auto btnObsHideSlides = new QPushButton(tr("Hide Slides in OBS (;)"), mainWidget);
const auto btnObsShowSlides = new QPushButton(tr("Show Slides in OBS (')"), mainWidget);
controlsLayout->addWidget(btnObsHideSlides, 3, 0);
controlsLayout->addWidget(btnObsShowSlides, 3, 1);
btnObsHideSlides->setShortcut(Qt::Key_Semicolon);
btnObsShowSlides->setShortcut(Qt::Key_Apostrophe);
const auto btnObsHideSlides = new QPushButton(tr("Hide in Both (1)"), mainWidget);
const auto btnObsShowSlides = new QPushButton(tr("Show in Both (4)"), mainWidget);
controlsLayout->addWidget(btnObsHideSlides, 1, 0);
controlsLayout->addWidget(btnObsShowSlides, 1, 3);
btnObsHideSlides->setShortcut(Qt::Key_1);
btnObsShowSlides->setShortcut(Qt::Key_4);
btnObsShowSlides->setToolTip(tr("Also shows slides in OpenLP"));
connect(btnObsHideSlides, &QPushButton::clicked, &m_obsClient, &OBSClient::hideSlides);
connect(btnObsShowSlides, &QPushButton::clicked, &m_obsClient, &OBSClient::showSlides);