QTfrontend/ui/page/pagemain.cpp
branchwebgl
changeset 8330 aaefa587e277
parent 8318 e2c01fbf36c0
child 8444 75db7bb8dce8
--- a/QTfrontend/ui/page/pagemain.cpp	Sun Dec 02 00:03:16 2012 +0100
+++ b/QTfrontend/ui/page/pagemain.cpp	Tue Dec 25 04:45:22 2012 +0100
@@ -46,10 +46,35 @@
     BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer"));
     pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
 
+    //BtnNet = addButton(":/res/NetworkPlay.png", (QBoxLayout*)netLayout, 1, true);
     BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true);
     BtnNet->setToolTip(tr("Network Game"));
     BtnNet->setWhatsThis(tr("Play a game across a network"));
     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
+    connect(BtnNet, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice()));
+
+    originalNetworkIcon = BtnNet->icon();
+    disabledNetworkIcon = QIcon(":/res/NetworkPlayDisabled.png");
+
+    //QWidget *netLayoutWidget = new QWidget();
+    QVBoxLayout *netLayout = new QVBoxLayout(BtnNet);
+    //pageLayout->addWidget(netLayoutWidget, 2, 2, 1, 2);
+    //netLayoutWidget->setStyleSheet("background: green;");
+    //netLayoutWidget->setFixedSize(314, 260);
+    netLayout->setSpacing(20);
+    netLayout->setAlignment(Qt::AlignHCenter);
+
+    BtnNetLocal = addButton("Play local network game", (QBoxLayout*)netLayout, 0, false);
+    BtnNetLocal->setToolTip(tr("Play a local network game"));
+    BtnNetLocal->setWhatsThis(tr("Play a game across a local area network"));
+    BtnNetLocal->setFixedSize(BtnNet->width() - 50, 60);
+    BtnNetLocal->setVisible(false);
+
+    BtnNetOfficial = addButton("Play official network game", (QBoxLayout*)netLayout, 0, false);
+    BtnNetOfficial->setToolTip(tr("Play a network game"));
+    BtnNetOfficial->setWhatsThis(tr("Play a game on an official server"));
+    BtnNetOfficial->setFixedSize(BtnNet->width() - 50, 60);
+    BtnNetOfficial->setVisible(false);
 
     // button order matters for overlapping (what's on top and what isn't)
     BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true);
@@ -59,10 +84,12 @@
     pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter);
 
     BtnFeedback = addButton("Feedback", pageLayout, 4, 0, 1, 4, false);
+    BtnFeedback->setFixedSize(86, 27);
     BtnFeedback->setWhatsThis(tr("Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars"));
     pageLayout->setAlignment(BtnFeedback, Qt::AlignHCenter);
 
     BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 5, 0, 1, 4, false);
+    BtnDataDownload->setFixedSize(176, 27);
     //BtnDataDownload->setToolTip(tr(Downloadable Content"));
     BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website"));
     pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter);
@@ -115,7 +142,7 @@
     }
     else
     {
-        setDefautDescription(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
+        setDefautDescription(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete!"));
     }
 
 }
@@ -182,3 +209,12 @@
 
     return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
 }
+
+void PageMain::toggleNetworkChoice()
+{
+    bool visible = BtnNetLocal->isVisible();
+    BtnNetLocal->setVisible(!visible);
+    BtnNetOfficial->setVisible(!visible);
+    if (visible)    BtnNet->setIcon(originalNetworkIcon);
+    else            BtnNet->setIcon(disabledNetworkIcon);
+}