1 /*qAllInOne is a free open-source software built using Qt to provide users an All-In-One media player, so it can view images, play videos and audio.
2 qAllInOne Copyright (C) 2013 Mahmoud Jaoune
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.*/
16 #ifndef MEDIATOOLBARS_H
17 #define MEDIATOOLBARS_H
20 #include <QPushButton>
21 #include <QMainWindow>
26 class ImageViewerToolBar
: public QWidget
31 QPushButton
* PrevButton
;
32 QPushButton
* NextButton
;
36 explicit ImageViewerToolBar(QWidget
* parent
)
43 Background
= new QLabel(this);
44 Background
->setGeometry(0,0,this->width(),this->height());
45 Background
->setStyleSheet("* { background-color: rgb(240, 240, 240); }");
47 PrevButton
= new QPushButton(this);
49 PrevButton
->setText("Prev");
50 PrevButton
->setGeometry(this->width() / 2 - 50 - (66/2),(this->height() / 2) - (25/2),66,25);
53 connect(PrevButton
,SIGNAL(clicked()),this->parent(),SLOT(PreviousImage()));
55 NextButton
= new QPushButton(this);
57 NextButton
->setText("Next");
58 NextButton
->setGeometry(this->width() / 2 + 50 - (66/2),(this->height() / 2) - (25/2),66,25);
61 connect(NextButton
,SIGNAL(clicked()),this->parent(),SLOT(NextImage()));
65 void RepositionObjects()
67 PrevButton
->setGeometry(this->width() / 2 - 50 - (66/2),(this->height() / 2) - (25/2),66,25);
68 NextButton
->setGeometry(this->width() / 2 + 50 - (66/2),(this->height() / 2) - (25/2),66,25);
69 Background
->setGeometry(0,0,this->width(),this->height());
76 class VideoToolBar
: public QWidget
81 QPushButton
* PlayButton
;
82 QPushButton
* StopButton
;
83 QPushButton
* PauseButton
;
85 QSlider
* VolumeSlider
;
88 QLabel
* ElapsedTimeLabel
;
89 QLabel
* TotalTimeLabel
;
93 explicit VideoToolBar(QWidget
* parent
)
100 Background
= new QLabel(this);
101 Background
->setGeometry(0,0,this->width(),this->height());
102 Background
->setStyleSheet("* { background-color: rgb(240, 240, 240); }");
104 PlayButton
= new QPushButton(this);
106 PlayButton
->setText("Play");
107 PlayButton
->setGeometry(10,(this->height() / 2) + 10 - (25/2),35,25);
110 connect(PlayButton
,SIGNAL(clicked()),this->parent(),SLOT(VPlayVideo()));
112 StopButton
= new QPushButton(this);
114 StopButton
->setText("Stop");
115 StopButton
->setGeometry(45,(this->height() / 2) + 10 - (25/2),35,25);
118 connect(StopButton
,SIGNAL(clicked()),this->parent(),SLOT(VStopVideo()));
120 PauseButton
= new QPushButton(this);
122 PauseButton
->setText("Pause");
123 PauseButton
->setGeometry(80,(this->height() / 2) + 10 - (25/2),35,25);
126 connect(PauseButton
,SIGNAL(clicked()),this->parent(),SLOT(VPauseVideo()));
128 ElapsedTimeLabel
= new QLabel(this);
129 ElapsedTimeLabel
->setGeometry(5,5,50,20);
130 ElapsedTimeLabel
->setAlignment(Qt::AlignHCenter
);
131 ElapsedTimeLabel
->show();
133 TotalTimeLabel
= new QLabel(this);
134 TotalTimeLabel
->setGeometry(5,5,35,20);
136 TimeSlider
= new QSlider(this);
137 TimeSlider
->setGeometry(ElapsedTimeLabel
->width() + 7,5,this->width() - ElapsedTimeLabel
->width() - 50 - 30,20);
139 TimeSlider
->setOrientation(Qt::Horizontal
);
141 connect(TimeSlider
,SIGNAL(sliderPressed()),this->parent(),SLOT(VpauseBeforeChangePosition()));
142 connect(TimeSlider
,SIGNAL(valueChanged(int)),this->parent(),SLOT(VchangePosition(int)));
143 connect(TimeSlider
,SIGNAL(sliderReleased()),this->parent(),SLOT(VplayAfterChangePosition()));
145 TotalTimeLabel
->setGeometry(this->width() - 65,5,35,20);
146 TotalTimeLabel
->show();
147 TotalTimeLabel
->setAlignment(Qt::AlignHCenter
);
149 VolumeLabel
= new QLabel(this);
150 VolumeLabel
->setGeometry(this->width() - 45,StopButton
->y(),35,20);
152 VolumeLabel
->setAlignment(Qt::AlignHCenter
);
154 VolumeSlider
= new QSlider(this);
155 VolumeSlider
->setGeometry(this->width() - 65 - 45,StopButton
->y(),60,20);
156 VolumeSlider
->show();
157 VolumeSlider
->setOrientation(Qt::Horizontal
);
159 connect(VolumeSlider
,SIGNAL(valueChanged(int)),this->parent(),SLOT(VchangeVolume(int)));
163 void RepositionObjects()
165 PlayButton
->setGeometry(10,(this->height() / 2) + 10 - (25/2),35,25);
166 StopButton
->setGeometry(45,(this->height() / 2) + 10 - (25/2),35,25);
167 PauseButton
->setGeometry(80,(this->height() / 2) + 10 - (25/2),35,25);
168 ElapsedTimeLabel
->setGeometry(5,5,35,20);
169 TimeSlider
->setGeometry(ElapsedTimeLabel
->width() + 7,5,this->width() - ElapsedTimeLabel
->width() - 50 - 30,20);
170 TotalTimeLabel
->setGeometry(this->width() - 65,5,35,20);
171 VolumeLabel
->setGeometry(this->width() - 45,StopButton
->y(),35,20);
172 VolumeSlider
->setGeometry(this->width() - 65 - 45,StopButton
->y(),60,20);
173 Background
->setGeometry(0,0,this->width(),this->height());
179 class AudioToolBar
: public QWidget
184 QPushButton
* PlayButton
;
185 QPushButton
* StopButton
;
186 QPushButton
* PauseButton
;
187 QSlider
* TimeSlider
;
188 QSlider
* VolumeSlider
;
191 QLabel
* ElapsedTimeLabel
;
192 QLabel
* TotalTimeLabel
;
193 QLabel
* VolumeLabel
;
196 explicit AudioToolBar(QWidget
* parent
)
203 Background
= new QLabel(this);
204 Background
->setGeometry(0,0,this->width(),this->height());
205 Background
->setStyleSheet("* { background-color: rgb(240, 240, 240); }");
207 PlayButton
= new QPushButton(this);
209 PlayButton
->setText("Play");
210 PlayButton
->setGeometry(10,(this->height() / 2) + 10 - (25/2),35,25);
213 connect(PlayButton
,SIGNAL(clicked()),this->parent(),SLOT(APlayVideo()));
215 StopButton
= new QPushButton(this);
217 StopButton
->setText("Stop");
218 StopButton
->setGeometry(45,(this->height() / 2) + 10 - (25/2),35,25);
221 connect(StopButton
,SIGNAL(clicked()),this->parent(),SLOT(AStopVideo()));
223 PauseButton
= new QPushButton(this);
225 PauseButton
->setText("Pause");
226 PauseButton
->setGeometry(80,(this->height() / 2) + 10 - (25/2),35,25);
229 connect(PauseButton
,SIGNAL(clicked()),this->parent(),SLOT(APauseVideo()));
231 ElapsedTimeLabel
= new QLabel(this);
232 ElapsedTimeLabel
->setGeometry(5,5,50,20);
233 ElapsedTimeLabel
->setAlignment(Qt::AlignHCenter
);
234 ElapsedTimeLabel
->show();
236 TotalTimeLabel
= new QLabel(this);
237 TotalTimeLabel
->setGeometry(5,5,35,20);
239 TimeSlider
= new QSlider(this);
240 TimeSlider
->setGeometry(ElapsedTimeLabel
->width() + 7,5,this->width() - ElapsedTimeLabel
->width() - 50 - 30,20);
242 TimeSlider
->setOrientation(Qt::Horizontal
);
244 connect(TimeSlider
,SIGNAL(sliderPressed()),this->parent(),SLOT(ApauseBeforeChangePosition()));
245 connect(TimeSlider
,SIGNAL(valueChanged(int)),this->parent(),SLOT(AchangePosition(int)));
246 connect(TimeSlider
,SIGNAL(sliderReleased()),this->parent(),SLOT(AplayAfterChangePosition()));
248 TotalTimeLabel
->setGeometry(this->width() - 65,5,35,20);
249 TotalTimeLabel
->show();
250 TotalTimeLabel
->setAlignment(Qt::AlignHCenter
);
252 VolumeLabel
= new QLabel(this);
253 VolumeLabel
->setGeometry(this->width() - 45,StopButton
->y(),35,20);
255 VolumeLabel
->setAlignment(Qt::AlignHCenter
);
257 VolumeSlider
= new QSlider(this);
258 VolumeSlider
->setGeometry(this->width() - 65 - 45,StopButton
->y(),60,20);
259 VolumeSlider
->show();
260 VolumeSlider
->setOrientation(Qt::Horizontal
);
262 connect(VolumeSlider
,SIGNAL(valueChanged(int)),this->parent(),SLOT(AchangeVolume(int)));
266 void RepositionObjects()
268 PlayButton
->setGeometry(10,(this->height() / 2) + 10 - (25/2),35,25);
269 StopButton
->setGeometry(45,(this->height() / 2) + 10 - (25/2),35,25);
270 PauseButton
->setGeometry(80,(this->height() / 2) + 10 - (25/2),35,25);
271 ElapsedTimeLabel
->setGeometry(5,5,35,20);
272 TimeSlider
->setGeometry(ElapsedTimeLabel
->width() + 7,5,this->width() - ElapsedTimeLabel
->width() - 50 - 30,20);
273 TotalTimeLabel
->setGeometry(this->width() - 65,5,35,20);
274 VolumeLabel
->setGeometry(this->width() - 45,StopButton
->y(),35,20);
275 VolumeSlider
->setGeometry(this->width() - 65 - 45,StopButton
->y(),60,20);
276 Background
->setGeometry(0,0,this->width(),this->height());
282 #endif // MEDIATOOLBARS_H