16551需求:平板最大化适配改造

This commit is contained in:
赵民勇 2022-10-13 11:06:50 +08:00
parent 8b7c2aabbf
commit 1cf5dbd89f
4 changed files with 45 additions and 25 deletions

View File

@ -239,12 +239,12 @@ void MainDialog::initConnect()
QDBusReply<bool> is_tabletmode = m_statusSessionDbus->call("get_current_tabletmode"); QDBusReply<bool> is_tabletmode = m_statusSessionDbus->call("get_current_tabletmode");
GlobelBackupInfo::inst().setIsTabletMode(is_tabletmode); GlobelBackupInfo::inst().setIsTabletMode(is_tabletmode);
if (is_tabletmode) { if (is_tabletmode) {
if (!isMinimized()) if (!isMinimized())
showMaximized(); showMaximized();
m_maxBtn->setIcon(QIcon::fromTheme("window-restore-symbolic"));
m_maxBtn->setToolTip(tr("Normal"));
m_maxBtn->setVisible(false); m_maxBtn->setVisible(false);
} else { } else {
if (!isMinimized())
showNormal();
m_maxBtn->setVisible(true); m_maxBtn->setVisible(true);
} }
connect(m_statusSessionDbus, SIGNAL(mode_change_signal(bool)), this, SLOT(tabletModeChange(bool))); connect(m_statusSessionDbus, SIGNAL(mode_change_signal(bool)), this, SLOT(tabletModeChange(bool)));
@ -274,6 +274,23 @@ void MainDialog::tabletModeChange(bool isTabletMode)
} }
} }
void MainDialog::changeEvent(QEvent *event)
{
if (QEvent::WindowStateChange == event->type()) {
// 如果是平板模式
if (GlobelBackupInfo::inst().isTabletMode()) {
Qt::WindowStates state = this->windowState();
if (state == Qt::WindowMaximized) {
event->accept();
showMaximized();
return ;
}
}
}
QMainWindow::changeEvent(event);
}
/** /**
* @brief * @brief
* @param func_type * @param func_type

View File

@ -27,6 +27,7 @@ public:
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void changeEvent(QEvent *event);
public slots: public slots:
void sltMessageReceived(const QString &msg); void sltMessageReceived(const QString &msg);

View File

@ -1083,7 +1083,7 @@
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="130"/> <location filename="maindialog.cpp" line="130"/>
<location filename="maindialog.cpp" line="224"/> <location filename="maindialog.cpp" line="220"/>
<source>Maximize</source> <source>Maximize</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1108,7 +1108,8 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="220"/> <location filename="maindialog.cpp" line="224"/>
<location filename="maindialog.cpp" line="245"/>
<source>Normal</source> <source>Normal</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1251,9 +1252,9 @@
<location filename="component/backuplistwidget.cpp" line="297"/> <location filename="component/backuplistwidget.cpp" line="297"/>
<location filename="component/backuplistwidget.cpp" line="306"/> <location filename="component/backuplistwidget.cpp" line="306"/>
<location filename="component/backuplistwidget.cpp" line="329"/> <location filename="component/backuplistwidget.cpp" line="329"/>
<location filename="maindialog.cpp" line="348"/> <location filename="maindialog.cpp" line="369"/>
<location filename="maindialog.cpp" line="364"/> <location filename="maindialog.cpp" line="385"/>
<location filename="maindialog.cpp" line="384"/> <location filename="maindialog.cpp" line="405"/>
<location filename="module/databackup.cpp" line="545"/> <location filename="module/databackup.cpp" line="545"/>
<location filename="module/databackup.cpp" line="563"/> <location filename="module/databackup.cpp" line="563"/>
<location filename="module/databackup.cpp" line="790"/> <location filename="module/databackup.cpp" line="790"/>
@ -1283,9 +1284,9 @@
<location filename="component/backuplistwidget.cpp" line="308"/> <location filename="component/backuplistwidget.cpp" line="308"/>
<location filename="component/backuplistwidget.cpp" line="331"/> <location filename="component/backuplistwidget.cpp" line="331"/>
<location filename="main.cpp" line="45"/> <location filename="main.cpp" line="45"/>
<location filename="maindialog.cpp" line="350"/> <location filename="maindialog.cpp" line="371"/>
<location filename="maindialog.cpp" line="366"/> <location filename="maindialog.cpp" line="387"/>
<location filename="maindialog.cpp" line="386"/> <location filename="maindialog.cpp" line="407"/>
<location filename="module/databackup.cpp" line="488"/> <location filename="module/databackup.cpp" line="488"/>
<location filename="module/databackup.cpp" line="504"/> <location filename="module/databackup.cpp" line="504"/>
<location filename="module/databackup.cpp" line="512"/> <location filename="module/databackup.cpp" line="512"/>
@ -1350,7 +1351,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="349"/> <location filename="maindialog.cpp" line="370"/>
<source>An exception occurred when mounting backup partition.</source> <source>An exception occurred when mounting backup partition.</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1359,12 +1360,12 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="365"/> <location filename="maindialog.cpp" line="386"/>
<source>Failed to mount backup partition.</source> <source>Failed to mount backup partition.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="385"/> <location filename="maindialog.cpp" line="406"/>
<location filename="module/datarestore.cpp" line="1088"/> <location filename="module/datarestore.cpp" line="1088"/>
<source>It&apos;s busy, please wait</source> <source>It&apos;s busy, please wait</source>
<translation></translation> <translation></translation>

View File

@ -1083,7 +1083,7 @@
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="130"/> <location filename="maindialog.cpp" line="130"/>
<location filename="maindialog.cpp" line="224"/> <location filename="maindialog.cpp" line="220"/>
<source>Maximize</source> <source>Maximize</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1108,7 +1108,8 @@
<translation>退</translation> <translation>退</translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="220"/> <location filename="maindialog.cpp" line="224"/>
<location filename="maindialog.cpp" line="245"/>
<source>Normal</source> <source>Normal</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1251,9 +1252,9 @@
<location filename="component/backuplistwidget.cpp" line="297"/> <location filename="component/backuplistwidget.cpp" line="297"/>
<location filename="component/backuplistwidget.cpp" line="306"/> <location filename="component/backuplistwidget.cpp" line="306"/>
<location filename="component/backuplistwidget.cpp" line="329"/> <location filename="component/backuplistwidget.cpp" line="329"/>
<location filename="maindialog.cpp" line="348"/> <location filename="maindialog.cpp" line="369"/>
<location filename="maindialog.cpp" line="364"/> <location filename="maindialog.cpp" line="385"/>
<location filename="maindialog.cpp" line="384"/> <location filename="maindialog.cpp" line="405"/>
<location filename="module/databackup.cpp" line="545"/> <location filename="module/databackup.cpp" line="545"/>
<location filename="module/databackup.cpp" line="563"/> <location filename="module/databackup.cpp" line="563"/>
<location filename="module/databackup.cpp" line="790"/> <location filename="module/databackup.cpp" line="790"/>
@ -1274,9 +1275,9 @@
<location filename="component/backuplistwidget.cpp" line="308"/> <location filename="component/backuplistwidget.cpp" line="308"/>
<location filename="component/backuplistwidget.cpp" line="331"/> <location filename="component/backuplistwidget.cpp" line="331"/>
<location filename="main.cpp" line="45"/> <location filename="main.cpp" line="45"/>
<location filename="maindialog.cpp" line="350"/> <location filename="maindialog.cpp" line="371"/>
<location filename="maindialog.cpp" line="366"/> <location filename="maindialog.cpp" line="387"/>
<location filename="maindialog.cpp" line="386"/> <location filename="maindialog.cpp" line="407"/>
<location filename="module/databackup.cpp" line="488"/> <location filename="module/databackup.cpp" line="488"/>
<location filename="module/databackup.cpp" line="504"/> <location filename="module/databackup.cpp" line="504"/>
<location filename="module/databackup.cpp" line="512"/> <location filename="module/databackup.cpp" line="512"/>
@ -1346,7 +1347,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="349"/> <location filename="maindialog.cpp" line="370"/>
<source>An exception occurred when mounting backup partition.</source> <source>An exception occurred when mounting backup partition.</source>
<translation></translation> <translation></translation>
</message> </message>
@ -1355,12 +1356,12 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="365"/> <location filename="maindialog.cpp" line="386"/>
<source>Failed to mount backup partition.</source> <source>Failed to mount backup partition.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="maindialog.cpp" line="385"/> <location filename="maindialog.cpp" line="406"/>
<location filename="module/datarestore.cpp" line="1088"/> <location filename="module/datarestore.cpp" line="1088"/>
<source>It&apos;s busy, please wait</source> <source>It&apos;s busy, please wait</source>
<translation></translation> <translation></translation>