add stacked widget

This commit is contained in:
marios8543 2025-04-20 19:44:41 +03:00
parent da5c247339
commit 25c3c5171c
2 changed files with 511 additions and 492 deletions

View File

@ -124,6 +124,8 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::TriggerAppStart); connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::TriggerAppStart);
connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::setRetryUSBConnect); connect(ui_->pushButtonAndroidAuto2, &QPushButton::clicked, this, &MainWindow::setRetryUSBConnect);
ui_->radioView->hide(); ui_->radioView->hide();
ui_->clockOnlyWidget->hide(); ui_->clockOnlyWidget->hide();
@ -440,20 +442,17 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
// clock viibility by settings // clock viibility by settings
if (!configuration->showClock()) { if (!configuration->showClock()) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();
ui_->bigClock->hide();
this->NoClock = true; this->NoClock = true;
} else { } else {
this->NoClock = false; this->NoClock = false;
if (this->UseBigClock) { if (this->UseBigClock) {
//ui_->oldmenuDummy->hide(); //ui_->oldmenuDummy->hide();
ui_->bigClock->show();
if (oldGUIStyle) { if (oldGUIStyle) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();
} }
} else { } else {
//ui_->oldmenuDummy->show(); //ui_->oldmenuDummy->show();
ui_->Digital_clock->show(); ui_->Digital_clock->show();
ui_->bigClock->hide();
} }
} }
@ -902,10 +901,8 @@ void f1x::openauto::autoapp::ui::MainWindow::toggleGUI()
if (!this->NoClock) { if (!this->NoClock) {
if (UseBigClock) { if (UseBigClock) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();
ui_->bigClock->show();
} else { } else {
ui_->Digital_clock->show(); ui_->Digital_clock->show();
ui_->bigClock->hide();
} }
} }
} else { } else {
@ -995,8 +992,6 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
this->date_text=date.toString("MM/dd"); this->date_text=date.toString("MM/dd");
ui_->Digital_clock->setText(time_text); ui_->Digital_clock->setText(time_text);
ui_->bigClock->setText(time_text);
ui_->bigClock2->setText(time_text);
if (!this->holidaybg) { if (!this->holidaybg) {
if (this->date_text == "12/24") { if (this->date_text == "12/24") {
@ -1023,7 +1018,7 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
ui_->btDevice->show(); ui_->btDevice->show();
} }
if (std::ifstream("/tmp/btnowplaying")) { if (std::ifstream("/tmp/btnowplaying")) {
ui_->btNowPlaying->show(); ui_->stackedWidget->setCurrentIndex(0);
using namespace std; using namespace std;
ifstream inFile; ifstream inFile;
string line; string line;
@ -1038,7 +1033,7 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
} }
} }
else { else {
ui_->btNowPlaying->hide(); ui_->stackedWidget->setCurrentIndex(1);
ui_->btSongName->setText(""); ui_->btSongName->setText("");
ui_->btArtistName->setText(""); ui_->btArtistName->setText("");
ui_->btAlbumName->setText(""); ui_->btAlbumName->setText("");
@ -1952,20 +1947,17 @@ void f1x::openauto::autoapp::ui::MainWindow::tmpChanged()
if (!this->configuration_->showClock()) { if (!this->configuration_->showClock()) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();
//ui_->oldmenuDummy->show(); //ui_->oldmenuDummy->show();
ui_->bigClock->hide();
this->NoClock = true; this->NoClock = true;
} else { } else {
this->NoClock = false; this->NoClock = false;
if (this->UseBigClock && ui_->oldmenuWidget->isVisible() == true) { if (this->UseBigClock && ui_->oldmenuWidget->isVisible() == true) {
//ui_->oldmenuDummy->hide(); //ui_->oldmenuDummy->hide();
ui_->bigClock->show();
if (oldGUIStyle) { if (oldGUIStyle) {
ui_->Digital_clock->hide(); ui_->Digital_clock->hide();
} }
} else { } else {
//ui_->oldmenuDummy->show(); //ui_->oldmenuDummy->show();
ui_->Digital_clock->show(); ui_->Digital_clock->show();
ui_->bigClock->hide();
} }
} }

View File

@ -2892,11 +2892,66 @@ outline: none;</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QStackedWidget" name="stackedWidget">
<property name="minimumSize">
<size>
<width>500</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>500</height>
</size>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page">
<widget class="QWidget" name="verticalWidget" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>500</width>
<height>80</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="btNowPlayingRadioDisplay">
<property name="font">
<font>
<pointsize>24</pointsize>
</font>
</property>
<property name="text">
<string>ABCD,EFGH</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="btNowPlaying" native="true"> <widget class="QWidget" name="btNowPlaying" native="true">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -2905,14 +2960,14 @@ outline: none;</string>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>800</width> <width>500</width>
<height>400</height> <height>500</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>800</width> <width>500</width>
<height>400</height> <height>500</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
@ -2953,7 +3008,7 @@ outline: none;</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="verticalWidget" native="true"> <widget class="QWidget" name="verticalWidget_3" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>500</width> <width>500</width>
@ -3069,7 +3124,7 @@ outline: none;</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="horizontalWidget" native="true"> <widget class="QWidget" name="horizontalWidget_3" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -3136,7 +3191,7 @@ outline: none;</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="horizontalWidget_2" native="true"> <widget class="QWidget" name="horizontalWidget_4" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -3207,9 +3262,17 @@ outline: none;</string>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </widget>
<item alignment="Qt::AlignLeft"> <widget class="QWidget" name="page_2">
<widget class="QWidget" name="radioView" native="true"> <widget class="QWidget" name="radioView" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>450</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -3219,13 +3282,13 @@ outline: none;</string>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>600</width> <width>600</width>
<height>210</height> <height>450</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>200</height> <height>450</height>
</size> </size>
</property> </property>
<property name="layoutDirection"> <property name="layoutDirection">
@ -3282,7 +3345,7 @@ outline: none;</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_25"> <layout class="QHBoxLayout" name="horizontalLayout_25">
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="radioDisplay">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -3306,7 +3369,7 @@ outline: none;</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="radioPreset">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
@ -3327,10 +3390,10 @@ outline: none;</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="radioSecondLine">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>50</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
@ -3355,43 +3418,7 @@ outline: none;</string>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </widget>
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="bigClock">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<pointsize>32</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>12:00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>