Skip to content

Commit 754a5e3

Browse files
author
ThePBone
committed
Add legacy compatibility + setup CI deployment
1 parent 2bcb4b3 commit 754a5e3

File tree

11 files changed

+1302
-102
lines changed

11 files changed

+1302
-102
lines changed

.travis.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
language: cpp
2-
dist: trusty
2+
dist: bionic
3+
os: linux
34
compiler: g++
4-
sudo: required
5+
group: travis_latest
6+
addons:
7+
ssh_known_hosts: local.timschneeberger.me
58
env:
6-
- secure: "NMEKVXaMl6LhpJ6lW7jPGt9IxukC2mWCKE+ltEeE96+TZqHYQYiXBIbod8mNDi1IbKWsOMngQhmLdwojbYoVQsw4aGWbcBfWWkwURRnWvWybFkufQWHtOQ/Fh9tNai0fPkIqIRt8gdPyNIjTAkmaD6NEHtWiqWQYpv/FbS0rLIunSgecmNNLwDMxSEyZyUhWT3o1Dp4bjJvIITJOwPlZ4bB+Y9RrXerLGsMnN9jj5s21dwVsUwsWZoYEB0KPGXPTV2XXAvZtFDhU7leZwa4IpuBoKy4MYvRGSWAPYncBsFqLjCOvWacDtPyUs04oGFt4dybEGKc9AIERwdq9/G0ROBQcQk5HeMC9yzhW/BTQGDZ89/KYVhrYQv+8OCq6JvPePCYBO4jDhz1ODAdtnJQlon2B2Dz/sNPZX6FaG7Xc1s7++oun8ExxNuwI5jpFsBn4Vhko5x0QI8678OnUCodnaH2r+wlSj18iH5vLlNDBkuEiIHWjeFeJQMK0KBFWUiDlMy5NqBxeRABvk/3yinzBcJlbT4FE8NPUugnVtKJqlxMhHrkNEqIOO2wE1hMDp4i0+poFhxx4JmiDYvs5bvnTRg/WzxBBzkoHLlmRwXtjh79AelCgZ4704ShpxJwusoxv6/6KjNvdagN9qLAKWDYdSeFG912i24/2eWz1kp/4da8="
7-
9+
global:
10+
- base_version: 1.3
11+
- secure: MUZVB76DqKEtZB38CIM9qN6SnxCKeHWAIxcWBrHlsNfx3Cz0dfAWb0xCUX9v/yuupnoR9MKzppt0G02GCjtypS9VzZ6s0Xm1oYjA4OhLSAREJ+fqL8aYxh2G34k2ZLitMRAiZzlycGgOwltKXb8vX18UtKyY+9ml0tkvzN9Mv/7NyNYMPP5+ZJKLnXwoN5ygNQa2gq07zW80KkpJzlYQUaWtwcyEZyL2INBEt6zh5R/MMagH3apTHnaB2Y9ZMrfpH52VghEvZ0LoZlB/5UeXLgkByF8i9jJsALwAk185iufQkXGErAgLXWobdBvWrIXZVUT5I5nrgNdQjpuYOHGvkwa0V8aLWD2US975IGP6PY0aZDsRQ3dKvJRCM4bukqGXKkuFsBt9pH8ZtfUsfff4gkQLDe+VAiuaU810bG2uua1JrwTLDInxFXISkd5h2ZZeJ4QvA5mGhOKEI2CuQCB3nYHKQXPzFsC4uaTe7F/2fYOctlxvgLZ8Wxpi0yvBa1vMoQfPZplh+jJMwa139MqVRjoqhWJQvtLHCfr+iWlUlBbGu1QBgqseCpIb4BIrsAM2/KG090X3nEjXaIN79gjI7a8P/wXGni5lHOLG3WHIeYD4CiVhpcrhKcKaQHsUk1fRmc9yj/WIH2a3Sr/vX3de4vD680nX5p3njQvL/PzDKQQ=
812
before_install:
9-
- sudo add-apt-repository ppa:beineri/opt-qt595-trusty -y
10-
- sudo apt-get update
11-
12-
install:
13-
- sudo apt-get install qt59base qt59-meta-minimal libgl1-mesa-dev
14-
- source /opt/qt59/bin/qt59-env.sh
15-
16-
13+
- sudo apt-get update -qq
14+
- sudo apt-get install lftp
15+
- sudo apt-get install qtbase5-dev libqt5svg5-dev qt5-default qttools5-dev-tools qtmultimedia5-dev
1716
script:
18-
- /opt/qt59/bin/qmake PREFIX=/usr
19-
- make
20-
17+
- qmake V4L_Frontend.pro
18+
- make
19+
- chmod +x ./deployment/build_deb_package.sh
20+
- "./deployment/build_deb_package.sh"
2121
after_success:
22-
- curl -F file=@V4L_Frontend "https://nightly.thebone.cf/api/upload.php?key=$KEY&project=viper-gui"
22+
- for file in ./*.deb; do if [ -f "$file" ]; then export artifact=$file; break 1;
23+
fi; done;
24+
- echo $artifact
25+
- lftp -u pi,${SFTP_PWD} -e "set sftp:auto-confirm true;set ssl:check-hostname false;set
26+
ssl:verify-certificate false;put $artifact;quit" sftp://local.timschneeberger.me/disks/sandisk/www/nightly/vipergui-debian/

config/appconfigwrapper.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void AppConfigWrapper::loadAppConfig(){
2020
}
2121

2222
bool AppConfigWrapper::getAutoFx(){
23-
return appconf->getBool("apply.auto.enable");
23+
return appconf->getBool("apply.auto.enable", true, true);
2424
}
2525
void AppConfigWrapper::setAutoFx(bool afx){
2626
appconf->setValue("apply.auto.enable",QVariant(afx));
@@ -98,7 +98,7 @@ bool AppConfigWrapper::getWhiteIcons(){
9898
return appconf->getBool("theme.icons.white");
9999
}
100100
int AppConfigWrapper::getAutoFxMode(){
101-
return appconf->getInt("apply.auto.mode");
101+
return appconf->getInt("apply.auto.mode", 1);
102102
}
103103
void AppConfigWrapper::setAutoFxMode(int mode){
104104
appconf->setValue("apply.auto.mode",QVariant(mode));
@@ -199,7 +199,7 @@ bool AppConfigWrapper::getSpetrumGrid(){
199199
return appconf->getBool("visualizer.spectrum.grid");
200200
}
201201
int AppConfigWrapper::getSpectrumTheme(){
202-
return appconf->getInt("visualizer.spectrum.theme");
202+
return appconf->getInt("visualizer.spectrum.theme", 1);
203203
}
204204
void AppConfigWrapper::setSpectrumTheme(int number){
205205
appconf->setValue("visualizer.spectrum.theme",QVariant(number));
@@ -263,6 +263,13 @@ void AppConfigWrapper::setLegacyTabs(bool b){
263263
bool AppConfigWrapper::getLegacyTabs(){
264264
return appconf->getBool("theme.tab.legacy");
265265
}
266+
void AppConfigWrapper::setLegacyMode(bool b){
267+
appconf->setValue("app.legacymode",QVariant(b));
268+
saveAppConfig();
269+
}
270+
bool AppConfigWrapper::getLegacyMode(){
271+
return appconf->getBool("app.legacymode");
272+
}
266273
//--------
267274
QString AppConfigWrapper::getAppConfigFilePath(){
268275
return QString("%1/.config/viper4linux/ui.2.conf").arg(QDir::homePath());

config/appconfigwrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class AppConfigWrapper : public QObject
9494
int getSpectrumShape();
9595
bool getLegacyTabs();
9696
void setLegacyTabs(bool b);
97+
void setLegacyMode(bool b);
98+
bool getLegacyMode();
9799
signals:
98100
void spectrumChanged();
99101
void spectrumReloadRequired();

config/container.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ QString ConfigContainer::getString(const QString& key,bool setToDefaultIfMissing
2222
}
2323
return getVariant(key).toString();
2424
}
25-
int ConfigContainer::getInt(const QString& key){
25+
int ConfigContainer::getInt(const QString& key, int alternative){
2626
if(!map.contains(key)){
2727
qWarning().noquote().nospace() << "[W] Requested key '" << key << "' not found";
28-
map[key] = 0;
29-
return 0;
28+
map[key] = alternative;
29+
return alternative;
3030
}
3131
return getVariant(key).toInt();
3232
}
@@ -38,11 +38,11 @@ float ConfigContainer::getFloat(const QString& key){
3838
}
3939
return getVariant(key).toFloat();
4040
}
41-
bool ConfigContainer::getBool(const QString& key, bool setToDefaultIfMissing){
41+
bool ConfigContainer::getBool(const QString& key, bool setToDefaultIfMissing, bool alternative){
4242
if(!map.contains(key)){
4343
qWarning().noquote().nospace() << "[W] Requested key '" << key << "' not found";
44-
if(setToDefaultIfMissing)map[key] = false;
45-
return false;
44+
if(setToDefaultIfMissing)map[key] = alternative;
45+
return alternative;
4646
}
4747
return getVariant(key).toBool();
4848
}

config/container.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class ConfigContainer
2525
void setValue(const QString& key,QVariant value);
2626
QVariant getVariant(const QString& key);
2727
QString getString(const QString& key,bool setToDefaultIfMissing=true);
28-
int getInt(const QString& key);
28+
int getInt(const QString& key, int alternative = 0);
2929
float getFloat(const QString& key);
30-
bool getBool(const QString& key, bool setToDefaultIfMissing=true);
30+
bool getBool(const QString& key, bool setToDefaultIfMissing=true, bool alternative=false);
3131

3232
QVariantMap getConfigMap();
3333
void setConfigMap(const QVariantMap& newmap);

deployment/build_deb_package.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
#DEB build script for Travis-CI
3+
#V4L_Frontend binary needs to be in working directory
4+
5+
debname="viper4linux-gui_"$base_version"-build"$TRAVIS_BUILD_NUMBER
6+
echo $debname
7+
mkdir $debname
8+
mkdir $debname"/DEBIAN"
9+
mkdir -p $debname"/usr/bin"
10+
mkdir -p $debname"/usr/share/applications"
11+
mkdir -p $debname"/usr/share/pixmaps"
12+
cp "V4L_Frontend" $debname"/usr/bin/viper-gui"
13+
14+
cp "viper.png" $debname"/usr/share/pixmaps/viper-gui.png"
15+
cp "LICENSE" $debname"/DEBIAN"
16+
17+
cat <<EOT >> $debname"/usr/share/applications/viper-gui.desktop"
18+
[Desktop Entry]
19+
Name=Viper4Linux
20+
GenericName=Equalizer
21+
Comment=Official UI for Viper4Linux
22+
Keywords=equalizer
23+
Categories=AudioVideo;Audio;
24+
Exec=viper-gui
25+
Icon=/usr/share/pixmaps/viper-gui.png
26+
StartupNotify=false
27+
Terminal=false
28+
Type=Application
29+
EOT
30+
31+
cat <<EOT >> $debname"/DEBIAN/control"
32+
Package: viper4linux-gui
33+
Version: $base_version-$TRAVIS_BUILD_NUMBER
34+
Section: sound
35+
Priority: optional
36+
Architecture: amd64
37+
Depends: qtbase5-dev (>= 5.9.5), libqt5core5a (>= 5.9.5), libqt5widgets5 (>= 5.9.5), libqt5gui5 (>= 5.9.5), libqt5core5a (>= 5.9.5), libgl1-mesa-dev
38+
Maintainer: ThePBone <[email protected]>
39+
Description: Official UI for Viper4Linux
40+
Homepage: https://github.com/Audio4Linux/Viper4Linux-GUI
41+
EOT
42+
43+
dpkg-deb --build $debname

dialog/firstlaunchwizard.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,49 @@ FirstLaunchWizard::FirstLaunchWizard(AppConfigWrapper* _appconf, MainWindow* mai
2020

2121
appconf = _appconf;
2222

23+
ui->stackedWidget->setCurrentIndex(0);
24+
2325
QTimer::singleShot(1000, [&]{
2426
ui->p1_icon->startAnimation();
2527
});
28+
ui->p1dot5_icon->startAnimation();
2629
ui->p2_icon->startAnimation();
2730
ui->p3_icon->startAnimation();
2831
ui->p4_icon->startAnimation();
2932

30-
3133
ui->stackedWidget->setAnimation(QEasingCurve::Type::OutCirc);
3234
connect(ui->p1_next,&QPushButton::clicked,[&]{
3335
ui->stackedWidget->slideInIdx(1);
3436
});
35-
connect(ui->p2_next,&QPushButton::clicked,[&]{
37+
connect(ui->p1dot5_next,&QPushButton::clicked,[&]{
3638
ui->stackedWidget->slideInIdx(2);
3739
});
38-
connect(ui->p3_next,&QPushButton::clicked,[&]{
40+
connect(ui->p2_next,&QPushButton::clicked,[&]{
3941
ui->stackedWidget->slideInIdx(3);
4042
});
43+
connect(ui->p3_next,&QPushButton::clicked,[&]{
44+
ui->stackedWidget->slideInIdx(4);
45+
});
4146
connect(ui->p4_next,&QPushButton::clicked,[&]{
4247
emit wizardFinished();
4348
});
4449
connect(ui->p4_telegram,&QPushButton::clicked,[&]{
4550
QDesktopServices::openUrl(QUrl("https://t.me/joinchat/FTKC2A2bolHkFAyO-fuPjw"));
4651
});
4752

53+
ui->p1dot5_mode_legacy->setChecked(appconf->getLegacyMode());
54+
55+
auto legacy_radio = [this]{
56+
if(lockslot)return;
57+
int mode = 0;
58+
if(ui->p1dot5_mode_a4l->isChecked())mode=0;
59+
else if(ui->p1dot5_mode_legacy->isChecked())mode=1;
60+
appconf->setLegacyMode(mode);
61+
};
62+
63+
connect(ui->p1dot5_mode_a4l,&QRadioButton::clicked,this,legacy_radio);
64+
connect(ui->p1dot5_mode_legacy,&QRadioButton::clicked,this,legacy_radio);
65+
4866
auto deviceUpdated = [this](){
4967
if(lockslot) return;
5068
QString absolute =
@@ -64,7 +82,6 @@ FirstLaunchWizard::FirstLaunchWizard(AppConfigWrapper* _appconf, MainWindow* mai
6482
};
6583
refreshDevices();
6684

67-
6885
ui->p3_systray_disable->setChecked(!appconf->getTrayMode());
6986
ui->p3_systray_enable->setChecked(appconf->getTrayMode());
7087
ui->p3_systray_icon_box->setEnabled(appconf->getTrayMode());

0 commit comments

Comments
 (0)