- Add missing images for opening the settings and swap the screens.

- Add basic screen swapping
This commit is contained in:
Maschell 2020-02-19 20:39:43 +01:00
parent b1797266c9
commit 4c4fbcfb2e
6 changed files with 70 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

View File

@ -61,12 +61,6 @@ public:
switchLayoutButton.setEffectGrow(); switchLayoutButton.setEffectGrow();
switchLayoutButton.clicked.connect(this, &MainDrcButtonsFrame::OnLayoutSwithClick); switchLayoutButton.clicked.connect(this, &MainDrcButtonsFrame::OnLayoutSwithClick);
append(&switchLayoutButton); append(&switchLayoutButton);
gameImageDownloadButton.setClickable(true);
gameImageDownloadButton.setSoundClick(buttonClickSound);
gameImageDownloadButton.setTrigger(&plusTrigger);
gameImageDownloadButton.clicked.connect(this, &MainDrcButtonsFrame::OnGameImageDownloadButtonClicked);
append(&gameImageDownloadButton);
} }
virtual ~MainDrcButtonsFrame() virtual ~MainDrcButtonsFrame()
{ {
@ -78,7 +72,6 @@ public:
sigslot::signal1<GuiElement *> settingsButtonClicked; sigslot::signal1<GuiElement *> settingsButtonClicked;
sigslot::signal1<GuiElement *> layoutSwitchClicked; sigslot::signal1<GuiElement *> layoutSwitchClicked;
sigslot::signal1<GuiElement *> gameImageDownloadClicked;
private: private:
void OnSettingsButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *) { void OnSettingsButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *) {
settingsButtonClicked(this); settingsButtonClicked(this);
@ -86,9 +79,6 @@ private:
void OnLayoutSwithClick(GuiButton *button, const GuiController *controller, GuiTrigger *) { void OnLayoutSwithClick(GuiButton *button, const GuiController *controller, GuiTrigger *) {
layoutSwitchClicked(this); layoutSwitchClicked(this);
} }
void OnGameImageDownloadButtonClicked(GuiButton *button, const GuiController *controller, GuiTrigger *) {
gameImageDownloadClicked(this);
}
GuiSound *buttonClickSound; GuiSound *buttonClickSound;
GuiSound *screenSwitchSound; GuiSound *screenSwitchSound;

View File

@ -181,7 +181,10 @@ void MainWindow::SetupMainView() {
currentTvFrame->effectFinished.connect(this, &MainWindow::OnOpenEffectFinish); currentTvFrame->effectFinished.connect(this, &MainWindow::OnOpenEffectFinish);
appendTv(currentTvFrame); appendTv(currentTvFrame);
currentDrcFrame = currentTvFrame; currentDrcFrame = new GuiIconGrid(width, height,0);
currentDrcFrame->setEffect(EFFECT_FADE, 10, 255);
currentDrcFrame->setState(GuiElement::STATE_DISABLED);
currentDrcFrame->effectFinished.connect(this, &MainWindow::OnOpenEffectFinish);
if(currentTvFrame != currentDrcFrame) { if(currentTvFrame != currentDrcFrame) {
@ -206,6 +209,8 @@ void MainWindow::SetupMainView() {
currentDrcFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch); currentDrcFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch);
mainSwitchButtonFrame = new MainDrcButtonsFrame(width, height); mainSwitchButtonFrame = new MainDrcButtonsFrame(width, height);
mainSwitchButtonFrame->settingsButtonClicked.connect(this, &MainWindow::OnSettingsButtonClicked);
mainSwitchButtonFrame->layoutSwitchClicked.connect(this, &MainWindow::OnLayoutSwitchClicked);
mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED); mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED);
mainSwitchButtonFrame->setEffect(EFFECT_FADE, 10, 255); mainSwitchButtonFrame->setEffect(EFFECT_FADE, 10, 255);
mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED); mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED);
@ -215,6 +220,62 @@ void MainWindow::SetupMainView() {
append(mainSwitchButtonFrame); append(mainSwitchButtonFrame);
} }
void MainWindow::OnLayoutSwitchClicked(GuiElement *element) {
if(!currentTvFrame || !currentDrcFrame || !mainSwitchButtonFrame) {
return;
}
if(currentTvFrame == currentDrcFrame) {
return;
}
currentTvFrame->setState(GuiElement::STATE_DISABLED);
currentTvFrame->setEffect(EFFECT_FADE, -15, 0);
currentTvFrame->effectFinished.connect(this, &MainWindow::OnLayoutSwitchEffectFinish);
currentDrcFrame->setState(GuiElement::STATE_DISABLED);
currentDrcFrame->setEffect(EFFECT_FADE, -15, 0);
mainSwitchButtonFrame->setState(GuiElement::STATE_DISABLED);
}
void MainWindow::OnLayoutSwitchEffectFinish(GuiElement *element) {
if(!currentTvFrame || !currentDrcFrame || !mainSwitchButtonFrame)
return;
element->effectFinished.disconnect(this);
remove(currentDrcFrame);
remove(currentTvFrame);
GuiTitleBrowser *tmpElement = currentDrcFrame;
currentDrcFrame = currentTvFrame;
currentTvFrame = tmpElement;
appendTv(currentTvFrame);
appendDrc(currentDrcFrame);
//! re-append on top
append(mainSwitchButtonFrame);
currentTvFrame->resetState();
currentTvFrame->setEffect(EFFECT_FADE, 15, 255);
currentDrcFrame->resetState();
currentDrcFrame->setEffect(EFFECT_FADE, 15, 255);
mainSwitchButtonFrame->clearState(GuiElement::STATE_DISABLED);
//! reconnect only to DRC game selection change
currentTvFrame->gameSelectionChanged.disconnect(this);
currentDrcFrame->gameSelectionChanged.disconnect(this);
currentTvFrame->gameLaunchClicked.disconnect(this);
currentDrcFrame->gameLaunchClicked.disconnect(this);
currentTvFrame->gameSelectionChanged.connect(this, &MainWindow::OnGameSelectionChange);
currentTvFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch);
currentDrcFrame->gameSelectionChanged.connect(this, &MainWindow::OnGameSelectionChange);
currentDrcFrame->gameLaunchClicked.connect(this, &MainWindow::OnGameLaunch);
}
void MainWindow::OnOpenEffectFinish(GuiElement *element) { void MainWindow::OnOpenEffectFinish(GuiElement *element) {
//! once the menu is open reset its state and allow it to be "clicked/hold" //! once the menu is open reset its state and allow it to be "clicked/hold"
element->effectFinished.disconnect(this); element->effectFinished.disconnect(this);
@ -227,6 +288,10 @@ void MainWindow::OnCloseEffectFinish(GuiElement *element) {
AsyncExecutor::pushForDelete(element); AsyncExecutor::pushForDelete(element);
} }
void MainWindow::OnSettingsButtonClicked(GuiElement *element){
}
void MainWindow::OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx) { void MainWindow::OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx) {
if(!currentDrcFrame || !currentTvFrame) if(!currentDrcFrame || !currentTvFrame)
return; return;

View File

@ -119,6 +119,10 @@ private:
void OnGameLaunch(GuiTitleBrowser *element, int32_t gameIdx); void OnGameLaunch(GuiTitleBrowser *element, int32_t gameIdx);
void OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx); void OnGameSelectionChange(GuiTitleBrowser *element, int32_t selectedIdx);
void OnSettingsButtonClicked(GuiElement *element);
void OnLayoutSwitchClicked(GuiElement *element);
void OnLayoutSwitchEffectFinish(GuiElement *element);
int32_t width, height; int32_t width, height;
std::vector<GuiElement *> drcElements; std::vector<GuiElement *> drcElements;
std::vector<GuiElement *> tvElements; std::vector<GuiElement *> tvElements;