70 #include "pageoptions.h" |
70 #include "pageoptions.h" |
71 #include "pageeditteam.h" |
71 #include "pageeditteam.h" |
72 #include "pagemultiplayer.h" |
72 #include "pagemultiplayer.h" |
73 #include "pagenet.h" |
73 #include "pagenet.h" |
74 #include "pagemain.h" |
74 #include "pagemain.h" |
75 #include "pagefeedback.h" |
|
76 #include "pagenetserver.h" |
75 #include "pagenetserver.h" |
77 #include "pagedrawmap.h" |
76 #include "pagedrawmap.h" |
78 #include "pagegamestats.h" |
77 #include "pagegamestats.h" |
79 #include "pageplayrecord.h" |
78 #include "pageplayrecord.h" |
80 #include "pagedata.h" |
79 #include "pagedata.h" |
93 #include "drawmapwidget.h" |
92 #include "drawmapwidget.h" |
94 #include "mouseoverfilter.h" |
93 #include "mouseoverfilter.h" |
95 #include "roomslistmodel.h" |
94 #include "roomslistmodel.h" |
96 #include "recorder.h" |
95 #include "recorder.h" |
97 #include "playerslistmodel.h" |
96 #include "playerslistmodel.h" |
|
97 #include "feedbackdialog.h" |
98 |
98 |
99 #include "MessageDialog.h" |
99 #include "MessageDialog.h" |
100 #include "DataManager.h" |
100 #include "DataManager.h" |
101 #include "AutoUpdater.h" |
101 #include "AutoUpdater.h" |
102 |
102 |
212 pageSwitchMapper->setMapping(ui.pageMain->BtnSinglePlayer, ID_PAGE_SINGLEPLAYER); |
212 pageSwitchMapper->setMapping(ui.pageMain->BtnSinglePlayer, ID_PAGE_SINGLEPLAYER); |
213 |
213 |
214 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
214 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
215 pageSwitchMapper->setMapping(ui.pageMain->BtnSetup, ID_PAGE_SETUP); |
215 pageSwitchMapper->setMapping(ui.pageMain->BtnSetup, ID_PAGE_SETUP); |
216 |
216 |
217 connect(ui.pageMain->BtnFeedback, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
217 connect(ui.pageMain->BtnFeedback, SIGNAL(clicked()), this, SLOT(showFeedbackDialog())); |
218 pageSwitchMapper->setMapping(ui.pageMain->BtnFeedback, ID_PAGE_FEEDBACK); |
|
219 |
218 |
220 connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
219 connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
221 pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO); |
220 pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO); |
222 |
221 |
223 connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
222 connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); |
229 pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS); |
228 pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS); |
230 #endif |
229 #endif |
231 |
230 |
232 //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
231 //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
233 //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
232 //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
234 |
|
235 connect(ui.pageFeedback->BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback())); |
|
236 |
233 |
237 connect(ui.pageEditTeam, SIGNAL(goBack()), this, SLOT(AfterTeamEdit())); |
234 connect(ui.pageEditTeam, SIGNAL(goBack()), this, SLOT(AfterTeamEdit())); |
238 |
235 |
239 connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
236 connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
240 connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
237 connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
580 case ID_PAGE_SCHEME : pageName = "PAGE_SCHEME"; break; |
577 case ID_PAGE_SCHEME : pageName = "PAGE_SCHEME"; break; |
581 case ID_PAGE_ADMIN : pageName = "PAGE_ADMIN"; break; |
578 case ID_PAGE_ADMIN : pageName = "PAGE_ADMIN"; break; |
582 case ID_PAGE_CAMPAIGN : pageName = "PAGE_CAMPAIGN"; break; |
579 case ID_PAGE_CAMPAIGN : pageName = "PAGE_CAMPAIGN"; break; |
583 case ID_PAGE_DRAWMAP : pageName = "PAGE_DRAWMAP"; break; |
580 case ID_PAGE_DRAWMAP : pageName = "PAGE_DRAWMAP"; break; |
584 case ID_PAGE_DATADOWNLOAD : pageName = "PAGE_DATADOWNLOAD"; break; |
581 case ID_PAGE_DATADOWNLOAD : pageName = "PAGE_DATADOWNLOAD"; break; |
585 case ID_PAGE_FEEDBACK : pageName = "PAGE_FEEDBACK"; break; |
|
586 case ID_PAGE_VIDEOS : pageName = "PAGE_VIDEOS"; break; |
582 case ID_PAGE_VIDEOS : pageName = "PAGE_VIDEOS"; break; |
587 case MAX_PAGE : pageName = "MAX_PAGE"; break; |
583 case MAX_PAGE : pageName = "MAX_PAGE"; break; |
588 default : pageName = "UNKNOWN_PAGE"; break; |
584 default : pageName = "UNKNOWN_PAGE"; break; |
589 } |
585 } |
590 return pageName; |
586 return pageName; |
1073 NetPassword(nick); |
1065 NetPassword(nick); |
1074 } |
1066 } |
1075 |
1067 |
1076 void HWForm::NetNickNotRegistered(const QString & nick) |
1068 void HWForm::NetNickNotRegistered(const QString & nick) |
1077 { |
1069 { |
|
1070 Q_UNUSED(nick); |
|
1071 |
1078 QMessageBox noRegMsg(this); |
1072 QMessageBox noRegMsg(this); |
1079 noRegMsg.setIcon(QMessageBox::Information); |
1073 noRegMsg.setIcon(QMessageBox::Information); |
1080 noRegMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Nick not registered")); |
1074 noRegMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Nick not registered")); |
1081 noRegMsg.setWindowModality(Qt::WindowModal); |
1075 noRegMsg.setWindowModality(Qt::WindowModal); |
1082 noRegMsg.setText(tr("Your nickname is not registered.\nTo prevent someone else from using it,\nplease register it at www.hedgewars.org")); |
1076 noRegMsg.setText(tr("Your nickname is not registered.\nTo prevent someone else from using it,\nplease register it at www.hedgewars.org")); |
1954 } |
1950 } |
1955 while(!fileName.isEmpty() && !ok); |
1951 while(!fileName.isEmpty() && !ok); |
1956 } |
1952 } |
1957 } |
1953 } |
1958 |
1954 |
1959 void HWForm::SendFeedback() |
|
1960 { |
|
1961 // Get form data |
|
1962 |
|
1963 QString summary = ui.pageFeedback->summary->text(); |
|
1964 QString description = ui.pageFeedback->description->toPlainText(); |
|
1965 QString email = ui.pageFeedback->email->text(); |
|
1966 QString captchaCode = ui.pageFeedback->captcha_code->text(); |
|
1967 QString captchaID = QString::number(ui.pageFeedback->captchaID); |
|
1968 QString version = "HedgewarsFoundation-Hedgewars-" + (cVersionString?(*cVersionString):QString("")); |
|
1969 |
|
1970 if (summary.isEmpty() || description.isEmpty()) |
|
1971 { |
|
1972 MessageDialog::ShowErrorMessage(QMessageBox::tr("Please fill out all fields. Email is optional."), this); |
|
1973 return; |
|
1974 } |
|
1975 |
|
1976 // Submit issue to PHP script |
|
1977 |
|
1978 QByteArray body; |
|
1979 body.append("captcha="); |
|
1980 body.append(captchaID); |
|
1981 body.append("&code="); |
|
1982 body.append(captchaCode); |
|
1983 body.append("&version="); |
|
1984 body.append(QUrl::toPercentEncoding(version)); |
|
1985 body.append("&title="); |
|
1986 body.append(QUrl::toPercentEncoding(summary)); |
|
1987 body.append("&body="); |
|
1988 body.append(QUrl::toPercentEncoding(description)); |
|
1989 body.append("&email="); |
|
1990 body.append(QUrl::toPercentEncoding(email)); |
|
1991 if (ui.pageFeedback->CheckSendSpecs->isChecked()) |
|
1992 { |
|
1993 body.append("&specs="); |
|
1994 body.append(QUrl::toPercentEncoding(ui.pageFeedback->specs)); |
|
1995 } |
|
1996 |
|
1997 nam = new QNetworkAccessManager(this); |
|
1998 connect(nam, SIGNAL(finished(QNetworkReply*)), |
|
1999 this, SLOT(finishedSlot(QNetworkReply*))); |
|
2000 |
|
2001 QNetworkRequest header(QUrl("http://hedgewars.org/feedback/?submit")); |
|
2002 header.setRawHeader("Content-Length", QString::number(body.size()).toAscii()); |
|
2003 |
|
2004 nam->post(header, body); |
|
2005 } |
|
2006 |
|
2007 void HWForm::finishedSlot(QNetworkReply* reply) |
|
2008 { |
|
2009 if (reply && reply->error() == QNetworkReply::NoError) |
|
2010 { |
|
2011 QMessageBox infoMsg(this); |
|
2012 infoMsg.setIcon(QMessageBox::Information); |
|
2013 infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success")); |
|
2014 infoMsg.setText(reply->readAll()); |
|
2015 infoMsg.setWindowModality(Qt::WindowModal); |
|
2016 infoMsg.exec(); |
|
2017 |
|
2018 ui.pageFeedback->summary->clear(); |
|
2019 ui.pageFeedback->email->clear(); |
|
2020 ui.pageFeedback->description->clear(); |
|
2021 ui.pageFeedback->LoadCaptchaImage(); |
|
2022 |
|
2023 return; |
|
2024 } |
|
2025 else |
|
2026 { |
|
2027 MessageDialog::ShowErrorMessage(QString("Error: ") + reply->readAll(), this); |
|
2028 ui.pageFeedback->LoadCaptchaImage(); |
|
2029 } |
|
2030 } |
|
2031 |
1955 |
2032 void HWForm::ShowErrorMessage(const QString & msg) |
1956 void HWForm::ShowErrorMessage(const QString & msg) |
2033 { |
1957 { |
2034 MessageDialog::ShowErrorMessage(msg, this); |
1958 MessageDialog::ShowErrorMessage(msg, this); |
2035 } |
1959 } |
|
1960 |
|
1961 void HWForm::showFeedbackDialog() |
|
1962 { |
|
1963 FeedbackDialog dialog(this); |
|
1964 dialog.exec(); |
|
1965 } |