mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
confirmshutdowndlg.ui cleanup
shutdownconfirm.cpp cleanup
This commit is contained in:
parent
18ee87f586
commit
5c5b007618
2 changed files with 76 additions and 95 deletions
|
@ -6,105 +6,86 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>463</width>
|
<width>407</width>
|
||||||
<height>128</height>
|
<height>103</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>15</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="spacing">
|
<item row="0" column="0" rowspan="2">
|
||||||
<number>20</number>
|
<widget class="QLabel" name="warningLabel">
|
||||||
</property>
|
<property name="text">
|
||||||
<item>
|
<string notr="true">warning icon</string>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="alignment">
|
||||||
<widget class="QLabel" name="warningLabel">
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
</widget>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">warning icon goes here</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="topMargin">
|
<property name="orientation">
|
||||||
<number>6</number>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="sizeType">
|
||||||
<widget class="QLabel" name="shutdownText">
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<property name="sizeHint" stdset="0">
|
||||||
<horstretch>0</horstretch>
|
<size>
|
||||||
<verstretch>0</verstretch>
|
<width>20</width>
|
||||||
</sizepolicy>
|
<height>0</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="text">
|
</property>
|
||||||
<string notr="true">shutdown message goes here</string>
|
</spacer>
|
||||||
</property>
|
</item>
|
||||||
<property name="alignment">
|
<item row="0" column="2">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
<widget class="QLabel" name="shutdownText">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="wordWrap">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<bool>true</bool>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
</widget>
|
</sizepolicy>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QCheckBox" name="neverShowAgainCheckbox">
|
<string notr="true">shutdown message goes here</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Don't show again</string>
|
<property name="wordWrap">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<spacer name="verticalSpacer_2">
|
<item row="1" column="2">
|
||||||
<property name="orientation">
|
<widget class="QCheckBox" name="neverShowAgainCheckbox">
|
||||||
<enum>Qt::Vertical</enum>
|
<property name="text">
|
||||||
</property>
|
<string>Don't show again</string>
|
||||||
<property name="sizeHint" stdset="0">
|
</property>
|
||||||
<size>
|
</widget>
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox"/>
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -52,30 +52,30 @@ ShutdownConfirmDlg::ShutdownConfirmDlg(const ShutdownAction &action)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QIcon warningIcon(style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, this));
|
QIcon warningIcon(style()->standardIcon(QStyle::SP_MessageBoxWarning));
|
||||||
ui->warningLabel->setPixmap(warningIcon.pixmap(warningIcon.actualSize(QSize(32, 32))));
|
ui->warningLabel->setPixmap(warningIcon.pixmap(32));
|
||||||
updateText();
|
updateText();
|
||||||
// Never show again checkbox, Title, and button
|
// Never show again checkbox, Title, and button
|
||||||
|
QPushButton *okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
if (m_action == ShutdownAction::None) {
|
if (m_action == ShutdownAction::None) {
|
||||||
setWindowTitle(tr("Exit confirmation"));
|
setWindowTitle(tr("Exit confirmation"));
|
||||||
ui->buttonBox->addButton(new QPushButton(tr("Exit Now"), this), QDialogButtonBox::AcceptRole);
|
okButton->setText(tr("E&xit Now"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setWindowTitle(tr("Shutdown confirmation"));
|
setWindowTitle(tr("Shutdown confirmation"));
|
||||||
ui->buttonBox->addButton(new QPushButton(tr("Shutdown Now"), this), QDialogButtonBox::AcceptRole);
|
okButton->setText(tr("&Shutdown Now"));
|
||||||
ui->neverShowAgainCheckbox->setVisible(false);
|
ui->neverShowAgainCheckbox->setVisible(false);
|
||||||
}
|
}
|
||||||
// Cancel Button
|
// Cancel Button
|
||||||
QPushButton *cancelButton = ui->buttonBox->addButton(QDialogButtonBox::Cancel);
|
QPushButton *cancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
cancelButton->setFocus();
|
||||||
cancelButton->setDefault(true);
|
cancelButton->setDefault(true);
|
||||||
// Always on top
|
// Always on top
|
||||||
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
|
||||||
// Set 'Cancel' as default button.
|
|
||||||
m_timer.setInterval(1000); // 1sec
|
m_timer.setInterval(1000); // 1sec
|
||||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateSeconds()));
|
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateSeconds()));
|
||||||
// Move to center
|
// Move to center
|
||||||
move(Utils::Misc::screenCenter(this));
|
move(Utils::Misc::screenCenter(this));
|
||||||
cancelButton->setFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownConfirmDlg::showEvent(QShowEvent *event)
|
void ShutdownConfirmDlg::showEvent(QShowEvent *event)
|
||||||
|
|
Loading…
Reference in a new issue