-
Notifications
You must be signed in to change notification settings - Fork 0
/
seniorproject.cpp
124 lines (112 loc) · 4.57 KB
/
seniorproject.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/***********************************************************************************
** This file is part of Senior Project Launcher.
**
** Senior Project Launcher is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation, either version 2.1 of the License, or
** (at your option) any later version.
**
** Senior Project Launcher is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with Senior Project Launcher. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************************/
#include "fvupdater.h"
#include "seniorproject.h"
#include "ui_seniorproject.h"
#include "animation.cpp"
#include "window.cpp"
#include "options.cpp"
#include "run_programs.cpp"
#include "program_buttons.cpp"
#include "webbrowser.cpp"
#include "videoplayer_controls.cpp"
#include "theming.cpp"
#include <QtDebug>
#include <QSettings>
#include <qmediaplayer.h>
#include <qvideowidget.h>
SeniorProject::SeniorProject(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::SeniorProject)
{
ui->setupUi(this);
ui->Run->hide();
ui->controlLayout->hide();
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
//Create Media Player
mediaPlayer = new QMediaPlayer(this,QMediaPlayer::VideoSurface);
QVideoWidget *videoWidget = new QVideoWidget;
videoWidget->setUpdatesEnabled(false);
videoWidget->showMinimized(); //show
videoWidget->hide();
ui->playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
ui->volumeButton->setIcon
(style()->standardIcon(QStyle::SP_MediaVolume));
ui->positionSlider->setRange(0, 0);
mediaPlayer->setVideoOutput(videoWidget);
ui->Information->addTab(videoWidget, tr("Video")); //hide
videoWidget->setAspectRatioMode(Qt::IgnoreAspectRatio);
connect(mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
connect(ui->positionSlider, SIGNAL(sliderMoved(int)),
this, SLOT(setPosition(int)));
connect(mediaPlayer, SIGNAL(positionChanged(qint64)),
this, SLOT(positionChanged(qint64)));
connect(mediaPlayer, SIGNAL(durationChanged(qint64)),
this, SLOT(durationChanged(qint64)));
qDebug() << mediaPlayer->error();
changevid = true;
//Setup moving window
isDragging = false;
//Give installed_themes a number before loading
installed_themes = 0;
//Give Main Windows Values
winw = 775;
winh = 500;
winx = 0;
winy = 20;
//Set Settings
QSettings settings(QSettings::NativeFormat,
QSettings::UserScope,
QApplication::organizationName(),
QApplication::applicationName());
//Load/Set the current language setting
language = settings.value("Language").toString();
qDebug() << "lang =" << language;
ui->Language_box->setCurrentText(language); //Set language to selected language
qDebug() << settings.value("Language").toString();
//Set to current theme and receive themes from themese folder
loadthemes();
ui->Theme_box->setCurrentText(settings.value("CurrentTheme").toString());
if (ui->Theme_box->currentText() == "< default theme >")
themer("default");
//Enable/Disable UpdateOnStart
if (settings.value("UpdateOnStart").toBool())
ui->checkForUpdatesOnStart->setCheckState(Qt::Checked);
//If the program window has been moved, move it to that position
if (settings.contains("WinPos"))
move(settings.value("WinPos").toPoint());
qDebug() << "Current Pos:";
qDebug() << pos();
qDebug() << "Saved Pos= " + settings.value("WinPos").toString();
update();
qDebug() << winw << winh;
}
SeniorProject::~SeniorProject()
{
QSettings settings(QSettings::NativeFormat,
QSettings::UserScope,
QApplication::organizationName(),
QApplication::applicationName());
if (settings.value("WinPos").toPoint() != pos())
{
settings.setValue("WinPos", pos());
settings.sync();
qDebug() << "settings" << settings.value("WinPos").toPoint();
}
delete ui;
}