Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint().
authordag10
Wed, 23 Jan 2013 16:35:26 -0500
changeset 8430 5a5c34a75e1a
parent 8429 f814a7c2a318
child 8431 74c2c95ab07b
child 8432 f2d57e987ba9
Aesthetic improvements to chat widget. Also fixed the ghosting issue in a few areas by using repaint(). Restored "random" button next to "seed" button in mapcontainer widget when in hand-drawn mode.
QTfrontend/ui/page/pagenetgame.cpp
QTfrontend/ui/widget/chatwidget.cpp
QTfrontend/ui/widget/chatwidget.h
QTfrontend/ui/widget/gamecfgwidget.cpp
QTfrontend/ui/widget/mapContainer.cpp
QTfrontend/ui/widget/teamselect.cpp
QTfrontend/ui/widget/teamselect.h
--- a/QTfrontend/ui/page/pagenetgame.cpp	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/page/pagenetgame.cpp	Wed Jan 23 16:35:26 2013 -0500
@@ -104,7 +104,7 @@
     chatWidget = new HWChatWidget(this, true);
     chatWidget->setShowFollow(false); // don't show follow in nicks' context menus
     chatWidget->setIgnoreListKick(true); // kick ignored players automatically
-    chatWidget->setMinimumHeight(350);
+    chatWidget->setMinimumHeight(50);
     chatWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
     pageLayout->addWidget(chatWidget, 2, 0, 1, 2);
 
--- a/QTfrontend/ui/widget/chatwidget.cpp	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Wed Jan 23 16:35:26 2013 -0500
@@ -197,29 +197,44 @@
 
     m_hilightSound = "/Sounds/beep.ogg";
 
-    mainLayout.setSpacing(1);
-    mainLayout.setMargin(1);
-    mainLayout.setSizeConstraint(QLayout::SetMinimumSize);
-    mainLayout.setColumnStretch(0, 76);
-    mainLayout.setColumnStretch(1, 24);
+    mainLayout.setMargin(0);
 
-    chatEditLine = new SmartLineEdit(this);
-    chatEditLine->setMaxLength(300);
-    connect(chatEditLine, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
+    QWidget * leftSideContainer = new QWidget();
+    leftSideContainer->setObjectName("leftSideContainer");
+    leftSideContainer->setStyleSheet("#leftSideContainer { border-width: 0px; background-color: #ffcc00; border-radius: 10px;} QTextBrowser, SmartLineEdit { background-color: rgb(13, 5, 68); }");
+    QVBoxLayout * leftSide = new QVBoxLayout(leftSideContainer);
+    leftSide->setSpacing(3);
+    leftSide->setMargin(3);
+    mainLayout.addWidget(leftSideContainer, 76);
 
-    mainLayout.addWidget(chatEditLine, 2, 0);
+    // Chat view
 
     chatText = new QTextBrowser(this);
-
     chatText->document()->setDefaultStyleSheet(styleSheet());
-
     chatText->setMinimumHeight(20);
     chatText->setMinimumWidth(10);
     chatText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     chatText->setOpenLinks(false);
+    chatText->setStyleSheet("QTextBrowser { background-color: rgb(23, 11, 54); border-width: 0px; }");
     connect(chatText, SIGNAL(anchorClicked(const QUrl&)),
             this, SLOT(linkClicked(const QUrl&)));
-    mainLayout.addWidget(chatText, 0, 0, 2, 1);
+    leftSide->addWidget(chatText, 1);
+
+    // Input box
+
+    // Normal:  rgb(23, 11, 54)
+    // Hover:   rgb(13, 5, 68)
+
+    chatEditLine = new SmartLineEdit();
+    chatEditLine->setMaxLength(300);
+    chatEditLine->setStyleSheet("SmartLineEdit { background-color: rgb(23, 11, 54); padding: 2px 8px; border-width: 0px; border-radius: 7px; } SmartLineEdit:hover, SmartLineEdit:focus { background-color: rgb(13, 5, 68); }");
+    chatEditLine->setFixedHeight(24);
+    chatEditLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+    connect(chatEditLine, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
+
+    leftSide->addWidget(chatEditLine, 0);
+
+    // Nickname list
 
     chatNicks = new QListView(this);
     chatNicks->setIconSize(QSize(24, 16));
@@ -235,7 +250,8 @@
 
     connect(chatNicks, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(nicksContextMenuRequested(QPoint)));
 
-    mainLayout.addWidget(chatNicks, 0, 1, 3, 1);
+    mainLayout.addSpacing(0);
+    mainLayout.addWidget(chatNicks, 24);
 
     // the userData is used to flag things that are even available when user
     // is offline
--- a/QTfrontend/ui/widget/chatwidget.h	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/chatwidget.h	Wed Jan 23 16:35:26 2013 -0500
@@ -104,7 +104,7 @@
 
     private:
         bool m_isAdmin;
-        QGridLayout mainLayout;
+        QHBoxLayout mainLayout;
         QTextBrowser* chatText;
         QStringList chatStrings;
         QListView* chatNicks;
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Wed Jan 23 16:35:26 2013 -0500
@@ -24,6 +24,7 @@
 #include <QLabel>
 #include <QMessageBox>
 #include <QTableView>
+#include <QScrollBar>
 #include <QTabWidget>
 #include <QPushButton>
 #include <QDebug>
@@ -192,6 +193,17 @@
         setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
         this->tabbed = false;
     }
+
+    // Restore scrollbar palettes, since Qt seems to forget them easily when switching parents
+    QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
+    QPalette pal = palette();
+    pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00));
+    pal.setColor(QPalette::Button, QColor(0x00, 0x35, 0x1d));
+    pal.setColor(QPalette::Base, QColor(0x00, 0x35, 0x1d));
+    pal.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
+
+    for (int i = 0; i < allSBars.size(); ++i)
+        allSBars.at(i)->setPalette(pal);
 }
 
 void GameCFGWidget::jumpToSchemes()
