QTfrontend/ui/page/pagevideos.h
author sheepluva
Fri, 26 Oct 2012 17:05:12 +0200
changeset 7823 46f115569045
parent 7679 bfa26daad684
child 8151 25b95d6224fc
child 8185 1c3739ba4352
permissions -rw-r--r--
rollback of r08642c7da4a3b5e05be51a8b45995e799bbc4bbf ("add DLC button to net game room")
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7631
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     1
/*
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     2
 * Hedgewars, a free turn based strategy game
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     4
 *
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     8
 *
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    12
 * GNU General Public License for more details.
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    13
 *
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    14
 * You should have received a copy of the GNU General Public License
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    15
 * along with this program; if not, write to the Free Software
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    17
 */
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    18
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    19
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    20
#ifndef PAGE_VIDEOS_H
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    21
#define PAGE_VIDEOS_H
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    22
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    23
#include "AbstractPage.h"
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    24
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    25
class QNetworkAccessManager;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    26
class QNetworkReply;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    27
class GameUIConfig;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    28
class HWRecorder;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    29
class VideoItem;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    30
class HWForm;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    31
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    32
class PageVideos : public AbstractPage
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    33
{
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    34
        Q_OBJECT
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    35
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    36
    public:
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    37
        PageVideos(QWidget* parent = 0);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    38
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    39
        QSpinBox  *framerateBox;
7633
d4251e519062 Allow adjusting bitrate so that I can get a somewhat usable webm video. The audio is still tinny and unlistenable. Configuration option for that might be helpful, or just adjusting defaults in the wrapper.
nemo
parents: 7631
diff changeset
    40
        QSpinBox  *bitrateBox;
7631
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    41
        QLineEdit *widthEdit;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    42
        QLineEdit *heightEdit;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    43
        QCheckBox *checkUseGameRes;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    44
        QCheckBox *checkRecordAudio;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    45
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    46
        QString format()
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    47
        { return comboAVFormats->itemData(comboAVFormats->currentIndex()).toString(); }
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    48
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    49
        QString videoCodec()
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    50
        { return comboVideoCodecs->itemData(comboVideoCodecs->currentIndex()).toString(); }
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    51
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    52
        QString audioCodec()
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    53
        { return comboAudioCodecs->itemData(comboAudioCodecs->currentIndex()).toString(); }
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    54
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    55
        void setDefaultCodecs();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    56
        bool tryCodecs(const QString & format, const QString & vcodec, const QString & acodec);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    57
        void addRecorder(HWRecorder* pRecorder);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    58
        bool tryQuit(HWForm *form);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    59
        QString getVideosInProgress(); // get multi-line string with list of videos in progress
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    60
        void startEncoding(const QByteArray & record = QByteArray());
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    61
        void init(GameUIConfig * config);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    62
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    63
    private:
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    64
        // virtuals from AbstractPage
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    65
        QLayout * bodyLayoutDefinition();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    66
        QLayout * footerLayoutDefinition();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    67
        void connectSignals();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    68
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    69
        // virtual from QWidget
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    70
        void keyPressEvent(QKeyEvent * pEvent);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    71
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    72
        void setName(VideoItem * item, const QString & newName);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    73
        void updateSize(int row);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    74
        int appendRow(const QString & name);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    75
        VideoItem* nameItem(int row);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    76
        void play(int row);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    77
        void updateDescription();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    78
        void clearTemp();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    79
        void clearThumbnail();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    80
        void setProgress(int row, VideoItem* item, float value);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    81
        VideoItem * itemFromReply(QNetworkReply* reply, int & row);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    82
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    83
        GameUIConfig * config;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    84
        QNetworkAccessManager* netManager;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    85
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    86
        // options group
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    87
        QComboBox *comboAVFormats;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    88
        QComboBox *comboVideoCodecs;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    89
        QComboBox *comboAudioCodecs;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    90
        QPushButton *btnDefaults;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    91
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    92
        // file list group
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    93
        QTableWidget *filesTable;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    94
        QPushButton *btnOpenDir;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    95
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    96
        // description group
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    97
        QPushButton *btnPlay, *btnDelete, *btnToYouTube;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    98
        QLabel *labelDesc;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
    99
        QLabel *labelThumbnail;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   100
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   101
        // this flag is used to distinguish if cell was changed from code or by user
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   102
        // (in signal cellChanged)
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   103
        bool nameChangedFromCode;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   104
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   105
        int numRecorders, numUploads;
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   106
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   107
    private slots:
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   108
        void changeAVFormat(int index);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   109
        void changeUseGameRes(int state);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   110
        void changeRecordAudio(int state);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   111
        void setDefaultOptions();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   112
        void encodingFinished(bool success);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   113
        void updateProgress(float value);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   114
        void cellDoubleClicked(int row, int column);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   115
        void cellChanged(int row, int column);
7679
bfa26daad684 - Fix some warnings in frontend
unc0rr
parents: 7633
diff changeset
   116
        void currentCellChanged();
7631
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   117
        void playSelectedFile();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   118
        void deleteSelectedFiles();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   119
        void openVideosDirectory();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   120
        void updateFileList(const QString & path);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   121
        void uploadToYouTube();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   122
        void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   123
        void uploadFinished();
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   124
};
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   125
01b599d6f72d dos2unix newline fixes on 7 (video recording-)merged files
sheepluva
parents: 7531
diff changeset
   126
#endif // PAGE_VIDEOS_H