QTfrontend/ui/page/pagemain.cpp
changeset 8318 e2c01fbf36c0
parent 8277 cd2bae15a9a3
child 8330 aaefa587e277
child 8361 2831c1403666
equal deleted inserted replaced
8317:ec9f94ab2737 8318:e2c01fbf36c0
    44     BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true);
    44     BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true);
    45     BtnSinglePlayer->setToolTip(tr("Local Game"));
    45     BtnSinglePlayer->setToolTip(tr("Local Game"));
    46     BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer"));
    46     BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer"));
    47     pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
    47     pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
    48 
    48 
       
    49     //BtnNet = addButton(":/res/NetworkPlay.png", (QBoxLayout*)netLayout, 1, true);
    49     BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true);
    50     BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true);
    50     BtnNet->setToolTip(tr("Network Game"));
    51     BtnNet->setToolTip(tr("Network Game"));
    51     BtnNet->setWhatsThis(tr("Play a game across a network"));
    52     BtnNet->setWhatsThis(tr("Play a game across a network"));
    52     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
    53     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
       
    54     connect(BtnNet, SIGNAL(clicked()), this, SLOT(toggleNetworkChoice()));
       
    55     
       
    56     originalNetworkIcon = BtnNet->icon();
       
    57     disabledNetworkIcon = QIcon(":/res/NetworkPlayDisabled.png");
       
    58 
       
    59     //QWidget *netLayoutWidget = new QWidget();
       
    60     QVBoxLayout *netLayout = new QVBoxLayout(BtnNet);
       
    61     //pageLayout->addWidget(netLayoutWidget, 2, 2, 1, 2);
       
    62     //netLayoutWidget->setStyleSheet("background: green;");
       
    63     //netLayoutWidget->setFixedSize(314, 260);
       
    64     netLayout->setSpacing(20);
       
    65     netLayout->setAlignment(Qt::AlignHCenter);
       
    66 
       
    67     BtnNetLocal = addButton("Play local network game", (QBoxLayout*)netLayout, 0, false);
       
    68     BtnNetLocal->setToolTip(tr("Play a local network game"));
       
    69     BtnNetLocal->setWhatsThis(tr("Play a game across a local area network"));
       
    70     BtnNetLocal->setFixedSize(BtnNet->width() - 50, 60);
       
    71     BtnNetLocal->setVisible(false);
       
    72 
       
    73     BtnNetOfficial = addButton("Play official network game", (QBoxLayout*)netLayout, 0, false);
       
    74     BtnNetOfficial->setToolTip(tr("Play a network game"));
       
    75     BtnNetOfficial->setWhatsThis(tr("Play a game on an official server"));
       
    76     BtnNetOfficial->setFixedSize(BtnNet->width() - 50, 60);
       
    77     BtnNetOfficial->setVisible(false);
    53 
    78 
    54     // button order matters for overlapping (what's on top and what isn't)
    79     // button order matters for overlapping (what's on top and what isn't)
    55     BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true);
    80     BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true);
    56     BtnInfo->setStyleSheet("border: transparent;background: transparent;");
    81     BtnInfo->setStyleSheet("border: transparent;background: transparent;");
    57     //BtnInfo->setToolTip(tr("Credits")); //tooltip looks horrible with transparent background buttons
    82     //BtnInfo->setToolTip(tr("Credits")); //tooltip looks horrible with transparent background buttons
   182     Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips");
   207     Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips");
   183 #endif
   208 #endif
   184 
   209 
   185     return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
   210     return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
   186 }
   211 }
       
   212 
       
   213 void PageMain::toggleNetworkChoice()
       
   214 {
       
   215     bool visible = BtnNetLocal->isVisible();
       
   216     BtnNetLocal->setVisible(!visible);
       
   217     BtnNetOfficial->setVisible(!visible);
       
   218     if (visible)    BtnNet->setIcon(originalNetworkIcon);
       
   219     else            BtnNet->setIcon(disabledNetworkIcon);
       
   220 }