# HG changeset patch
# User unc0rr
# Date 1222590378 0
# Node ID 4a0cbcbe3521d15ebe59c6d84d3444d53ea7b9f3
# Parent a02a5345b91e5a0481e4e55e7bdaba488427f61b
Move preview icons into comboboxes
diff -r a02a5345b91e -r 4a0cbcbe3521 QTfrontend/about.cpp
--- a/QTfrontend/about.cpp Tue Sep 23 06:27:53 2008 +0000
+++ b/QTfrontend/about.cpp Sun Sep 28 08:26:18 2008 +0000
@@ -85,7 +85,7 @@
"Slovak: Jose Riha
"
"Spanish: Carlos Vives <mail@carlosvives.es>
"
"Swedish: Niklas Grahn <raewolusjoon@yaoo.com>
"
- "Ukrainian: Eugene Lyubimkin <jackyf.devel@gmail.com>"
+ "Ukrainian: Eugene V. Lyubimkin <jackyf.devel@gmail.com>"
"
" diff -r a02a5345b91e -r 4a0cbcbe3521 QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Tue Sep 23 06:27:53 2008 +0000 +++ b/QTfrontend/pages.cpp Sun Sep 28 08:26:18 2008 +0000 @@ -150,10 +150,8 @@ QGridLayout * GBGLayout = new QGridLayout(GBoxGrave); CBGrave = new QComboBox(GBoxGrave); CBGrave->setMaxCount(65535); + CBGrave->setIconSize(QSize(32, 32)); GBGLayout->addWidget(CBGrave, 0, 0, 1, 3); - GravePreview = new QLabel(GBoxGrave); - GravePreview->setScaledContents(false); - GBGLayout->addWidget(GravePreview, 1, 1); vbox2->addWidget(GBoxGrave); //page1Layout->addWidget(new QWidget(), 3, 1, 1, 1); @@ -163,18 +161,15 @@ GBoxTeamLvl->setTitle(QGroupBox::tr("Team level")); QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl); CBTeamLvl = new QComboBox(GBoxTeamLvl); - CBTeamLvl->addItem(QComboBox::tr("Human")); - CBTeamLvl->addItem(QComboBox::tr("Level 5")); - CBTeamLvl->addItem(QComboBox::tr("Level 4")); - CBTeamLvl->addItem(QComboBox::tr("Level 3")); - CBTeamLvl->addItem(QComboBox::tr("Level 2")); - CBTeamLvl->addItem(QComboBox::tr("Level 1")); - CBTeamLvl->setMaxCount(6); + CBTeamLvl->setIconSize(QSize(32, 32)); + CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); + for(int i = 5; i > 0; i--) + CBTeamLvl->addItem( + QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), + QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) + ); + GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3); - LevelPict = new QLabel(GBoxTeamLvl); - LevelPict->setScaledContents(false); - LevelPict->setFixedSize(32, 32); - GBTLLayout->addWidget(LevelPict, 1, 1); vbox2->addWidget(GBoxTeamLvl); GBoxFort = new QGroupBox(this); @@ -194,18 +189,18 @@ tmpdir.cd("Forts"); tmpdir.setFilter(QDir::Files); + connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); + tmpdir.cd("../Graphics/Graves"); QStringList list = tmpdir.entryList(QStringList("*.png")); for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { - CBGrave->addItem((*it).replace(QRegExp("^(.*)\\.png"), "\\1")); + QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); + QIcon icon(pix.copy(0, 0, 32, 32)); + CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); } - connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); - connect(CBTeamLvl, SIGNAL(activated(int)), this, SLOT(CBTeamLvl_activated(int))); - connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); - vbox1->addStretch(); vbox2->addStretch(); // vbox3->addStretch(); @@ -252,25 +247,13 @@ } } -void PageEditTeam::CBGrave_activated(const QString & gravename) -{ - QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png"); - GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); -} - void PageEditTeam::CBFort_activated(const QString & fortname) { QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); FortPreview->setPixmap(pix); } -void PageEditTeam::CBTeamLvl_activated(int id) -{ - QPixmap pix(QString(":/res/botlevels/%1.png").arg(id)); - LevelPict->setPixmap(pix); -} - -PageMultiplayer::PageMultiplayer(QWidget* parent) : +PageMultiplayer::PageMultiplayer(QWidget* parent) : AbstractPage(parent) { QGridLayout * pageLayout = new QGridLayout(this); diff -r a02a5345b91e -r 4a0cbcbe3521 QTfrontend/pages.h --- a/QTfrontend/pages.h Tue Sep 23 06:27:53 2008 +0000 +++ b/QTfrontend/pages.h Sun Sep 28 08:26:18 2008 +0000 @@ -139,10 +139,8 @@ SquareLabel *FortPreview; QGroupBox *GBoxGrave; QComboBox *CBGrave; - QLabel *GravePreview; QGroupBox *GBoxTeamLvl; QComboBox *CBTeamLvl; - QLabel *LevelPict; QGroupBox *GBoxBinds; QToolBox *BindsBox; QWidget *page_A; @@ -157,9 +155,7 @@ QComboBox * CBBind[BINDS_NUMBER]; public slots: - void CBGrave_activated(const QString & gravename); void CBFort_activated(const QString & gravename); - void CBTeamLvl_activated(int id); private: QLabel * LBind[BINDS_NUMBER]; diff -r a02a5345b91e -r 4a0cbcbe3521 QTfrontend/team.cpp --- a/QTfrontend/team.cpp Tue Sep 23 06:27:53 2008 +0000 +++ b/QTfrontend/team.cpp Sun Sep 28 08:26:18 2008 +0000 @@ -194,17 +194,15 @@ { hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName); hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(difficulty); - hwform->ui.pageEditTeam->CBTeamLvl_activated(difficulty); for(int i = 0; i < 8; i++) { hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]); hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(HHHat[i], Qt::DisplayRole)); } hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave)); - hwform->ui.pageEditTeam->CBGrave_activated(Grave); hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort)); - hwform->ui.pageEditTeam->CBFort_activated(Fort); + //hwform->ui.pageEditTeam->CBFort_activated(Fort); for(int i = 0; i < BINDS_NUMBER; i++) {