QTfrontend/pagedata.h
author sheepluva
Sun, 25 Sep 2011 20:54:51 +0200
changeset 6026 2833862a7e00
parent 6009 14f6fc9869f2
child 6042 8b5345758f62
permissions -rw-r--r--
get rid of that annoying 'Invalid state: in Lobby' message after room being closed or player being kicked from room. (the frontend always tried to leave the room he already left again)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5271
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     1
/*
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     3
 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     4
 *
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     8
 *
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    12
 * GNU General Public License for more details.
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    13
 *
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    17
 */
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    18
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    19
#ifndef PAGE_DATA_H
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    20
#define PAGE_DATA_H
5746
fbc52bb92cad Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
unc0rr
parents: 5582
diff changeset
    21
5567
44c9a577b082 Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents: 5271
diff changeset
    22
#include <QUrl>
5271
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    23
#include "AbstractPage.h"
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    24
5755
a079b4dea081 Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents: 5754
diff changeset
    25
class DataBrowser;
5754
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    26
class QProgressBar;
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    27
class QNetworkReply;
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    28
class QVBoxLayout;
5746
fbc52bb92cad Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
unc0rr
parents: 5582
diff changeset
    29
5271
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    30
class PageDataDownload : public AbstractPage
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    31
{
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    32
    Q_OBJECT
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    33
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    34
public:
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    35
    PageDataDownload(QWidget* parent = 0);
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    36
5754
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    37
public slots:
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    38
    void fetchList();
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    39
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    40
private:
6009
14f6fc9869f2 code cleanup/etc
sheepluva
parents: 5765
diff changeset
    41
    QPushButton *BtnBack;
5755
a079b4dea081 Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents: 5754
diff changeset
    42
    DataBrowser *web;
5754
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    43
    QHash<QNetworkReply*, QProgressBar *> progressBars;
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    44
    QVBoxLayout *progressBarsLayout;
5567
44c9a577b082 Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents: 5271
diff changeset
    45
5756
b451fd21ff4c Extract downloaded content into temp dir
unc0rr
parents: 5755
diff changeset
    46
    bool extractDataPack(QByteArray * buf);
b451fd21ff4c Extract downloaded content into temp dir
unc0rr
parents: 5755
diff changeset
    47
5582
48ced03a9949 Properly implement slot, connect signal from the object which actually sends it to the slot
unc0rr
parents: 5567
diff changeset
    48
private slots:
5765
e87f6756773e Allow surfing, download and extract only .zip files
unc0rr
parents: 5756
diff changeset
    49
    void request(const QUrl &url);
5746
fbc52bb92cad Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
unc0rr
parents: 5582
diff changeset
    50
5754
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    51
    void pageDownloaded();
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    52
    void fileDownloaded();
583b7a683b17 - Implement progressbars to show download progress
unc0rr
parents: 5746
diff changeset
    53
    void downloadProgress(qint64, qint64);
5271
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    54
};
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    55
48d18e329298 ack. forgot to add my stub files
nemo
parents:
diff changeset
    56
#endif