A bit of refactoring
authorunc0rr
Thu, 29 Nov 2012 22:50:08 +0400
changeset 8140 a098374b847b
parent 8138 cfb228baa598
child 8142 b10219ef05d3
A bit of refactoring
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/ui/widget/teamselect.cpp
--- a/QTfrontend/hwform.cpp	Thu Nov 29 14:02:28 2012 +1300
+++ b/QTfrontend/hwform.cpp	Thu Nov 29 22:50:08 2012 +0400
@@ -439,23 +439,16 @@
     }
 }
 
-void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
+void HWForm::UpdateTeamsLists()
 {
-    QStringList teamslist;
-    if(editable_teams)
-    {
-        teamslist =* editable_teams;
-    }
-    else
-    {
-        teamslist = config->GetTeamsList();
-    }
+    QStringList teamslist = config->GetTeamsList();
 
     if(teamslist.empty())
     {
         QString currentNickName = gameSettings->value("net/nick","").toString().toUtf8();
         QString teamName;
-        if (currentNickName == "")
+
+        if (currentNickName.isEmpty())
         {
             teamName = tr("DefaultTeam");
         }
@@ -463,6 +456,7 @@
         {
             teamName = tr("%1's Team").arg(currentNickName);
         }
+
         HWTeam defaultTeam(teamName);
         defaultTeam.saveToFile();
         teamslist.push_back(teamName);
--- a/QTfrontend/hwform.h	Thu Nov 29 14:02:28 2012 +1300
+++ b/QTfrontend/hwform.h	Thu Nov 29 22:50:08 2012 +0400
@@ -146,7 +146,7 @@
 
     private:
         void _NetConnect(const QString & hostName, quint16 port, QString nick);
-        void UpdateTeamsLists(const QStringList* editable_teams=0);
+        void UpdateTeamsLists();
         void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo);
         void closeEvent(QCloseEvent *event);
         void CustomizePalettes();
--- a/QTfrontend/ui/widget/teamselect.cpp	Thu Nov 29 14:02:28 2012 +1300
+++ b/QTfrontend/ui/widget/teamselect.cpp	Thu Nov 29 22:50:08 2012 +0400
@@ -269,7 +269,7 @@
 
     // Add notice about number of required teams.
     numTeamNotice = new QLabel("Two teams are required to play!");
-    mainLayout.addWidget((QWidget*)numTeamNotice);
+    mainLayout.addWidget(numTeamNotice);
 
     QPalette p;
     p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));