--- a/QTfrontend/ui/widget/mapContainer.cpp	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Wed Jan 23 16:35:26 2013 -0500
@@ -630,7 +630,6 @@
     intSetMap(map);
 }
 
-
 void HWMapContainer::updateModelViews()
 {
     // restore theme selection
@@ -673,7 +672,6 @@
     lblDesc->hide();
     btnLoadMap->hide();
     btnEditMap->hide();
-    btnRandomize->hide();
 
     switch (type)
     {
@@ -683,7 +681,6 @@
             lblMapList->setText(tr("Map size:"));
             lblMapList->show();
             generationStyles->show();
-            btnRandomize->show();
             break;
         case MapModel::GeneratedMaze:
             mapgen = MAPGEN_MAZE;
@@ -691,7 +688,6 @@
             lblMapList->setText(tr("Maze style:"));
             lblMapList->show();
             mazeStyles->show();
-            btnRandomize->show();
             break;
         case MapModel::HandDrawnMap:
             mapgen = MAPGEN_DRAWN;
@@ -707,7 +703,6 @@
             missionMapList->show();
             lblDesc->setText(m_mapInfo.desc);
             lblDesc->show();
-            btnRandomize->show();
             emit mapChanged(m_curMap);
             break;
         case MapModel::StaticMap:
@@ -716,7 +711,6 @@
             lblMapList->setText(tr("Map:"));
             lblMapList->show();
             staticMapList->show();
-            btnRandomize->show();
             emit mapChanged(m_curMap);
             break;
         default:
@@ -749,9 +743,11 @@
     else
     {
         QSize iconSize = btnTheme->icon().actualSize(QSize(65535, 65535));
+        btnTheme->setFixedHeight(64);
         btnTheme->setIconSize(iconSize);
-        btnTheme->setFixedHeight(64);
     }
+
+    repaint();
 }
 
 void HWMapContainer::showThemePrompt()
--- a/QTfrontend/ui/widget/teamselect.cpp	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/teamselect.cpp	Wed Jan 23 16:35:26 2013 -0500
@@ -237,6 +237,8 @@
         pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height());
     }
 
+    repaint();
+
     emit setEnabledGameStart(curPlayingTeams.size()>1);
 }
 
@@ -297,7 +299,9 @@
     m_curNotPlayingTeams.clear();
 
     foreach(HWTeam team, teamslist)
-    addTeam(team);
+        addTeam(team);
+
+    repaint();
 }
 
 bool TeamSelWidget::isPlaying(const HWTeam &team) const
@@ -320,3 +324,10 @@
     //team.setColor(framePlaying->getNextColor());
     emit acceptRequested(team);
 }
+
+void TeamSelWidget::repaint()
+{
+    QWidget::repaint();
+    framePlaying->repaint();
+    frameDontPlaying->repaint();
+}
\ No newline at end of file
--- a/QTfrontend/ui/widget/teamselect.h	Wed Jan 23 23:57:47 2013 +0400
+++ b/QTfrontend/ui/widget/teamselect.h	Wed Jan 23 16:35:26 2013 -0500
@@ -77,6 +77,7 @@
         QVBoxLayout mainLayout;
         QLabel *numTeamNotice;
         bool m_acceptOuter;
+        void repaint();
 
         QList<HWTeam> curPlayingTeams;
         QList<HWTeam> m_curNotPlayingTeams;