--- a/QTfrontend/ui/page/pageroomslist.cpp Thu May 03 00:20:58 2012 -0400
+++ b/QTfrontend/ui/page/pageroomslist.cpp Thu May 03 00:21:17 2012 -0400
@@ -152,12 +152,6 @@
connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onFilterChanged()));
connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
- // save header state on change
- connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
- this, SLOT(saveHeaderState()));
- connect(roomsList->horizontalHeader(), SIGNAL(sectionResized),
- this, SLOT(saveHeaderState()));
-
// sorting
connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
this, SLOT(onSortIndicatorChanged(int, Qt::SortOrder)));
@@ -538,6 +532,10 @@
QHeaderView * h = roomsList->horizontalHeader();
+ h->setSortIndicatorShown(true);
+ h->setSortIndicator(RoomsListModel::StateColumn, Qt::AscendingOrder);
+ h->setResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
+
if (!restoreHeaderState())
{
h->resizeSection(RoomsListModel::PlayerCountColumn, 32);
@@ -548,8 +546,12 @@
h->resizeSection(RoomsListModel::WeaponsColumn, 100);
}
- h->setSortIndicatorShown(true);
- h->setResizeMode(RoomsListModel::NameColumn, QHeaderView::Stretch);
+
+ // save header state on change
+ connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
+ this, SLOT(saveHeaderState()));
+ connect(roomsList->horizontalHeader(), SIGNAL(sectionResized(int, int, int)),
+ this, SLOT(saveHeaderState()));
}
@@ -558,6 +560,12 @@
if (roomsModel == NULL)
return;
+ if (logicalIndex == 0)
+ {
+ roomsModel->sort(0, Qt::AscendingOrder);
+ return;
+ }
+
// three state sorting: asc -> dsc -> default (by room state)
if ((order == Qt::AscendingOrder) && (logicalIndex == roomsModel->sortColumn()))
roomsList->horizontalHeader()->setSortIndicator(
@@ -600,12 +608,12 @@
{
if (!m_gameSettings->contains("frontend/roomslist_header"))
return false;
- return roomsList->horizontalHeader()->restoreState(QByteArray::fromHex(
- (m_gameSettings->value("frontend/roomslist_header").toByteArray())));
+ return roomsList->horizontalHeader()->restoreState(QByteArray::fromBase64(
+ (m_gameSettings->value("frontend/roomslist_header").toString().toAscii())));
}
void PageRoomsList::saveHeaderState()
{
m_gameSettings->setValue("frontend/roomslist_header",
- roomsList->horizontalHeader()->saveState().toHex());
+ QString(roomsList->horizontalHeader()->saveState().toBase64()));
}
--- a/QTfrontend/ui/widget/frameTeam.cpp Thu May 03 00:20:58 2012 -0400
+++ b/QTfrontend/ui/widget/frameTeam.cpp Thu May 03 00:21:17 2012 -0400
@@ -41,6 +41,7 @@
availableColors.push_back(QColor(colors[i++]));
resetColors();
+ this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
}
void FrameTeams::setInteractivity(bool interactive)
@@ -89,6 +90,8 @@
mainLayout.removeWidget(it.value());
it.value()->deleteLater();
teamToWidget.erase(it);
+ QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
+ QCoreApplication::postEvent(parentWidget(), pevent);
}
void FrameTeams::resetTeams()
@@ -99,6 +102,8 @@
it.value()->deleteLater();
teamToWidget.erase(it++);
}
+ QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
+ QCoreApplication::postEvent(parentWidget(), pevent);
}
void FrameTeams::setHHNum(const HWTeam& team)
@@ -132,3 +137,8 @@
{
emit teamColorChanged(team);
}
+
+QSize FrameTeams::sizeHint() const
+{
+ return QSize(-1, teamToWidget.size() * 39 + 9);
+}
--- a/QTfrontend/ui/widget/frameTeam.h Thu May 03 00:20:58 2012 -0400
+++ b/QTfrontend/ui/widget/frameTeam.h Thu May 03 00:21:17 2012 -0400
@@ -43,6 +43,7 @@
void setTeamColor(const HWTeam& team);
void setInteractivity(bool interactive);
QColor getNextColor() const;
+ QSize sizeHint() const;
signals:
void teamColorChanged(const HWTeam&);
--- a/QTfrontend/ui/widget/mapContainer.cpp Thu May 03 00:20:58 2012 -0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp Thu May 03 00:21:17 2012 -0400
@@ -297,6 +297,7 @@
pMap = new HWMap();
connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
+ connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));
pMap->getImage(m_seed,
getTemplateFilter(),
get_mapgen(),
@@ -602,3 +603,10 @@
}
}
+
+
+void HWMapContainer::onPreviewMapDestroyed(QObject * map)
+{
+ if (map == pMap)
+ pMap = 0;
+}
--- a/QTfrontend/ui/widget/mapContainer.h Thu May 03 00:20:58 2012 -0400
+++ b/QTfrontend/ui/widget/mapContainer.h Thu May 03 00:21:17 2012 -0400
@@ -73,6 +73,7 @@
void setDrawnMapData(const QByteArray & ar);
void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
void updateModelViews();
+ void onPreviewMapDestroyed(QObject * map);
signals:
void seedChanged(const QString & seed);