author | unc0rr |
Thu, 30 Aug 2012 22:41:22 +0400 | |
changeset 7630 | 13fa53bb3134 |
parent 7531 | 0adcad8714c4 |
child 7631 | 01b599d6f72d |
permissions | -rw-r--r-- |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
1 |
/* |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
4 |
* |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
8 |
* |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
13 |
* |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
17 |
*/ |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
18 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
19 |
#include <QGridLayout> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
20 |
#include <QPushButton> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
21 |
#include <QGroupBox> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
22 |
#include <QComboBox> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
23 |
#include <QCheckBox> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
24 |
#include <QLabel> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
25 |
#include <QLineEdit> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
26 |
#include <QSpinBox> |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
27 |
#include <QTableWidget> |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
28 |
#include <QDir> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
29 |
#include <QProgressBar> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
30 |
#include <QStringList> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
31 |
#include <QDesktopServices> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
32 |
#include <QUrl> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
33 |
#include <QList> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
34 |
#include <QMessageBox> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
35 |
#include <QHeaderView> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
36 |
#include <QKeyEvent> |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
37 |
#include <QVBoxLayout> |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
38 |
#include <QHBoxLayout> |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
39 |
#include <QFileSystemWatcher> |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
40 |
#include <QDateTime> |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
41 |
#include <QRegExp> |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
42 |
#include <QNetworkAccessManager> |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
43 |
#include <QNetworkRequest> |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
44 |
#include <QNetworkReply> |
7507 | 45 |
#include <QXmlStreamReader> |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
46 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
47 |
#include "hwconsts.h" |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
48 |
#include "pagevideos.h" |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
49 |
#include "igbox.h" |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
50 |
#include "libav_iteraction.h" |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
51 |
#include "gameuiconfig.h" |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
52 |
#include "recorder.h" |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
53 |
#include "ask_quit.h" |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
54 |
#include "upload_video.h" |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
55 |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
56 |
static const QSize ThumbnailSize(350, 350*3/5); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
57 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
58 |
// columns in table with list of video files |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
59 |
enum VideosColumns |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
60 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
61 |
vcName, |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
62 |
vcSize, |
7507 | 63 |
vcProgress, // either encoding or uploading |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
64 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
65 |
vcNumColumns, |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
66 |
}; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
67 |
|
7507 | 68 |
// this class is used for items in first column in file-table |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
69 |
class VideoItem : public QTableWidgetItem |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
70 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
71 |
// note: QTableWidgetItem is not Q_OBJECT |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
72 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
73 |
public: |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
74 |
VideoItem(const QString& name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
75 |
~VideoItem(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
76 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
77 |
QString name; |
7507 | 78 |
QString prefix; // original filename without extension |
79 |
QString desc; // description (duration, resolution, etc...) |
|
80 |
QString uploadUrl; // http://youtu.be/??????? |
|
81 |
HWRecorder * pRecorder; // non NULL if file is being encoded |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
82 |
QNetworkReply * pUploading; // non NULL if file is being uploaded |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
83 |
bool seen; // used when updating directory |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
84 |
float lastSizeUpdate; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
85 |
float progress; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
86 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
87 |
bool ready() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
88 |
{ return !pRecorder; } |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
89 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
90 |
QString path() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
91 |
{ return cfgdir->absoluteFilePath("Videos/" + name); } |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
92 |
}; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
93 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
94 |
VideoItem::VideoItem(const QString& name) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
95 |
: QTableWidgetItem(name, UserType) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
96 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
97 |
this->name = name; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
98 |
pRecorder = NULL; |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
99 |
pUploading = NULL; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
100 |
lastSizeUpdate = 0; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
101 |
progress = 0; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
102 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
103 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
104 |
VideoItem::~VideoItem() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
105 |
{} |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
106 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
107 |
QLayout * PageVideos::bodyLayoutDefinition() |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
108 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
109 |
QGridLayout * pPageLayout = new QGridLayout(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
110 |
pPageLayout->setColumnStretch(0, 1); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
111 |
pPageLayout->setColumnStretch(1, 2); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
112 |
pPageLayout->setRowStretch(0, 1); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
113 |
pPageLayout->setRowStretch(1, 1); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
114 |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
115 |
// options |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
116 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
117 |
IconedGroupBox* pOptionsGroup = new IconedGroupBox(this); |
7507 | 118 |
pOptionsGroup->setIcon(QIcon(":/res/Settings.png")); // FIXME |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
119 |
pOptionsGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
120 |
pOptionsGroup->setTitle(QGroupBox::tr("Video recording options")); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
121 |
QGridLayout * pOptLayout = new QGridLayout(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
122 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
123 |
// label for format |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
124 |
QLabel *labelFormat = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
125 |
labelFormat->setText(QLabel::tr("Format")); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
126 |
pOptLayout->addWidget(labelFormat, 0, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
127 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
128 |
// list of supported formats |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
129 |
comboAVFormats = new QComboBox(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
130 |
pOptLayout->addWidget(comboAVFormats, 0, 1, 1, 4); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
131 |
LibavIteraction::instance().fillFormats(comboAVFormats); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
132 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
133 |
// separator |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
134 |
QFrame * hr = new QFrame(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
135 |
hr->setFrameStyle(QFrame::HLine); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
136 |
hr->setLineWidth(3); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
137 |
hr->setFixedHeight(10); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
138 |
pOptLayout->addWidget(hr, 1, 0, 1, 5); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
139 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
140 |
// label for audio codec |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
141 |
QLabel *labelACodec = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
142 |
labelACodec->setText(QLabel::tr("Audio codec")); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
143 |
pOptLayout->addWidget(labelACodec, 2, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
144 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
145 |
// list of supported audio codecs |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
146 |
comboAudioCodecs = new QComboBox(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
147 |
pOptLayout->addWidget(comboAudioCodecs, 2, 1, 1, 3); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
148 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
149 |
// checkbox 'record audio' |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
150 |
checkRecordAudio = new QCheckBox(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
151 |
checkRecordAudio->setText(QCheckBox::tr("Record audio")); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
152 |
pOptLayout->addWidget(checkRecordAudio, 2, 4); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
153 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
154 |
// separator |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
155 |
hr = new QFrame(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
156 |
hr->setFrameStyle(QFrame::HLine); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
157 |
hr->setLineWidth(3); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
158 |
hr->setFixedHeight(10); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
159 |
pOptLayout->addWidget(hr, 3, 0, 1, 5); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
160 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
161 |
// label for video codec |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
162 |
QLabel *labelVCodec = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
163 |
labelVCodec->setText(QLabel::tr("Video codec")); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
164 |
pOptLayout->addWidget(labelVCodec, 4, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
165 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
166 |
// list of supported video codecs |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
167 |
comboVideoCodecs = new QComboBox(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
168 |
pOptLayout->addWidget(comboVideoCodecs, 4, 1, 1, 4); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
169 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
170 |
// label for resolution |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
171 |
QLabel *labelRes = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
172 |
labelRes->setText(QLabel::tr("Resolution")); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
173 |
pOptLayout->addWidget(labelRes, 5, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
174 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
175 |
// width |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
176 |
widthEdit = new QLineEdit(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
177 |
widthEdit->setValidator(new QIntValidator(this)); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
178 |
pOptLayout->addWidget(widthEdit, 5, 1); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
179 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
180 |
// x |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
181 |
QLabel *labelX = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
182 |
labelX->setText("X"); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
183 |
pOptLayout->addWidget(labelX, 5, 2); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
184 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
185 |
// height |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
186 |
heightEdit = new QLineEdit(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
187 |
heightEdit->setValidator(new QIntValidator(pOptionsGroup)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
188 |
pOptLayout->addWidget(heightEdit, 5, 3); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
189 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
190 |
// checkbox 'use game resolution' |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
191 |
checkUseGameRes = new QCheckBox(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
192 |
checkUseGameRes->setText(QCheckBox::tr("Use game resolution")); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
193 |
pOptLayout->addWidget(checkUseGameRes, 5, 4); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
194 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
195 |
// label for framerate |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
196 |
QLabel *labelFramerate = new QLabel(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
197 |
labelFramerate->setText(QLabel::tr("Framerate")); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
198 |
pOptLayout->addWidget(labelFramerate, 6, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
199 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
200 |
// framerate |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
201 |
framerateBox = new QSpinBox(pOptionsGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
202 |
framerateBox->setRange(1, 200); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
203 |
framerateBox->setSingleStep(1); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
204 |
pOptLayout->addWidget(framerateBox, 6, 1); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
205 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
206 |
// button 'set default options' |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
207 |
btnDefaults = new QPushButton(pOptionsGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
208 |
btnDefaults->setText(QPushButton::tr("Set default options")); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
209 |
pOptLayout->addWidget(btnDefaults, 7, 0, 1, 5); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
210 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
211 |
pPageLayout->addWidget(pOptionsGroup, 1, 0); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
212 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
213 |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
214 |
// list of videos |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
215 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
216 |
IconedGroupBox* pTableGroup = new IconedGroupBox(this); |
7507 | 217 |
pTableGroup->setIcon(QIcon(":/res/graphicsicon.png")); // FIXME |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
218 |
pTableGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
219 |
pTableGroup->setTitle(QGroupBox::tr("Videos")); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
220 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
221 |
QStringList columns; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
222 |
columns << tr("Name"); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
223 |
columns << tr("Size"); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
224 |
columns << ""; |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
225 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
226 |
filesTable = new QTableWidget(pTableGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
227 |
filesTable->setColumnCount(vcNumColumns); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
228 |
filesTable->setHorizontalHeaderLabels(columns); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
229 |
filesTable->setSelectionBehavior(QAbstractItemView::SelectRows); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
230 |
filesTable->setSelectionMode(QAbstractItemView::SingleSelection); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
231 |
filesTable->setEditTriggers(QAbstractItemView::SelectedClicked); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
232 |
filesTable->verticalHeader()->hide(); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
233 |
filesTable->setMinimumWidth(400); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
234 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
235 |
QHeaderView * header = filesTable->horizontalHeader(); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
236 |
header->setResizeMode(vcName, QHeaderView::ResizeToContents); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
237 |
header->setResizeMode(vcSize, QHeaderView::Fixed); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
238 |
header->resizeSection(vcSize, 100); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
239 |
header->setStretchLastSection(true); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
240 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
241 |
btnOpenDir = new QPushButton(QPushButton::tr("Open videos directory"), pTableGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
242 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
243 |
QVBoxLayout *box = new QVBoxLayout(pTableGroup); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
244 |
box->addWidget(filesTable); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
245 |
box->addWidget(btnOpenDir); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
246 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
247 |
pPageLayout->addWidget(pTableGroup, 0, 1, 2, 1); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
248 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
249 |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
250 |
// description |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
251 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
252 |
IconedGroupBox* pDescGroup = new IconedGroupBox(this); |
7507 | 253 |
pDescGroup->setIcon(QIcon(":/res/graphicsicon.png")); // FIXME |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
254 |
pDescGroup->setTitle(QGroupBox::tr("Description")); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
255 |
|
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
256 |
QVBoxLayout* pDescLayout = new QVBoxLayout(pDescGroup); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
257 |
QHBoxLayout* pTopDescLayout = new QHBoxLayout(0); // picture and text |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
258 |
QHBoxLayout* pBottomDescLayout = new QHBoxLayout(0); // buttons |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
259 |
|
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
260 |
// label with thumbnail picture |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
261 |
labelThumbnail = new QLabel(pDescGroup); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
262 |
labelThumbnail->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
263 |
labelThumbnail->setMaximumSize(ThumbnailSize); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
264 |
labelThumbnail->setStyleSheet( |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
265 |
"QFrame {" |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
266 |
"border: solid;" |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
267 |
"border-width: 3px;" |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
268 |
"border-color: #ffcc00;" |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
269 |
"border-radius: 4px;" |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
270 |
"}" ); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
271 |
clearThumbnail(); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
272 |
pTopDescLayout->addWidget(labelThumbnail, 2); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
273 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
274 |
// label with file description |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
275 |
labelDesc = new QLabel(pDescGroup); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
276 |
labelDesc->setAlignment(Qt::AlignLeft | Qt::AlignTop); |
7507 | 277 |
labelDesc->setTextInteractionFlags(Qt::TextSelectableByMouse | |
278 |
Qt::TextSelectableByKeyboard | |
|
279 |
Qt::LinksAccessibleByMouse | |
|
280 |
Qt::LinksAccessibleByKeyboard); |
|
281 |
labelDesc->setTextFormat(Qt::RichText); |
|
7531
0adcad8714c4
improve html links + small bugfixes
Stepan777 <stepik-777@mail.ru>
parents:
7507
diff
changeset
|
282 |
labelDesc->setOpenExternalLinks(true); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
283 |
pTopDescLayout->addWidget(labelDesc, 1); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
284 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
285 |
// buttons: play and delete |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
286 |
btnPlay = new QPushButton(QPushButton::tr("Play"), pDescGroup); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
287 |
btnPlay->setEnabled(false); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
288 |
pBottomDescLayout->addWidget(btnPlay); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
289 |
btnDelete = new QPushButton(QPushButton::tr("Delete"), pDescGroup); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
290 |
btnDelete->setEnabled(false); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
291 |
pBottomDescLayout->addWidget(btnDelete); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
292 |
btnToYouTube = new QPushButton(QPushButton::tr("Upload to YouTube"), pDescGroup); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
293 |
btnToYouTube->setEnabled(false); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
294 |
pBottomDescLayout->addWidget(btnToYouTube); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
295 |
|
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
296 |
pDescLayout->addStretch(1); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
297 |
pDescLayout->addLayout(pTopDescLayout, 0); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
298 |
pDescLayout->addStretch(1); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
299 |
pDescLayout->addLayout(pBottomDescLayout, 0); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
300 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
301 |
pPageLayout->addWidget(pDescGroup, 0, 0); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
302 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
303 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
304 |
return pPageLayout; |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
305 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
306 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
307 |
QLayout * PageVideos::footerLayoutDefinition() |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
308 |
{ |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
309 |
return NULL; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
310 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
311 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
312 |
void PageVideos::connectSignals() |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
313 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
314 |
connect(checkUseGameRes, SIGNAL(stateChanged(int)), this, SLOT(changeUseGameRes(int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
315 |
connect(checkRecordAudio, SIGNAL(stateChanged(int)), this, SLOT(changeRecordAudio(int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
316 |
connect(comboAVFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAVFormat(int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
317 |
connect(btnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions())); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
318 |
connect(filesTable, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(cellDoubleClicked(int, int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
319 |
connect(filesTable, SIGNAL(cellChanged(int,int)), this, SLOT(cellChanged(int, int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
320 |
connect(filesTable, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(currentCellChanged(int,int,int,int))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
321 |
connect(btnPlay, SIGNAL(clicked()), this, SLOT(playSelectedFile())); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
322 |
connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteSelectedFiles())); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
323 |
connect(btnToYouTube, SIGNAL(clicked()), this, SLOT(uploadToYouTube())); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
324 |
connect(btnOpenDir, SIGNAL(clicked()), this, SLOT(openVideosDirectory())); |
7531
0adcad8714c4
improve html links + small bugfixes
Stepan777 <stepik-777@mail.ru>
parents:
7507
diff
changeset
|
325 |
} |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
326 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
327 |
PageVideos::PageVideos(QWidget* parent) : AbstractPage(parent), |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
328 |
config(0), netManager(0) |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
329 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
330 |
nameChangedFromCode = false; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
331 |
numRecorders = 0; |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
332 |
numUploads = 0; |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
333 |
initPage(); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
334 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
335 |
|
7392
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
336 |
void PageVideos::init(GameUIConfig * config) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
337 |
{ |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
338 |
this->config = config; |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
339 |
|
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
340 |
QString path = cfgdir->absolutePath() + "/Videos"; |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
341 |
QFileSystemWatcher * pWatcher = new QFileSystemWatcher(this); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
342 |
pWatcher->addPath(path); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
343 |
connect(pWatcher, SIGNAL(directoryChanged(const QString &)), this, SLOT(updateFileList(const QString &))); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
344 |
updateFileList(path); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
345 |
|
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
346 |
startEncoding(); // this is for videos recorded from demos which were executed directly (without frontend) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
347 |
} |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
348 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
349 |
// user changed file format, we need to update list of codecs |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
350 |
void PageVideos::changeAVFormat(int index) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
351 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
352 |
// remember selected codecs |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
353 |
QString prevVCodec = videoCodec(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
354 |
QString prevACodec = audioCodec(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
355 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
356 |
// clear lists of codecs |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
357 |
comboVideoCodecs->clear(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
358 |
comboAudioCodecs->clear(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
359 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
360 |
// get list of codecs for specified format |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
361 |
LibavIteraction::instance().fillCodecs(comboAVFormats->itemData(index).toString(), comboVideoCodecs, comboAudioCodecs); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
362 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
363 |
// disable audio if there is no audio codec |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
364 |
if (comboAudioCodecs->count() == 0) |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
365 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
366 |
checkRecordAudio->setChecked(false); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
367 |
checkRecordAudio->setEnabled(false); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
368 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
369 |
else |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
370 |
checkRecordAudio->setEnabled(true); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
371 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
372 |
// restore selected codecs if possible |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
373 |
int iVCodec = comboVideoCodecs->findData(prevVCodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
374 |
if (iVCodec != -1) |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
375 |
comboVideoCodecs->setCurrentIndex(iVCodec); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
376 |
int iACodec = comboAudioCodecs->findData(prevACodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
377 |
if (iACodec != -1) |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
378 |
comboAudioCodecs->setCurrentIndex(iACodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
379 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
380 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
381 |
// user switched checkbox 'use game resolution' |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
382 |
void PageVideos::changeUseGameRes(int state) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
383 |
{ |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
384 |
if (state && config) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
385 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
386 |
// set resolution to game resolution |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
387 |
QRect resolution = config->vid_Resolution(); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
388 |
widthEdit->setText(QString::number(resolution.width())); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
389 |
heightEdit->setText(QString::number(resolution.height())); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
390 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
391 |
widthEdit->setEnabled(!state); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
392 |
heightEdit->setEnabled(!state); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
393 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
394 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
395 |
// user switched checkbox 'record audio' |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
396 |
void PageVideos::changeRecordAudio(int state) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
397 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
398 |
comboAudioCodecs->setEnabled(!!state); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
399 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
400 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
401 |
void PageVideos::setDefaultCodecs() |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
402 |
{ |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
403 |
if (tryCodecs("mp4", "libx264", "libmp3lame")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
404 |
return; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
405 |
if (tryCodecs("mp4", "libx264", "libfaac")) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
406 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
407 |
if (tryCodecs("mp4", "libx264", "libvo_aacenc")) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
408 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
409 |
if (tryCodecs("mp4", "libx264", "aac")) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
410 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
411 |
if (tryCodecs("mp4", "libx264", "mp2")) |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
412 |
return; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
413 |
if (tryCodecs("avi", "libxvid", "libmp3lame")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
414 |
return; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
415 |
if (tryCodecs("avi", "libxvid", "ac3_fixed")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
416 |
return; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
417 |
if (tryCodecs("avi", "libxvid", "mp2")) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
418 |
return; |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
419 |
if (tryCodecs("avi", "mpeg4", "libmp3lame")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
420 |
return; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
421 |
if (tryCodecs("avi", "mpeg4", "ac3_fixed")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
422 |
return; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
423 |
if (tryCodecs("avi", "mpeg4", "mp2")) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
424 |
return; |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
425 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
426 |
// this shouldn't happen, just in case |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
427 |
if (tryCodecs("ogg", "libtheora", "libvorbis")) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
428 |
return; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
429 |
tryCodecs("ogg", "libtheora", "flac"); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
430 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
431 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
432 |
void PageVideos::setDefaultOptions() |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
433 |
{ |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
434 |
framerateBox->setValue(25); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
435 |
checkRecordAudio->setChecked(true); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
436 |
checkUseGameRes->setChecked(true); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
437 |
setDefaultCodecs(); |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
438 |
} |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
439 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
440 |
bool PageVideos::tryCodecs(const QString & format, const QString & vcodec, const QString & acodec) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
441 |
{ |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
442 |
// first we should change format |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
443 |
int iFormat = comboAVFormats->findData(format); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
444 |
if (iFormat == -1) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
445 |
return false; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
446 |
comboAVFormats->setCurrentIndex(iFormat); |
7507 | 447 |
// format was changed, so lists of codecs were automatically updated to codecs supported by this format |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
448 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
449 |
// try to find video codec |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
450 |
int iVCodec = comboVideoCodecs->findData(vcodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
451 |
if (iVCodec == -1) |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
452 |
return false; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
453 |
comboVideoCodecs->setCurrentIndex(iVCodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
454 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
455 |
// try to find audio codec |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
456 |
int iACodec = comboAudioCodecs->findData(acodec); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
457 |
if (iACodec == -1 && checkRecordAudio->isChecked()) |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
458 |
return false; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
459 |
if (iACodec != -1) |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
460 |
comboAudioCodecs->setCurrentIndex(iACodec); |
7235
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
461 |
|
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
462 |
return true; |
baa69bd025d9
1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff
changeset
|
463 |
} |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
464 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
465 |
// get file size as string |
7507 | 466 |
static QString FileSizeStr(const QString & path) |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
467 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
468 |
quint64 size = QFileInfo(path).size(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
469 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
470 |
quint64 KiB = 1024; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
471 |
quint64 MiB = 1024*KiB; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
472 |
quint64 GiB = 1024*MiB; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
473 |
QString sizeStr; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
474 |
if (size >= GiB) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
475 |
return QString("%1 GiB").arg(QString::number(float(size)/GiB, 'f', 2)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
476 |
if (size >= MiB) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
477 |
return QString("%1 MiB").arg(QString::number(float(size)/MiB, 'f', 2)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
478 |
if (size >= KiB) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
479 |
return QString("%1 KiB").arg(QString::number(float(size)/KiB, 'f', 2)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
480 |
return PageVideos::tr("%1 bytes").arg(QString::number(size)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
481 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
482 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
483 |
// set file size in file list in specified row |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
484 |
void PageVideos::updateSize(int row) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
485 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
486 |
VideoItem * item = nameItem(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
487 |
QString path = item->ready()? item->path() : cfgdir->absoluteFilePath("VideoTemp/" + item->pRecorder->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
488 |
filesTable->item(row, vcSize)->setText(FileSizeStr(path)); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
489 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
490 |
|
7507 | 491 |
// There is a button 'Open videos dir', so it is possible that user will open |
492 |
// this dir and rename/delete some files there, so we should handle this. |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
493 |
void PageVideos::updateFileList(const QString & path) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
494 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
495 |
// mark all files as non seen |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
496 |
int numRows = filesTable->rowCount(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
497 |
for (int i = 0; i < numRows; i++) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
498 |
nameItem(i)->seen = false; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
499 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
500 |
QStringList files = QDir(path).entryList(QDir::Files); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
501 |
foreach (const QString & name, files) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
502 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
503 |
int row = -1; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
504 |
foreach (QTableWidgetItem * item, filesTable->findItems(name, Qt::MatchExactly)) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
505 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
506 |
if (item->type() != QTableWidgetItem::UserType || !((VideoItem*)item)->ready()) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
507 |
continue; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
508 |
row = item->row(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
509 |
break; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
510 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
511 |
if (row == -1) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
512 |
row = appendRow(name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
513 |
VideoItem * item = nameItem(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
514 |
item->seen = true; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
515 |
item->desc = ""; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
516 |
updateSize(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
517 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
518 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
519 |
// remove all non seen files |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
520 |
for (int i = 0; i < filesTable->rowCount();) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
521 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
522 |
VideoItem * item = nameItem(i); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
523 |
if (item->ready() && !item->seen) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
524 |
filesTable->removeRow(i); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
525 |
else |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
526 |
i++; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
527 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
528 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
529 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
530 |
void PageVideos::addRecorder(HWRecorder* pRecorder) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
531 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
532 |
int row = appendRow(pRecorder->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
533 |
VideoItem * item = nameItem(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
534 |
item->pRecorder = pRecorder; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
535 |
pRecorder->item = item; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
536 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
537 |
// add progress bar |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
538 |
QProgressBar * progressBar = new QProgressBar(filesTable); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
539 |
progressBar->setMinimum(0); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
540 |
progressBar->setMaximum(10000); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
541 |
progressBar->setValue(0); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
542 |
connect(pRecorder, SIGNAL(onProgress(float)), this, SLOT(updateProgress(float))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
543 |
connect(pRecorder, SIGNAL(encodingFinished(bool)), this, SLOT(encodingFinished(bool))); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
544 |
filesTable->setCellWidget(row, vcProgress, progressBar); |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
545 |
|
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
546 |
numRecorders++; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
547 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
548 |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
549 |
void PageVideos::setProgress(int row, VideoItem* item, float value) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
550 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
551 |
QProgressBar * progressBar = (QProgressBar*)filesTable->cellWidget(row, vcProgress); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
552 |
progressBar->setValue(value*10000); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
553 |
progressBar->setFormat(QString("%1%").arg(value*100, 0, 'f', 2)); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
554 |
item->progress = value; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
555 |
} |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
556 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
557 |
void PageVideos::updateProgress(float value) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
558 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
559 |
HWRecorder * pRecorder = (HWRecorder*)sender(); |
7507 | 560 |
VideoItem * item = pRecorder->item; |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
561 |
int row = filesTable->row(item); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
562 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
563 |
// update file size every percent |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
564 |
if (value - item->lastSizeUpdate > 0.01) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
565 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
566 |
updateSize(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
567 |
item->lastSizeUpdate = value; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
568 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
569 |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
570 |
setProgress(row, item, value); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
571 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
572 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
573 |
void PageVideos::encodingFinished(bool success) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
574 |
{ |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
575 |
numRecorders--; |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
576 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
577 |
HWRecorder * pRecorder = (HWRecorder*)sender(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
578 |
VideoItem * item = (VideoItem*)pRecorder->item; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
579 |
int row = filesTable->row(item); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
580 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
581 |
if (success) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
582 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
583 |
// move file to destination |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
584 |
success = cfgdir->rename("VideoTemp/" + pRecorder->name, "Videos/" + item->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
585 |
if (!success) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
586 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
587 |
// unable to rename for some reason (maybe user entered incorrect name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
588 |
// try to use temp name instead. |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
589 |
success = cfgdir->rename("VideoTemp/" + pRecorder->name, "Videos/" + pRecorder->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
590 |
if (success) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
591 |
setName(item, pRecorder->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
592 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
593 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
594 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
595 |
if (!success) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
596 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
597 |
filesTable->removeRow(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
598 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
599 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
600 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
601 |
filesTable->setCellWidget(row, vcProgress, NULL); // remove progress bar |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
602 |
item->pRecorder = NULL; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
603 |
updateSize(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
604 |
updateDescription(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
605 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
606 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
607 |
void PageVideos::cellDoubleClicked(int row, int column) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
608 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
609 |
play(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
610 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
611 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
612 |
void PageVideos::cellChanged(int row, int column) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
613 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
614 |
// user can only edit name |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
615 |
if (column != vcName || nameChangedFromCode) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
616 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
617 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
618 |
// user has edited filename, so we should rename the file |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
619 |
VideoItem * item = nameItem(row); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
620 |
QString oldName = item->name; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
621 |
QString newName = item->text(); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
622 |
if (!newName.contains('.')) // user forgot an extension |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
623 |
{ |
7507 | 624 |
// restore old extension |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
625 |
int pt = oldName.lastIndexOf('.'); |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
626 |
if (pt != -1) |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
627 |
{ |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
628 |
newName += oldName.right(oldName.length() - pt); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
629 |
setName(item, newName); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
630 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
631 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
632 |
#ifdef Q_WS_WIN |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
633 |
// there is a bug in qt, QDir::rename() doesn't fail on such names but damages files |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
634 |
if (newName.contains(QRegExp("[\"*:<>?\/|]"))) |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
635 |
{ |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
636 |
setName(item, oldName); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
637 |
return; |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
638 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
639 |
#endif |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
640 |
if (item->ready() && !cfgdir->rename("Videos/" + oldName, "Videos/" + newName)) |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
641 |
{ |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
642 |
// unable to rename for some reason (maybe user entered incorrect name), |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
643 |
// therefore restore old name in cell |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
644 |
setName(item, oldName); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
645 |
return; |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
646 |
} |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
647 |
item->name = newName; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
648 |
updateDescription(); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
649 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
650 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
651 |
void PageVideos::setName(VideoItem * item, const QString & newName) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
652 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
653 |
nameChangedFromCode = true; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
654 |
item->setText(newName); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
655 |
nameChangedFromCode = false; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
656 |
item->name = newName; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
657 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
658 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
659 |
int PageVideos::appendRow(const QString & name) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
660 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
661 |
int row = filesTable->rowCount(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
662 |
filesTable->setRowCount(row+1); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
663 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
664 |
// add 'name' item |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
665 |
QTableWidgetItem * item = new VideoItem(name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
666 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
667 |
nameChangedFromCode = true; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
668 |
filesTable->setItem(row, vcName, item); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
669 |
nameChangedFromCode = false; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
670 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
671 |
// add 'size' item |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
672 |
item = new QTableWidgetItem(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
673 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
674 |
item->setTextAlignment(Qt::AlignRight); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
675 |
filesTable->setItem(row, vcSize, item); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
676 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
677 |
// add 'progress' item |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
678 |
item = new QTableWidgetItem(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
679 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
680 |
filesTable->setItem(row, vcProgress, item); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
681 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
682 |
return row; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
683 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
684 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
685 |
VideoItem* PageVideos::nameItem(int row) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
686 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
687 |
return (VideoItem*)filesTable->item(row, vcName); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
688 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
689 |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
690 |
void PageVideos::clearThumbnail() |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
691 |
{ |
7507 | 692 |
// add empty (transparent) image for proper sizing |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
693 |
QPixmap pic(ThumbnailSize); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
694 |
pic.fill(QColor(0,0,0,0)); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
695 |
labelThumbnail->setPixmap(pic); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
696 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
697 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
698 |
void PageVideos::updateDescription() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
699 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
700 |
VideoItem * item = nameItem(filesTable->currentRow()); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
701 |
if (!item) |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
702 |
{ |
7507 | 703 |
// nothing is selected => clear description and return |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
704 |
labelDesc->clear(); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
705 |
clearThumbnail(); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
706 |
btnPlay->setEnabled(false); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
707 |
btnDelete->setEnabled(false); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
708 |
btnToYouTube->setEnabled(false); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
709 |
return; |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
710 |
} |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
711 |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
712 |
btnPlay->setEnabled(item->ready()); |
7507 | 713 |
btnToYouTube->setEnabled(item->ready()); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
714 |
btnDelete->setEnabled(true); |
7507 | 715 |
btnDelete->setText(item->ready()? QPushButton::tr("Delete") : QPushButton::tr("Cancel")); |
716 |
btnToYouTube->setText(item->pUploading? QPushButton::tr("Cancel uploading") : QPushButton::tr("Upload to YouTube")); |
|
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
717 |
|
7507 | 718 |
// construct string with desctiption of this file to display it |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
719 |
QString desc = item->name + "\n\n"; |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
720 |
|
7507 | 721 |
if (!item->ready()) |
722 |
desc += tr("(in progress...)"); |
|
723 |
else |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
724 |
{ |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
725 |
QString path = item->path(); |
7507 | 726 |
desc += tr("Date: ") + QFileInfo(path).created().toString(Qt::DefaultLocaleLongDate) + '\n'; |
727 |
desc += tr("Size: ") + FileSizeStr(path) + '\n'; |
|
728 |
if (item->desc.isEmpty()) |
|
729 |
{ |
|
730 |
// Extract description from file; |
|
731 |
// It will contain duration, resolution, etc and also comment added by hwengine. |
|
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
732 |
item->desc = LibavIteraction::instance().getFileInfo(path); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
733 |
|
7507 | 734 |
// extract prefix (original name) from description (it is enclosed in prefix[???]prefix) |
735 |
int prefixBegin = item->desc.indexOf("prefix["); |
|
736 |
int prefixEnd = item->desc.indexOf("]prefix"); |
|
737 |
if (prefixBegin != -1 && prefixEnd != -1) |
|
738 |
{ |
|
7531
0adcad8714c4
improve html links + small bugfixes
Stepan777 <stepik-777@mail.ru>
parents:
7507
diff
changeset
|
739 |
item->prefix = item->desc.mid(prefixBegin + 7, prefixEnd - (prefixBegin + 7)); |
7507 | 740 |
item->desc.remove(prefixBegin, prefixEnd + 7 - prefixBegin); |
741 |
} |
|
742 |
} |
|
743 |
desc += item->desc + '\n'; |
|
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
744 |
} |
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
745 |
|
7507 | 746 |
if (item->prefix.isEmpty()) |
747 |
{ |
|
748 |
// try to extract prefix from file name instead |
|
749 |
if (item->ready()) |
|
750 |
item->prefix = item->name; |
|
751 |
else |
|
752 |
item->prefix = item->pRecorder->name; |
|
753 |
||
754 |
// remove extension |
|
755 |
int pt = item->prefix.lastIndexOf('.'); |
|
756 |
if (pt != -1) |
|
757 |
item->prefix.truncate(pt); |
|
758 |
} |
|
759 |
||
760 |
if (item->ready() && item->uploadUrl.isEmpty()) |
|
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
761 |
{ |
7507 | 762 |
// try to load url from file |
763 |
QFile * file = new QFile(cfgdir->absoluteFilePath("VideoTemp/" + item->prefix + "-url.txt"), this); |
|
764 |
if (!file->open(QIODevice::ReadOnly)) |
|
765 |
item->uploadUrl = "no"; |
|
766 |
else |
|
767 |
{ |
|
768 |
QByteArray data = file->readAll(); |
|
769 |
file->close(); |
|
770 |
item->uploadUrl = QString::fromUtf8(data.data()); |
|
771 |
} |
|
772 |
} |
|
773 |
if (item->uploadUrl != "no") |
|
7531
0adcad8714c4
improve html links + small bugfixes
Stepan777 <stepik-777@mail.ru>
parents:
7507
diff
changeset
|
774 |
desc += QString("<a href=\"%1\" style=\"color: white;\">%1</a>").arg(item->uploadUrl); |
7507 | 775 |
desc.replace("\n", "<br/>"); |
776 |
||
777 |
labelDesc->setText(desc); |
|
778 |
||
779 |
if (!item->prefix.isEmpty()) |
|
780 |
{ |
|
781 |
QString thumbName = cfgdir->absoluteFilePath("VideoTemp/" + item->prefix); |
|
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
782 |
QPixmap pic; |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
783 |
if (pic.load(thumbName + ".png") || pic.load(thumbName + ".bmp")) |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
784 |
{ |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
785 |
if (pic.height()*ThumbnailSize.width() > pic.width()*ThumbnailSize.height()) |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
786 |
pic = pic.scaledToWidth(ThumbnailSize.width()); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7280
diff
changeset
|
787 |
else |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
788 |
pic = pic.scaledToHeight(ThumbnailSize.height()); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
789 |
labelThumbnail->setPixmap(pic); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
790 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
791 |
else |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
792 |
clearThumbnail(); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
793 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
794 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
795 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
796 |
// user selected another cell, so we should change description |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
797 |
void PageVideos::currentCellChanged(int row, int column, int previousRow, int previousColumn) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
798 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
799 |
updateDescription(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
800 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
801 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
802 |
// open video file in external media player |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
803 |
void PageVideos::play(int row) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
804 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
805 |
VideoItem * item = nameItem(row); |
7507 | 806 |
if (item && item->ready()) |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
807 |
QDesktopServices::openUrl(QUrl("file:///" + QDir::toNativeSeparators(item->path()))); |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
808 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
809 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
810 |
void PageVideos::playSelectedFile() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
811 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
812 |
int index = filesTable->currentRow(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
813 |
if (index != -1) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
814 |
play(index); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
815 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
816 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
817 |
void PageVideos::deleteSelectedFiles() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
818 |
{ |
7507 | 819 |
int index = filesTable->currentRow(); |
820 |
if (index == -1) |
|
821 |
return; |
|
822 |
||
823 |
VideoItem * item = nameItem(index); |
|
824 |
if (!item) |
|
825 |
return; |
|
826 |
||
827 |
// ask user if (s)he is serious |
|
828 |
if (QMessageBox::question(this, |
|
829 |
tr("Are you sure?"), |
|
830 |
tr("Do you really want do remove %1?").arg(item->name), |
|
831 |
QMessageBox::Yes | QMessageBox::No) |
|
832 |
!= QMessageBox::Yes) |
|
833 |
return; |
|
834 |
||
835 |
// remove |
|
836 |
if (!item->ready()) |
|
837 |
item->pRecorder->deleteLater(); |
|
838 |
else |
|
839 |
cfgdir->remove("Videos/" + item->name); |
|
840 |
||
841 |
// this code is for removing several files when multiple selection is enabled |
|
842 |
#if 0 |
|
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
843 |
QList<QTableWidgetItem*> items = filesTable->selectedItems(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
844 |
int num = items.size() / vcNumColumns; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
845 |
if (num == 0) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
846 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
847 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
848 |
// ask user if (s)he is serious |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
849 |
if (QMessageBox::question(this, |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
850 |
tr("Are you sure?"), |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
851 |
tr("Do you really want do remove %1 file(s)?").arg(num), |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
852 |
QMessageBox::Yes | QMessageBox::No) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
853 |
!= QMessageBox::Yes) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
854 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
855 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
856 |
// remove |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
857 |
foreach (QTableWidgetItem * witem, items) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
858 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
859 |
if (witem->type() != QTableWidgetItem::UserType) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
860 |
continue; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
861 |
VideoItem * item = (VideoItem*)witem; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
862 |
if (!item->ready()) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
863 |
item->pRecorder->deleteLater(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
864 |
else |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
865 |
cfgdir->remove("Videos/" + item->name); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
866 |
} |
7507 | 867 |
#endif |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
868 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
869 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
870 |
void PageVideos::keyPressEvent(QKeyEvent * pEvent) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
871 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
872 |
if (filesTable->hasFocus()) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
873 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
874 |
if (pEvent->key() == Qt::Key_Delete) |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
875 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
876 |
deleteSelectedFiles(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
877 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
878 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
879 |
if (pEvent->key() == Qt::Key_Enter) // doesn't work |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
880 |
{ |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
881 |
playSelectedFile(); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
882 |
return; |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
883 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
884 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
885 |
AbstractPage::keyPressEvent(pEvent); |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
886 |
} |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
887 |
|
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
888 |
void PageVideos::openVideosDirectory() |
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
889 |
{ |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
890 |
QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Videos"); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
891 |
QDesktopServices::openUrl(QUrl("file:///" + path)); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
892 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
893 |
|
7507 | 894 |
// clear VideoTemp directory (except for thumbnails and upload links) |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
895 |
void PageVideos::clearTemp() |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
896 |
{ |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
897 |
QDir temp(cfgdir->absolutePath() + "/VideoTemp"); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
898 |
QStringList files = temp.entryList(QDir::Files); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
899 |
foreach (const QString& file, files) |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
900 |
{ |
7507 | 901 |
if (!file.endsWith(".bmp") && !file.endsWith(".png") && !file.endsWith("-url.txt")) |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
902 |
temp.remove(file); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
903 |
} |
7280
fd707afbc3a2
pagevideos is now much better that before:
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
904 |
} |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
905 |
|
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
906 |
bool PageVideos::tryQuit(HWForm * form) |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
907 |
{ |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
908 |
bool quit = true; |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
909 |
if (numRecorders != 0 || numUploads != 0) |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
910 |
{ |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
911 |
// ask user what to do - abort or wait |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
912 |
HWAskQuitDialog * askd = new HWAskQuitDialog(this, form); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
913 |
askd->deleteLater(); |
7386
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
914 |
quit = askd->exec(); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
915 |
} |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
916 |
if (quit) |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
917 |
clearTemp(); |
e82a076df09b
Fix bug with isInLag picture displayed at end of some videos.
Stepan777 <stepik-777@mail.ru>
parents:
7353
diff
changeset
|
918 |
return quit; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
919 |
} |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
920 |
|
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
921 |
// returns multi-line string with list of videos in progress |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
922 |
/* it will look like this: |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
923 |
foo.avi (15.21% - encoding) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
924 |
bar.avi (18.21% - uploading) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
925 |
*/ |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
926 |
QString PageVideos::getVideosInProgress() |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
927 |
{ |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
928 |
QString list = ""; |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
929 |
int count = filesTable->rowCount(); |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
930 |
for (int i = 0; i < count; i++) |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
931 |
{ |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
932 |
VideoItem * item = nameItem(i); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
933 |
QString process; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
934 |
if (!item->ready()) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
935 |
process = tr("encoding"); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
936 |
else if (item->pUploading) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
937 |
process = tr("uploading"); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
938 |
else |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
939 |
continue; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
940 |
float progress = 100*item->progress; |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
941 |
if (progress > 99.99) |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
942 |
progress = 99.99; // displaying 100% may be confusing |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
943 |
list += item->name + " (" + QString::number(progress, 'f', 2) + "% - " + process + ")\n"; |
7353
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
944 |
} |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
945 |
return list; |
0e55228e1303
When there are videos that are being encoded and user tries to quit display dialog with warning.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
946 |
} |
7392
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
947 |
|
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
948 |
void PageVideos::startEncoding(const QByteArray & record) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
949 |
{ |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
950 |
QDir videoTempDir(cfgdir->absolutePath() + "/VideoTemp/"); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
951 |
QStringList files = videoTempDir.entryList(QStringList("*.txtout"), QDir::Files); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
952 |
foreach (const QString & str, files) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
953 |
{ |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
954 |
QString prefix = str; |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
955 |
prefix.chop(7); // remove ".txtout" |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
956 |
videoTempDir.rename(prefix + ".txtout", prefix + ".txtin"); // rename this file to not open it twice |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
957 |
|
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
958 |
HWRecorder* pRecorder = new HWRecorder(config, prefix); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
959 |
|
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
960 |
if (!record.isEmpty()) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
961 |
pRecorder->EncodeVideo(record); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
962 |
else |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
963 |
{ |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
964 |
// this is for videos recorded from demos which were executed directly (without frontend) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
965 |
QFile demofile(videoTempDir.absoluteFilePath(prefix + ".hwd")); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
966 |
if (!demofile.open(QIODevice::ReadOnly)) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
967 |
continue; |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
968 |
QByteArray demo = demofile.readAll(); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
969 |
if (demo.isEmpty()) |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
970 |
continue; |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
971 |
pRecorder->EncodeVideo(demo); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
972 |
} |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
973 |
addRecorder(pRecorder); |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
974 |
} |
bc3306c59a08
Correctly distinguish between game and real ticks while recording video,
Stepan777 <stepik-777@mail.ru>
parents:
7386
diff
changeset
|
975 |
} |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
976 |
|
7507 | 977 |
VideoItem * PageVideos::itemFromReply(QNetworkReply* reply, int & row) |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
978 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
979 |
VideoItem * item = NULL; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
980 |
int count = filesTable->rowCount(); |
7507 | 981 |
// find corresponding item (maybe there is a better way to implement this?) |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
982 |
for (int i = 0; i < count; i++) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
983 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
984 |
item = nameItem(i); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
985 |
if (item->pUploading == reply) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
986 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
987 |
row = i; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
988 |
break; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
989 |
} |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
990 |
} |
7507 | 991 |
return item; |
992 |
} |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
993 |
|
7507 | 994 |
void PageVideos::uploadProgress(qint64 bytesSent, qint64 bytesTotal) |
995 |
{ |
|
996 |
QNetworkReply* reply = (QNetworkReply*)sender(); |
|
997 |
int row; |
|
998 |
VideoItem * item = itemFromReply(reply, row); |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
999 |
setProgress(row, item, bytesSent*1.0/bytesTotal); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1000 |
} |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1001 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1002 |
void PageVideos::uploadFinished() |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1003 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1004 |
QNetworkReply* reply = (QNetworkReply*)sender(); |
7507 | 1005 |
reply->deleteLater(); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1006 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1007 |
int row; |
7507 | 1008 |
VideoItem * item = itemFromReply(reply, row); |
1009 |
if (!item) |
|
1010 |
return; |
|
1011 |
||
1012 |
item->pUploading = NULL; |
|
1013 |
||
1014 |
// extract video id from reply |
|
1015 |
QString videoid; |
|
1016 |
QXmlStreamReader xml(reply); |
|
1017 |
while (!xml.atEnd()) |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1018 |
{ |
7507 | 1019 |
xml.readNext(); |
1020 |
if (xml.qualifiedName() == "yt:videoid") |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1021 |
{ |
7507 | 1022 |
videoid = xml.readElementText(); |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1023 |
break; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1024 |
} |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1025 |
} |
7507 | 1026 |
|
1027 |
if (!videoid.isEmpty()) |
|
1028 |
{ |
|
1029 |
item->uploadUrl = "http://youtu.be/" + videoid; |
|
1030 |
updateDescription(); |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1031 |
|
7507 | 1032 |
// save url in file |
1033 |
QFile * file = new QFile(cfgdir->absoluteFilePath("VideoTemp/" + item->prefix + "-url.txt"), this); |
|
1034 |
if (file->open(QIODevice::WriteOnly)) |
|
1035 |
{ |
|
1036 |
file->write(item->uploadUrl.toUtf8()); |
|
1037 |
file->close(); |
|
1038 |
} |
|
1039 |
} |
|
1040 |
||
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1041 |
filesTable->setCellWidget(row, vcProgress, NULL); // remove progress bar |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1042 |
numUploads--; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1043 |
} |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1044 |
|
7507 | 1045 |
// this will protect saved youtube password from those who cannot read source code |
1046 |
static QString protectPass(QString str) |
|
1047 |
{ |
|
1048 |
QByteArray array = str.toUtf8(); |
|
1049 |
for (int i = 0; i < array.size(); i++) |
|
1050 |
array[i] = array[i] ^ 0xC4 ^ i; |
|
1051 |
array = array.toBase64(); |
|
1052 |
return QString::fromAscii(array.data()); |
|
1053 |
} |
|
1054 |
||
1055 |
static QString unprotectPass(QString str) |
|
1056 |
{ |
|
1057 |
QByteArray array = QByteArray::fromBase64(str.toAscii()); |
|
1058 |
for (int i = 0; i < array.size(); i++) |
|
1059 |
array[i] = array[i] ^ 0xC4 ^ i; |
|
1060 |
return QString::fromUtf8(array); |
|
1061 |
} |
|
1062 |
||
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1063 |
void PageVideos::uploadToYouTube() |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1064 |
{ |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1065 |
int row = filesTable->currentRow(); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1066 |
VideoItem * item = nameItem(row); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1067 |
|
7507 | 1068 |
if (item->pUploading) |
1069 |
{ |
|
1070 |
if (QMessageBox::question(this, |
|
1071 |
tr("Are you sure?"), |
|
1072 |
tr("Do you really want do cancel uploading %1?").arg(item->name), |
|
1073 |
QMessageBox::Yes | QMessageBox::No) |
|
1074 |
!= QMessageBox::Yes) |
|
1075 |
return; |
|
1076 |
item->pUploading->deleteLater(); |
|
1077 |
filesTable->setCellWidget(row, vcProgress, NULL); // remove progress bar |
|
1078 |
numUploads--; |
|
1079 |
return; |
|
1080 |
} |
|
1081 |
||
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1082 |
if (!netManager) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1083 |
netManager = new QNetworkAccessManager(this); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1084 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1085 |
HWUploadVideoDialog* dlg = new HWUploadVideoDialog(this, item->name, netManager); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1086 |
dlg->deleteLater(); |
7507 | 1087 |
if (config->value("youtube/save").toBool()) |
1088 |
{ |
|
1089 |
dlg->cbSave->setChecked(true); |
|
1090 |
dlg->leAccount->setText(config->value("youtube/name").toString()); |
|
1091 |
dlg->lePassword->setText(unprotectPass(config->value("youtube/pswd").toString())); |
|
1092 |
} |
|
1093 |
||
1094 |
bool result = dlg->exec(); |
|
1095 |
||
1096 |
if (dlg->cbSave->isChecked()) |
|
1097 |
{ |
|
1098 |
config->setValue("youtube/save", true); |
|
1099 |
config->setValue("youtube/name", dlg->leAccount->text()); |
|
1100 |
config->setValue("youtube/pswd", protectPass(dlg->lePassword->text())); |
|
1101 |
} |
|
1102 |
else |
|
1103 |
{ |
|
1104 |
config->setValue("youtube/save", false); |
|
1105 |
config->setValue("youtube/name", ""); |
|
1106 |
config->setValue("youtube/pswd", ""); |
|
1107 |
} |
|
1108 |
||
1109 |
if (!result) |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1110 |
return; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1111 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1112 |
QNetworkRequest request(QUrl(dlg->location)); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1113 |
request.setRawHeader("Content-Type", "application/octet-stream"); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1114 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1115 |
QFile * file = new QFile(item->path(), this); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1116 |
if (!file->open(QIODevice::ReadOnly)) |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1117 |
return; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1118 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1119 |
// add progress bar |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1120 |
QProgressBar * progressBar = new QProgressBar(filesTable); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1121 |
progressBar->setMinimum(0); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1122 |
progressBar->setMaximum(10000); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1123 |
progressBar->setValue(0); |
7507 | 1124 |
// make it different from progress-bar used during encoding (use blue color) |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1125 |
progressBar->setStyleSheet("* {color: #00ccff; selection-background-color: #00ccff;}" ); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1126 |
filesTable->setCellWidget(row, vcProgress, progressBar); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1127 |
|
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1128 |
QNetworkReply* reply = netManager->put(request, file); |
7531
0adcad8714c4
improve html links + small bugfixes
Stepan777 <stepik-777@mail.ru>
parents:
7507
diff
changeset
|
1129 |
file->setParent(reply); // automatically close file when needed |
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1130 |
item->pUploading = reply; |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1131 |
connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(uploadProgress(qint64, qint64))); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1132 |
connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished())); |
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1133 |
numUploads++; |
7507 | 1134 |
|
1135 |
updateDescription(); |
|
7447
01111960a48d
uploading to youtube, it works, but user interface is still incomplete
Stepan777 <stepik-777@mail.ru>
parents:
7392
diff
changeset
|
1136 |
} |