23 |
23 |
24 #include "AbstractPage.h" |
24 #include "AbstractPage.h" |
25 #include <QLabel> |
25 #include <QLabel> |
26 #include <QSize> |
26 #include <QSize> |
27 #include <QFontMetricsF> |
27 #include <QFontMetricsF> |
28 #include <qpushbuttonwithsound.h> |
28 |
29 #include <QMessageBox> |
29 #include "qpushbuttonwithsound.h" |
30 |
30 |
31 AbstractPage::AbstractPage(QWidget* parent) |
31 AbstractPage::AbstractPage(QWidget* parent) |
32 { |
32 { |
33 Q_UNUSED(parent); |
33 Q_UNUSED(parent); |
34 defautDesc = new QString(); |
34 defautDesc = new QString(); |
91 btn->setFont(*font14); |
91 btn->setFont(*font14); |
92 btn->setText(name); |
92 btn->setText(name); |
93 } |
93 } |
94 return btn; |
94 return btn; |
95 } |
95 } |
|
96 QPushButton* AbstractPage::formattedSoundlessButton(const QString & name, bool hasIcon) |
|
97 { |
|
98 QPushButton* btn = new QPushButton(this); |
|
99 |
|
100 if (hasIcon) |
|
101 { |
|
102 const QIcon& lp=QIcon(name); |
|
103 QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
104 btn->setIcon(lp); |
|
105 btn->setFixedSize(sz); |
|
106 btn->setIconSize(sz); |
|
107 btn->setFlat(true); |
|
108 btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
109 } |
|
110 else |
|
111 { |
|
112 btn->setFont(*font14); |
|
113 btn->setText(name); |
|
114 } |
|
115 return btn; |
|
116 } |
96 |
117 |
97 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon) |
118 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon) |
98 { |
119 { |
99 QPushButtonWithSound * btn = formattedButton(name, hasIcon); |
120 QPushButtonWithSound * btn = formattedButton(name, hasIcon); |
100 grid->addWidget(btn, row, column, rowSpan, columnSpan); |
121 grid->addWidget(btn, row, column, rowSpan, columnSpan); |
102 } |
123 } |
103 |
124 |
104 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon) |
125 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon) |
105 { |
126 { |
106 QPushButtonWithSound * btn = formattedButton(name, hasIcon); |
127 QPushButtonWithSound * btn = formattedButton(name, hasIcon); |
|
128 box->addWidget(btn, where); |
|
129 return btn; |
|
130 } |
|
131 |
|
132 QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon) |
|
133 { |
|
134 QPushButton* btn = formattedSoundlessButton(name, hasIcon); |
107 box->addWidget(btn, where); |
135 box->addWidget(btn, where); |
108 return btn; |
136 return btn; |
109 } |
137 } |
110 |
138 |
111 void AbstractPage::setBackButtonVisible(bool visible) |
139 void AbstractPage::setBackButtonVisible(bool visible) |