mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-14 01:30:49 +00:00
Merge branch 'master' into translations
This commit is contained in:
commit
fffa7a1383
28
Building/Linux/copyright
Normal file
28
Building/Linux/copyright
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: OSCAR
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2011-2018 Mark Watkins
|
||||||
|
2019-2020 The OSCAR Team
|
||||||
|
License: GPL-3+
|
||||||
|
This program is free software; you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
.
|
||||||
|
This program 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 General Public License for more
|
||||||
|
details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU General Public
|
||||||
|
License along with this package; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301 USA
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU General Public
|
||||||
|
License version 3 can be found in the file
|
||||||
|
`/usr/share/common-licenses/GPL-3'.
|
||||||
|
|
@ -36,11 +36,13 @@ echo Version: ${VERSION}
|
|||||||
|
|
||||||
# application name
|
# application name
|
||||||
appli_name="OSCAR"
|
appli_name="OSCAR"
|
||||||
|
package_name="oscar"
|
||||||
pre_inst="tst_user.sh"
|
pre_inst="tst_user.sh"
|
||||||
# build folder (absolute path is better)
|
# build folder (absolute path is better)
|
||||||
build_folder="/home/$USER/OSCAR/build"
|
build_folder="/home/$USER/OSCAR/build"
|
||||||
if [[ -n ${PRERELEASE} && -z ${RC} ]] ; then
|
if [[ -n ${PRERELEASE} && -z ${RC} ]] ; then
|
||||||
appli_name=${appli_name}-test
|
appli_name=${appli_name}-test
|
||||||
|
package_name=${package_name}-test
|
||||||
post_inst="ln_usrbin-test.sh"
|
post_inst="ln_usrbin-test.sh"
|
||||||
pre_rem="rm_usrbin-test.sh"
|
pre_rem="rm_usrbin-test.sh"
|
||||||
post_rem="clean_rm-test.sh"
|
post_rem="clean_rm-test.sh"
|
||||||
@ -98,7 +100,7 @@ mkdir ${temp_folder}/bin
|
|||||||
mkdir ${temp_folder}/share
|
mkdir ${temp_folder}/share
|
||||||
mkdir ${temp_folder}/share/${appli_name}
|
mkdir ${temp_folder}/share/${appli_name}
|
||||||
mkdir ${temp_folder}/share/doc
|
mkdir ${temp_folder}/share/doc
|
||||||
share_doc_folder="${temp_folder}/share/doc/${appli_name}"
|
share_doc_folder="${temp_folder}/share/doc/${package_name}"
|
||||||
mkdir ${share_doc_folder}
|
mkdir ${share_doc_folder}
|
||||||
mkdir ${temp_folder}/share/icons
|
mkdir ${temp_folder}/share/icons
|
||||||
mkdir ${temp_folder}/share/icons/hicolor
|
mkdir ${temp_folder}/share/icons/hicolor
|
||||||
@ -121,22 +123,29 @@ cp ./${appli_name}.png ${temp_folder}/share/icons/hicolor/48x48/apps/${appli_nam
|
|||||||
cp ./${appli_name}.svg ${temp_folder}/share/icons/hicolor/scalable/apps/${appli_name}.svg
|
cp ./${appli_name}.svg ${temp_folder}/share/icons/hicolor/scalable/apps/${appli_name}.svg
|
||||||
cp ./${appli_name}.desktop ${temp_folder}/share/applications/${appli_name}.desktop
|
cp ./${appli_name}.desktop ${temp_folder}/share/applications/${appli_name}.desktop
|
||||||
|
|
||||||
echo "Copyright 2019-2020 oscar-team.org <oscar@oscar-team.org>" > $share_doc_folder/copyright
|
#echo "Copyright 2019-2020 oscar-team.org <oscar@oscar-team.org>" > $share_doc_folder/copyright
|
||||||
|
#echo "Licensed under /usr/share/common-licenses/GPL-3" >> $share_doc_folder/copyright
|
||||||
|
cp ./copyright $share_doc_folder/copyright
|
||||||
|
|
||||||
changelog_file="$share_doc_folder/changelog"
|
changelog_file="./changelog"
|
||||||
|
|
||||||
#automatic changelog as a bad name
|
#automatic changelog as a bad name
|
||||||
# need to generate one and say fpm to use it instead of create one
|
# need to generate one and say fpm to use it instead of create one
|
||||||
# it seems that it needs both of them...
|
# it seems that it needs both of them...
|
||||||
|
|
||||||
# creation of the changelog.Debian.gz
|
# creation of the Debian changelog
|
||||||
echo "$appli_name (${VERSION}-${ITERATION}) whatever; urgency=medium" > $changelog_file
|
echo "$appli_name (${VERSION}-${ITERATION}) whatever; urgency=medium" > $changelog_file
|
||||||
echo "" >> $changelog_file
|
echo "" >> $changelog_file
|
||||||
echo " * Package created with FPM." >> $changelog_file
|
echo " * Package created with FPM." >> $changelog_file
|
||||||
echo "" >> $changelog_file
|
echo "" >> $changelog_file
|
||||||
echo " -- oscar-team.org <oscar@oscar-team.org>" >> $changelog_file
|
echo " * See the Release Notes under Help/About menu" >> $changelog_file
|
||||||
gzip --best $changelog_file
|
echo "" >> $changelog_file
|
||||||
description='Open Source CPAP Analysis Reporter\n<extended description needed to be filled with the right value>'
|
echo -n " -- oscar-team.org <oscar@oscar-team.org> " >> $changelog_file
|
||||||
|
date -Iminutes >> $changelog_file
|
||||||
|
cp $changelog_file $share_doc_folder/changelog
|
||||||
|
gzip --best $share_doc_folder/changelog
|
||||||
|
|
||||||
|
description='Open Source CPAP Analysis Reporter\nProvides graphical and statistical display of the CPAP stored data'
|
||||||
# trick for dummies : need to use echo -e to take care of \n (cariage return to slip description and extra one
|
# trick for dummies : need to use echo -e to take care of \n (cariage return to slip description and extra one
|
||||||
description=$(echo -e $description)
|
description=$(echo -e $description)
|
||||||
|
|
||||||
@ -154,7 +163,6 @@ fpm --input-type dir --output-type deb \
|
|||||||
--category misc \
|
--category misc \
|
||||||
--deb-priority optional \
|
--deb-priority optional \
|
||||||
--maintainer " -- oscar-team.org <oscar@oscar-team.org>" \
|
--maintainer " -- oscar-team.org <oscar@oscar-team.org>" \
|
||||||
--license GPL-v3 \
|
|
||||||
--vendor oscar-team.org \
|
--vendor oscar-team.org \
|
||||||
--description "$description" \
|
--description "$description" \
|
||||||
--url https://sleepfiles.com/OSCAR \
|
--url https://sleepfiles.com/OSCAR \
|
||||||
@ -162,7 +170,7 @@ fpm --input-type dir --output-type deb \
|
|||||||
--depends $dblPkg \
|
--depends $dblPkg \
|
||||||
--depends libpcre16-3 \
|
--depends libpcre16-3 \
|
||||||
--depends qttranslations5-l10n \
|
--depends qttranslations5-l10n \
|
||||||
--depends "libqt5core5a > $qtver" \
|
--depends "libqt5core5a > 5.9" \
|
||||||
--depends libqt5serialport5 \
|
--depends libqt5serialport5 \
|
||||||
--depends libqt5xml5 \
|
--depends libqt5xml5 \
|
||||||
--depends libqt5network5 \
|
--depends libqt5network5 \
|
||||||
|
@ -37,6 +37,4 @@ if [ -f "$file" ]; then
|
|||||||
rm $file
|
rm $file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x /usr/bin/update-menus ]; then update-menus; fi
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,5 @@ if [ -f "$file" ]; then
|
|||||||
rm $file
|
rm $file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x /usr/bin/update-menus ]; then update-menus; fi
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
#set -e
|
set -e
|
||||||
#
|
#
|
||||||
#test USER (must be root) vs SUDO_USER (must be other than root but not empty)
|
#test USER (must be root) vs SUDO_USER (must be other than root but not empty)
|
||||||
#if [ "$USER" != "root" ] || [ "$SUDO_USER" = "root" ] || [ -z "$SUDO_USER" ]; then
|
if [ "$USER" != "root" ] || [ "$SUDO_USER" = "root" ] || [ -z "$SUDO_USER" ]; then
|
||||||
# echo "dpkg -i must be launched as normal user with sudo command. fatal error"
|
echo "Installation must be done as normal user with sudo command. fatal error"
|
||||||
# exit
|
exit
|
||||||
#fi
|
fi
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
|
@ -8,10 +8,27 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
|
<<<<<<< HEAD
|
||||||
<b>For other languages, go to:</b>
|
<b>For other languages, go to:</b>
|
||||||
<br>http://www.apneaboard.com/wiki/index.php/OSCAR_Release_Notes</p>
|
<br>http://www.apneaboard.com/wiki/index.php/OSCAR_Release_Notes</p>
|
||||||
<p>
|
<p>
|
||||||
<b>Changes and fixes in OSCAR v1.2.0</b>
|
<b>Changes and fixes in OSCAR v1.2.0</b>
|
||||||
|
=======
|
||||||
|
<b>Changes and fixes in OSCAR v1.2.0-beta-2</b>
|
||||||
|
<br>Portions of OSCAR are © 2019-2020 by
|
||||||
|
<i>The OSCAR Team</i></p>
|
||||||
|
<ul>
|
||||||
|
<li>[fix] Support migration from both SleepyHead and OSCAR.</li>
|
||||||
|
<li>[fix] Correct 95th percentile computations on Statistics page when some days were summary-only.</li>
|
||||||
|
<li>[fix] Improve some prompts and tooltip messages.</li>
|
||||||
|
<li>[fix] Improve support of rare Philips Respironics 950P events and update warnings.</li>
|
||||||
|
<li>[fix] Empty directories in Profiles directory are not shown in Profiles list.</li>
|
||||||
|
<li>[fix] Show correct copyright when installing Debian version.</li>
|
||||||
|
<li>[fix] Improvements to Chromebook identification.</li>
|
||||||
|
</ul></p>
|
||||||
|
<p>
|
||||||
|
<b>Changes and fixes in OSCAR v1.2.0-beta-1</b>
|
||||||
|
>>>>>>> e39adbd41ec60e2787e34a840afdfa1114baba19
|
||||||
<br>Portions of OSCAR are © 2019-2020 by
|
<br>Portions of OSCAR are © 2019-2020 by
|
||||||
<i>The OSCAR Team</i></p> <ul>
|
<i>The OSCAR Team</i></p> <ul>
|
||||||
<li>[new] Support for Chromebooks using Linux beta - (Intel/AMD only)</li>
|
<li>[new] Support for Chromebooks using Linux beta - (Intel/AMD only)</li>
|
||||||
|
@ -1147,6 +1147,9 @@ void Scan()
|
|||||||
// Iterate through subdirectories and load profiles..
|
// Iterate through subdirectories and load profiles..
|
||||||
for (auto & fi : list) {
|
for (auto & fi : list) {
|
||||||
QString npath = fi.canonicalFilePath();
|
QString npath = fi.canonicalFilePath();
|
||||||
|
QDir profilePath(npath);
|
||||||
|
if (profilePath.isEmpty()) // skip any empty folders
|
||||||
|
continue;
|
||||||
Profile *prof = new Profile(npath);
|
Profile *prof = new Profile(npath);
|
||||||
//prof->Open();
|
//prof->Open();
|
||||||
|
|
||||||
@ -1724,17 +1727,18 @@ EventDataType Profile::calcPercentile(ChannelID code, EventDataType percent, Mac
|
|||||||
|
|
||||||
qint64 SN = 0;
|
qint64 SN = 0;
|
||||||
bool timeweight;
|
bool timeweight;
|
||||||
bool summaryOnly = false;
|
bool summaryOnly = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Day *day = GetGoodDay(date, mt);
|
Day *day = GetGoodDay(date, mt);
|
||||||
|
|
||||||
if (day) {
|
if (day) {
|
||||||
if (day->summaryOnly()) {
|
if (day->summaryOnly()) {
|
||||||
summaryOnly = true;
|
date = date.addDays(1);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summaryOnly = false;
|
||||||
|
|
||||||
// why was this nested like this???
|
// why was this nested like this???
|
||||||
//for (int i = 0; i < day->size(); i++) {
|
//for (int i = 0; i < day->size(); i++) {
|
||||||
for (auto & sess : day->sessions) {
|
for (auto & sess : day->sessions) {
|
||||||
|
@ -340,8 +340,8 @@ void init()
|
|||||||
// <channel id="0x111e" class="data" name="TestChan1" details="Debugging Channel #1" label="Test #1" unit="" color="pink"/>
|
// <channel id="0x111e" class="data" name="TestChan1" details="Debugging Channel #1" label="Test #1" unit="" color="pink"/>
|
||||||
// <channel id="0x111f" class="data" name="TestChan2" details="Debugging Channel #2" label="Test #2" unit="" color="blue"/>
|
// <channel id="0x111f" class="data" name="TestChan2" details="Debugging Channel #2" label="Test #2" unit="" color="blue"/>
|
||||||
|
|
||||||
schema::channel.add(GRP_CPAP, ch=new Channel(CPAP_Test1 = 0x111e, DATA, MT_CPAP, SESSION, STR_GRAPH_TestChan1, QObject::tr("Debugging channel #1"), QObject::tr("Top secret internal stuff you're not supposed to see ;)"), QObject::tr("Test #1"), QString(), INTEGER, QColor("pink")));
|
schema::channel.add(GRP_CPAP, ch=new Channel(CPAP_Test1 = 0x111e, DATA, MT_CPAP, SESSION, STR_GRAPH_TestChan1, QObject::tr("Debugging channel #1"), QObject::tr("For internal use only"), QObject::tr("Test #1"), QString(), INTEGER, QColor("pink")));
|
||||||
schema::channel.add(GRP_CPAP, ch=new Channel(CPAP_Test2 = 0x111f, DATA, MT_CPAP, SESSION, STR_GRAPH_TestChan2, QObject::tr("Debugging channel #2"), QObject::tr("Top secret internal stuff you're not supposed to see ;)"), QObject::tr("Test #2"), QString(), INTEGER, Qt::blue));
|
schema::channel.add(GRP_CPAP, ch=new Channel(CPAP_Test2 = 0x111f, DATA, MT_CPAP, SESSION, STR_GRAPH_TestChan2, QObject::tr("Debugging channel #2"), QObject::tr("For internal use only"), QObject::tr("Test #2"), QString(), INTEGER, Qt::blue));
|
||||||
|
|
||||||
RMS9_E01 = schema::channel["RMS9_E01"].id();
|
RMS9_E01 = schema::channel["RMS9_E01"].id();
|
||||||
RMS9_E02 = schema::channel["RMS9_E02"].id();
|
RMS9_E02 = schema::channel["RMS9_E02"].id();
|
||||||
|
@ -120,9 +120,12 @@ bool processPreferenceFile( QString path ) {
|
|||||||
tmp.open(QIODevice::WriteOnly);
|
tmp.open(QIODevice::WriteOnly);
|
||||||
QTextStream instr(&fl);
|
QTextStream instr(&fl);
|
||||||
QTextStream outstr(&tmp);
|
QTextStream outstr(&tmp);
|
||||||
|
bool isSleepyHead = false;
|
||||||
while (instr.readLineInto(&line)) {
|
while (instr.readLineInto(&line)) {
|
||||||
|
if (line.contains("<SleepyHead>")) // Is this SleepyHead or OSCAR preferences file?
|
||||||
|
isSleepyHead = true;
|
||||||
line.replace("SleepyHead","OSCAR");
|
line.replace("SleepyHead","OSCAR");
|
||||||
if (line.contains("VersionString")) {
|
if (isSleepyHead && line.contains("VersionString")) {
|
||||||
int rtAngle = line.indexOf(">", 0);
|
int rtAngle = line.indexOf(">", 0);
|
||||||
int lfAngle = line.indexOf("<", rtAngle);
|
int lfAngle = line.indexOf("<", rtAngle);
|
||||||
line.replace(rtAngle+1, lfAngle-rtAngle-1, "1.0.0-beta");
|
line.replace(rtAngle+1, lfAngle-rtAngle-1, "1.0.0-beta");
|
||||||
@ -185,7 +188,7 @@ bool migrateFromSH(QString destDir) {
|
|||||||
|
|
||||||
while (selectingFolder) {
|
while (selectingFolder) {
|
||||||
datadir = QFileDialog::getExistingDirectory(nullptr,
|
datadir = QFileDialog::getExistingDirectory(nullptr,
|
||||||
QObject::tr("Choose the SleepyHead data folder to migrate")+" "+
|
QObject::tr("Choose the SleepyHead or OSCAR data folder to migrate")+" "+
|
||||||
QObject::tr("or CANCEL to skip migration."),
|
QObject::tr("or CANCEL to skip migration."),
|
||||||
homeDocs, QFileDialog::ShowDirsOnly);
|
homeDocs, QFileDialog::ShowDirsOnly);
|
||||||
qDebug() << "Migration folder selected: " + datadir;
|
qDebug() << "Migration folder selected: " + datadir;
|
||||||
@ -200,7 +203,7 @@ bool migrateFromSH(QString destDir) {
|
|||||||
if (!file.exists() || !dirP.exists()) { // It doesn't have a Preferences.xml file or a Profiles directory in it
|
if (!file.exists() || !dirP.exists()) { // It doesn't have a Preferences.xml file or a Profiles directory in it
|
||||||
// Not a new directory.. nag the user.
|
// Not a new directory.. nag the user.
|
||||||
QMessageBox::warning(nullptr, STR_MessageBox_Error,
|
QMessageBox::warning(nullptr, STR_MessageBox_Error,
|
||||||
QObject::tr("The folder you chose does not contain valid SleepyHead data.") +
|
QObject::tr("The folder you chose does not contain valid SleepyHead or OSCAR data.") +
|
||||||
"\n\n"+QObject::tr("You cannot use this folder:")+" " + datadir,
|
"\n\n"+QObject::tr("You cannot use this folder:")+" " + datadir,
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
continue; // Nope, don't use it, go around the loop again
|
continue; // Nope, don't use it, go around the loop again
|
||||||
@ -486,7 +489,8 @@ int main(int argc, char *argv[]) {
|
|||||||
if ( ! force_data_dir ) { // unless they explicitly selected it by --datadir param
|
if ( ! force_data_dir ) { // unless they explicitly selected it by --datadir param
|
||||||
if (QMessageBox::question(nullptr, STR_MessageBox_Question,
|
if (QMessageBox::question(nullptr, STR_MessageBox_Question,
|
||||||
QObject::tr("OSCAR will set up a folder for your data.")+"\n"+
|
QObject::tr("OSCAR will set up a folder for your data.")+"\n"+
|
||||||
QObject::tr("If you have been using SleepyHead, OSCAR can copy your old data to this folder later.")+"\n"+
|
QObject::tr("If you have been using SleepyHead or an older version of OSCAR,") + "\n" +
|
||||||
|
QObject::tr("OSCAR can copy your old data to this folder later.")+"\n"+
|
||||||
QObject::tr("We suggest you use this folder: ")+QDir::toNativeSeparators(GetAppData())+"\n"+
|
QObject::tr("We suggest you use this folder: ")+QDir::toNativeSeparators(GetAppData())+"\n"+
|
||||||
QObject::tr("Click Ok to accept this, or No if you want to use a different folder."),
|
QObject::tr("Click Ok to accept this, or No if you want to use a different folder."),
|
||||||
QMessageBox::Ok | QMessageBox::No, QMessageBox::Ok) == QMessageBox::No) {
|
QMessageBox::Ok | QMessageBox::No, QMessageBox::Ok) == QMessageBox::No) {
|
||||||
@ -539,9 +543,9 @@ int main(int argc, char *argv[]) {
|
|||||||
#else
|
#else
|
||||||
if ( ! newDir.exists() || newDir.isEmpty() ) { // directory doesn't exist yet or is empty, try to migrate old data
|
if ( ! newDir.exists() || newDir.isEmpty() ) { // directory doesn't exist yet or is empty, try to migrate old data
|
||||||
#endif
|
#endif
|
||||||
if (QMessageBox::question(nullptr, QObject::tr("Migrate SleepyHead Data?"),
|
if (QMessageBox::question(nullptr, QObject::tr("Migrate SleepyHead or OSCAR Data?"),
|
||||||
QObject::tr("On the next screen OSCAR will ask you to select a folder with SleepyHead data") +"\n" +
|
QObject::tr("On the next screen OSCAR will ask you to select a folder with SleepyHead or OSCAR data") +"\n" +
|
||||||
QObject::tr("Click [OK] to go to the next screen or [No] if you do not wish to use any SleepyHead data."),
|
QObject::tr("Click [OK] to go to the next screen or [No] if you do not wish to use any SleepyHead or OSCAR data."),
|
||||||
QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok) == QMessageBox::Ok) {
|
QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok) == QMessageBox::Ok) {
|
||||||
migrateFromSH( GetAppData() ); // doesn't matter if no migration
|
migrateFromSH( GetAppData() ); // doesn't matter if no migration
|
||||||
}
|
}
|
||||||
|
@ -811,14 +811,17 @@ void MainWindow::importCPAPBackups()
|
|||||||
QStringList getDriveList()
|
QStringList getDriveList()
|
||||||
{
|
{
|
||||||
QStringList drivelist;
|
QStringList drivelist;
|
||||||
|
bool crostini_detected = false;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
#define VFAT "vfat"
|
#define VFAT "vfat"
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
#define VFAT "FAT32"
|
#define VFAT "FAT32"
|
||||||
|
Q_UNUSED(crostini_detected)
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
#define VFAT "msdos"
|
#define VFAT "msdos"
|
||||||
|
Q_UNUSED(crostini_detected)
|
||||||
#endif
|
#endif
|
||||||
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
|
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
|
||||||
if (storage.isValid() && storage.isReady()) {
|
if (storage.isValid() && storage.isReady()) {
|
||||||
@ -833,11 +836,15 @@ QStringList getDriveList()
|
|||||||
if (storage.fileSystemType() == VFAT) {
|
if (storage.fileSystemType() == VFAT) {
|
||||||
qDebug() << "Adding" << storage.name() << "on" << storage.rootPath() << "to drivelist";
|
qDebug() << "Adding" << storage.name() << "on" << storage.rootPath() << "to drivelist";
|
||||||
drivelist.append(storage.rootPath());
|
drivelist.append(storage.rootPath());
|
||||||
|
} else if (storage.fileSystemType() == "9p") {
|
||||||
|
qDebug() << "Crostini filesystem 9p found";
|
||||||
|
crostini_detected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
|
if (crostini_detected) {
|
||||||
QString mntName("/mnt/chromeos/removable");
|
QString mntName("/mnt/chromeos/removable");
|
||||||
QDir mnt(mntName);
|
QDir mnt(mntName);
|
||||||
qDebug() << "Checking for" << mntName;
|
qDebug() << "Checking for" << mntName;
|
||||||
@ -848,6 +855,13 @@ QStringList getDriveList()
|
|||||||
qDebug() << "Adding" << dir.filePath() << "to drivelist";
|
qDebug() << "Adding" << dir.filePath() << "to drivelist";
|
||||||
drivelist.append(dir.filePath() );
|
drivelist.append(dir.filePath() );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(nullptr, STR_MessageBox_Warning,
|
||||||
|
QObject::tr("Chromebook file system detected, but no removable device found\n") +
|
||||||
|
QObject::tr("You must share your SD card with Linux using the ChromeOS Files program"));
|
||||||
|
drivelist.clear();
|
||||||
|
drivelist.append("CROSTINI");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return drivelist;
|
return drivelist;
|
||||||
@ -903,6 +917,8 @@ QList<ImportPath> MainWindow::detectCPAPCards()
|
|||||||
do {
|
do {
|
||||||
// Rescan in case card inserted
|
// Rescan in case card inserted
|
||||||
QStringList AutoScannerPaths = getDriveList();
|
QStringList AutoScannerPaths = getDriveList();
|
||||||
|
if (AutoScannerPaths.contains("CROSTINI")) // no Crostini removable drives found!
|
||||||
|
break; // break out of the 20 second wait loop
|
||||||
// AutoScannerPaths.push_back(lastpath);
|
// AutoScannerPaths.push_back(lastpath);
|
||||||
qDebug() << "Drive list size:" << AutoScannerPaths.size();
|
qDebug() << "Drive list size:" << AutoScannerPaths.size();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="welcomePage">
|
<widget class="QWidget" name="welcomePage">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="passwordGroupBox">
|
<widget class="QGroupBox" name="passwordGroupBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Keep the kids out.. Nothing more.. This isn't meant to be uber security.</string>
|
<string>Very weak password protection and not recommended if security is required.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Password Protect Profile</string>
|
<string>Password Protect Profile</string>
|
||||||
|
@ -258,7 +258,6 @@ SOURCES += \
|
|||||||
newprofile.cpp \
|
newprofile.cpp \
|
||||||
overview.cpp \
|
overview.cpp \
|
||||||
preferencesdialog.cpp \
|
preferencesdialog.cpp \
|
||||||
profileselect.cpp \
|
|
||||||
reports.cpp \
|
reports.cpp \
|
||||||
sessionbar.cpp \
|
sessionbar.cpp \
|
||||||
# updateparser.cpp \
|
# updateparser.cpp \
|
||||||
@ -337,7 +336,6 @@ HEADERS += \
|
|||||||
newprofile.h \
|
newprofile.h \
|
||||||
overview.h \
|
overview.h \
|
||||||
preferencesdialog.h \
|
preferencesdialog.h \
|
||||||
profileselect.h \
|
|
||||||
reports.h \
|
reports.h \
|
||||||
sessionbar.h \
|
sessionbar.h \
|
||||||
# updateparser.h \
|
# updateparser.h \
|
||||||
@ -415,7 +413,6 @@ FORMS += \
|
|||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
oximetry.ui \
|
oximetry.ui \
|
||||||
preferencesdialog.ui \
|
preferencesdialog.ui \
|
||||||
profileselect.ui \
|
|
||||||
newprofile.ui \
|
newprofile.ui \
|
||||||
exportcsv.ui \
|
exportcsv.ui \
|
||||||
# UpdaterWindow.ui \
|
# UpdaterWindow.ui \
|
||||||
|
@ -1,368 +0,0 @@
|
|||||||
/* Profile Select Implementation (Login Screen)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
|
||||||
*
|
|
||||||
* This file is subject to the terms and conditions of the GNU General Public
|
|
||||||
* License. See the file COPYING in the main directory of the source code
|
|
||||||
* for more details. */
|
|
||||||
|
|
||||||
#include "profileselect.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QStringListModel>
|
|
||||||
#include <QStandardItem>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QCryptographicHash>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QHostInfo>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QFontMetrics>
|
|
||||||
#include <QDir>
|
|
||||||
#include "ui_profileselect.h"
|
|
||||||
#include "SleepLib/profiles.h"
|
|
||||||
#include "newprofile.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
extern MainWindow * mainwin;
|
|
||||||
|
|
||||||
ProfileSelect::ProfileSelect(QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::ProfileSelect)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
QStringList str;
|
|
||||||
model = new QStandardItemModel(0, 0);
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int sel = -1;
|
|
||||||
QString name;
|
|
||||||
|
|
||||||
QIcon icon(":/icons/moon.png");
|
|
||||||
|
|
||||||
int w=0;
|
|
||||||
QFont font("Sans Serif", 18, QFont::Bold, false);
|
|
||||||
ui->listView->setFont(font);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
|
||||||
QMap<QString, Profile *>::iterator p;
|
|
||||||
for (p = Profiles::profiles.begin(); p != Profiles::profiles.end(); p++) {
|
|
||||||
name = p.key();
|
|
||||||
|
|
||||||
if (AppSetting->profileName() == name) {
|
|
||||||
sel = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem(name);
|
|
||||||
|
|
||||||
item->setData(p.key(), Qt::UserRole+2);
|
|
||||||
item->setEditable(false);
|
|
||||||
|
|
||||||
if (!(*p)->checkLock().isEmpty()) {
|
|
||||||
item->setForeground(QBrush(Qt::red));
|
|
||||||
item->setText(name+" (open)");
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect rect = fm.boundingRect(name);
|
|
||||||
if (rect.width() > w) w = rect.width();
|
|
||||||
|
|
||||||
// Profile fonts arern't loaded yet.. Using generic font.
|
|
||||||
item->setFont(font);
|
|
||||||
model->appendRow(item);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
w+=20;
|
|
||||||
ui->listView->setMinimumWidth(w);
|
|
||||||
|
|
||||||
proxy = new QSortFilterProxyModel(this);
|
|
||||||
proxy->setSourceModel(model);
|
|
||||||
proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
ui->listView->setModel(proxy);
|
|
||||||
ui->listView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
ui->listView->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
||||||
|
|
||||||
if (sel >= 0) { ui->listView->setCurrentIndex(proxy->index(sel,0)); } //model->item(sel)->index()); }
|
|
||||||
|
|
||||||
proxy->sort(0, Qt::AscendingOrder);
|
|
||||||
|
|
||||||
m_tries = 0;
|
|
||||||
|
|
||||||
popupMenu = new QMenu(this);
|
|
||||||
popupMenu->addAction(tr("Open Profile"), this, SLOT(openProfile()));
|
|
||||||
popupMenu->addAction(tr("Edit Profile"), this, SLOT(editProfile()));
|
|
||||||
popupMenu->addSeparator();
|
|
||||||
popupMenu->addAction(tr("Delete Profile"), this, SLOT(deleteProfile()));
|
|
||||||
|
|
||||||
ui->labelAppName->setText(STR_TR_OSCAR);
|
|
||||||
ui->labelVersion->setText("");
|
|
||||||
// if (GIT_BRANCH!="master")
|
|
||||||
// ui->labelBuild->setText(GIT_BRANCH);
|
|
||||||
// else ui->labelBuild->setText(QString());
|
|
||||||
ui->labelFolder->setText(GetAppData());
|
|
||||||
ui->labelFolder->setToolTip("Current OSCAR data folder\n" + GetAppData());
|
|
||||||
|
|
||||||
ui->listView->verticalScrollBar()->setStyleSheet("QScrollBar:vertical {border: 0px solid grey; background: transparent; }"
|
|
||||||
"QScrollBar::handle:vertical {"
|
|
||||||
" background: qlineargradient(x1:0, y1:0, x2:1, y2:0,"
|
|
||||||
" stop: 0 rgb(230, 230, 230), stop: 0.5 rgb(255, 255, 255), stop:1 rgb(230, 230, 230));"
|
|
||||||
" min-height: 0px;"
|
|
||||||
" border: 1px solid gray;"
|
|
||||||
" border-radius: 5px;"
|
|
||||||
"}");
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileSelect::~ProfileSelect()
|
|
||||||
{
|
|
||||||
delete model; // why is this not being cleaned up by Qt?
|
|
||||||
delete popupMenu;
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
void ProfileSelect::earlyExit()
|
|
||||||
{
|
|
||||||
accept();
|
|
||||||
}
|
|
||||||
void ProfileSelect::editProfile()
|
|
||||||
{
|
|
||||||
QString name = ui->listView->currentIndex().data(Qt::UserRole+2).toString();
|
|
||||||
Profile *profile = Profiles::Get(name);
|
|
||||||
|
|
||||||
if (!profile) { return; }
|
|
||||||
|
|
||||||
bool reallyEdit = false;
|
|
||||||
|
|
||||||
if (profile->user->hasPassword()) {
|
|
||||||
QDialog dialog(this, Qt::Dialog);
|
|
||||||
QLineEdit *e = new QLineEdit(&dialog);
|
|
||||||
e->setEchoMode(QLineEdit::Password);
|
|
||||||
dialog.connect(e, SIGNAL(returnPressed()), &dialog, SLOT(accept()));
|
|
||||||
dialog.setWindowTitle(tr("Enter Password for %1").arg(name));
|
|
||||||
dialog.setMinimumWidth(300);
|
|
||||||
QVBoxLayout *lay = new QVBoxLayout();
|
|
||||||
dialog.setLayout(lay);
|
|
||||||
lay->addWidget(e);
|
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
e->setText("");
|
|
||||||
|
|
||||||
if (dialog.exec() != QDialog::Accepted) { break; }
|
|
||||||
|
|
||||||
tries++;
|
|
||||||
|
|
||||||
if (profile->user->checkPassword(e->text())) {
|
|
||||||
reallyEdit = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
if (tries < 3) {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error, tr("Incorrect Password"), QMessageBox::Ok);
|
|
||||||
} else {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error, tr("You entered the password wrong too many times."),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (tries < 3);
|
|
||||||
} else { reallyEdit = true; }
|
|
||||||
|
|
||||||
if (reallyEdit) {
|
|
||||||
NewProfile newprof(this);
|
|
||||||
newprof.edit(name);
|
|
||||||
newprof.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
//qDebug() << "edit" << name;
|
|
||||||
}
|
|
||||||
void ProfileSelect::deleteProfile()
|
|
||||||
{
|
|
||||||
QString name = ui->listView->currentIndex().data(Qt::UserRole+2).toString();
|
|
||||||
|
|
||||||
QDialog confirmdlg;
|
|
||||||
QVBoxLayout layout(&confirmdlg);
|
|
||||||
QLabel message(QString("<b>"+STR_MessageBox_Warning+":</b> "+tr("You are about to destroy profile '%1'.")+"<br/><br/>"+tr("Enter the word DELETE below to confirm.")).arg(name), &confirmdlg);
|
|
||||||
layout.insertWidget(0,&message,1);
|
|
||||||
QLineEdit lineedit(&confirmdlg);
|
|
||||||
layout.insertWidget(1, &lineedit, 1);
|
|
||||||
QHBoxLayout layout2;
|
|
||||||
layout.insertLayout(2,&layout2,1);
|
|
||||||
QPushButton cancel(QString("&Cancel"), &confirmdlg);
|
|
||||||
QPushButton accept(QString("&Delete Profile"), &confirmdlg);
|
|
||||||
layout2.addWidget(&cancel);
|
|
||||||
layout2.addStretch(1);
|
|
||||||
layout2.addWidget(&accept);
|
|
||||||
confirmdlg.connect(&cancel, SIGNAL(clicked()), &confirmdlg, SLOT(reject()));
|
|
||||||
confirmdlg.connect(&accept, SIGNAL(clicked()), &confirmdlg, SLOT(accept()));
|
|
||||||
confirmdlg.connect(&lineedit, SIGNAL(returnPressed()), &confirmdlg, SLOT(accept()));
|
|
||||||
|
|
||||||
if (confirmdlg.exec() != QDialog::Accepted)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (lineedit.text().compare("DELETE")!=0) {
|
|
||||||
QMessageBox::information(NULL, tr("Sorry"), tr("You need to enter DELETE in capital letters."), QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Profile * profile = Profiles::profiles[name];
|
|
||||||
p_profile = profile;
|
|
||||||
// Hmmmmm.....
|
|
||||||
// if (!profile->Load()) {
|
|
||||||
// QMessageBox::warning(this, STR_MessageBox_Error,
|
|
||||||
// QString(tr("Could not open profile.. You will need to delete this profile directory manually")+
|
|
||||||
// "\n\n"+tr("You will find it under the following location:")+"\n\n%1").arg(QDir::toNativeSeparators(GetAppData() + "/Profiles/" + profile->user->userName())), QMessageBox::Ok);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
bool reallydelete = false;
|
|
||||||
if (profile->user->hasPassword()) {
|
|
||||||
QDialog dialog(this, Qt::Dialog);
|
|
||||||
QLineEdit *e = new QLineEdit(&dialog);
|
|
||||||
e->setEchoMode(QLineEdit::Password);
|
|
||||||
dialog.connect(e, SIGNAL(returnPressed()), &dialog, SLOT(accept()));
|
|
||||||
dialog.setWindowTitle(tr("Enter Password for %1").arg(name));
|
|
||||||
dialog.setMinimumWidth(300);
|
|
||||||
QVBoxLayout *lay = new QVBoxLayout();
|
|
||||||
dialog.setLayout(lay);
|
|
||||||
lay->addWidget(e);
|
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
e->setText("");
|
|
||||||
|
|
||||||
if (dialog.exec() != QDialog::Accepted) { break; }
|
|
||||||
|
|
||||||
tries++;
|
|
||||||
|
|
||||||
if (profile->user->checkPassword(e->text())) {
|
|
||||||
reallydelete = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
if (tries < 3) {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error, tr("You entered an incorrect password"), QMessageBox::Ok);
|
|
||||||
} else {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error,
|
|
||||||
tr("If you're trying to delete because you forgot the password, you need to delete it manually."),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (tries < 3);
|
|
||||||
} else { reallydelete = true; }
|
|
||||||
|
|
||||||
if (reallydelete) {
|
|
||||||
QString path = profile->Get(PrefMacro(STR_GEN_DataFolder));
|
|
||||||
|
|
||||||
if (!path.isEmpty()) {
|
|
||||||
if (!removeDir(path)) {
|
|
||||||
QMessageBox::information(this, STR_MessageBox_Error,
|
|
||||||
tr("There was an error deleting the profile directory, you need to manually remove it.")+QString("\n\n%1").arg(path),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
qDebug() << "Delete" << path;
|
|
||||||
QMessageBox::information(this, STR_MessageBox_Information, tr("Profile '%1' was succesfully deleted").arg(name),QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
int row = ui->listView->currentIndex().row();
|
|
||||||
proxy->removeRow(row);
|
|
||||||
delete p_profile;
|
|
||||||
p_profile = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \fn ProfileSelect::QuickLogin()
|
|
||||||
//! \brief For programmatically bypassing the login window
|
|
||||||
void ProfileSelect::QuickLogin()
|
|
||||||
{
|
|
||||||
on_listView_activated(ui->listView->currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileSelect::on_selectButton_clicked()
|
|
||||||
{
|
|
||||||
on_listView_activated(ui->listView->currentIndex());
|
|
||||||
}
|
|
||||||
void ProfileSelect::openProfile()
|
|
||||||
{
|
|
||||||
on_listView_activated(ui->listView->currentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileSelect::on_newProfileButton_clicked()
|
|
||||||
{
|
|
||||||
NewProfile newprof(this);
|
|
||||||
newprof.skipWelcomeScreen();
|
|
||||||
newprof.setWindowTitle(tr("Create new profile"));
|
|
||||||
|
|
||||||
if (newprof.exec() == NewProfile::Rejected) {
|
|
||||||
// reject();
|
|
||||||
} else { accept(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! \fn ProfileSelect::on_listView_activated(const QModelIndex &index)
|
|
||||||
//! \brief Process the selected login, requesting passwords if required.
|
|
||||||
void ProfileSelect::on_listView_activated(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
QString name = index.data(Qt::UserRole+2).toString();
|
|
||||||
Profile *profile = Profiles::profiles[name];
|
|
||||||
|
|
||||||
if (!profile) { return; }
|
|
||||||
if (!profile->isOpen()) {
|
|
||||||
p_profile = profile;
|
|
||||||
// Do this in case user renames the directory (otherwise it won't load)
|
|
||||||
// Essentially makes the folder name the user name, but whatever..
|
|
||||||
// TODO: Change the profile editor one day to make it rename the actual folder
|
|
||||||
profile->p_preferences[STR_UI_UserName] = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!profile->user->hasPassword()) {
|
|
||||||
m_selectedProfile = name;
|
|
||||||
AppSetting->setProfileName(name);
|
|
||||||
accept();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
QDialog dialog(this, Qt::Dialog);
|
|
||||||
QLineEdit *e = new QLineEdit(&dialog);
|
|
||||||
e->setEchoMode(QLineEdit::Password);
|
|
||||||
dialog.connect(e, SIGNAL(returnPressed()), &dialog, SLOT(accept()));
|
|
||||||
dialog.setWindowTitle(tr("Enter Password"));
|
|
||||||
QVBoxLayout *lay = new QVBoxLayout();
|
|
||||||
dialog.setLayout(lay);
|
|
||||||
lay->addWidget(e);
|
|
||||||
dialog.exec();
|
|
||||||
|
|
||||||
if (profile->user->checkPassword(e->text())) {
|
|
||||||
m_selectedProfile = name;
|
|
||||||
AppSetting->setProfileName(name);
|
|
||||||
accept();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tries++;
|
|
||||||
|
|
||||||
if (tries < 3) {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error, tr("Incorrect Password"), QMessageBox::Ok);
|
|
||||||
} else {
|
|
||||||
QMessageBox::warning(this, STR_MessageBox_Error,
|
|
||||||
tr("You entered an Incorrect Password too many times. Exiting!"), QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
} while (tries < 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
reject();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileSelect::on_listView_customContextMenuRequested(const QPoint &pos)
|
|
||||||
{
|
|
||||||
popupMenu->popup(QWidget::mapToGlobal(pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileSelect::on_pushButton_clicked()
|
|
||||||
{
|
|
||||||
mainwin->RestartApplication(false, "-d");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileSelect::on_filter_textChanged(const QString &arg1)
|
|
||||||
{
|
|
||||||
QRegExp regExp("*"+arg1+"*", Qt::CaseInsensitive, QRegExp::Wildcard);
|
|
||||||
proxy->setFilterRegExp(regExp);
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/* Profile Select Header (Login Screen)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
|
||||||
*
|
|
||||||
* This file is subject to the terms and conditions of the GNU General Public
|
|
||||||
* License. See the file COPYING in the main directory of the source code
|
|
||||||
* for more details. */
|
|
||||||
|
|
||||||
#ifndef PROFILESELECT_H
|
|
||||||
#define PROFILESELECT_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QModelIndex>
|
|
||||||
#include <QStandardItemModel>
|
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ProfileSelect;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! \class ProfileSelect
|
|
||||||
\brief Simple Login Window providing a list of all profiles to select from
|
|
||||||
*/
|
|
||||||
class ProfileSelect : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ProfileSelect(QWidget *parent = 0);
|
|
||||||
~ProfileSelect();
|
|
||||||
|
|
||||||
QString selectedProfile();
|
|
||||||
void QuickLogin();
|
|
||||||
private slots:
|
|
||||||
void on_selectButton_clicked();
|
|
||||||
|
|
||||||
void on_newProfileButton_clicked();
|
|
||||||
|
|
||||||
void on_listView_activated(const QModelIndex &index);
|
|
||||||
void earlyExit();
|
|
||||||
|
|
||||||
void openProfile();
|
|
||||||
void editProfile();
|
|
||||||
void deleteProfile();
|
|
||||||
|
|
||||||
void on_listView_customContextMenuRequested(const QPoint &pos);
|
|
||||||
|
|
||||||
void on_pushButton_clicked();
|
|
||||||
|
|
||||||
void on_filter_textChanged(const QString &arg1);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ProfileSelect *ui;
|
|
||||||
QString m_selectedProfile;
|
|
||||||
int m_tries;
|
|
||||||
QMenu *popupMenu;
|
|
||||||
QStandardItemModel *model;
|
|
||||||
QSortFilterProxyModel *proxy;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PROFILESELECT_H
|
|
@ -1,422 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ProfileSelect</class>
|
|
||||||
<widget class="QDialog" name="ProfileSelect">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>418</width>
|
|
||||||
<height>272</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Select Profile</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="Resources.qrc">
|
|
||||||
<normaloff>:/icons/logo-sm.png</normaloff>:/icons/logo-sm.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QDialog {
|
|
||||||
background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(220, 220, 220, 255));
|
|
||||||
}
|
|
||||||
|
|
||||||
QGroupBox {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid gray;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-top: 3ex; /* leave space at the top for the title */
|
|
||||||
}
|
|
||||||
|
|
||||||
QGroupBox::title {
|
|
||||||
subcontrol-origin: margin;
|
|
||||||
subcontrol-position: top center; /* position at the top center */
|
|
||||||
padding: 2px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFrame {
|
|
||||||
background: white;
|
|
||||||
border: 1px solid gray;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLabel {
|
|
||||||
background: transparent;
|
|
||||||
border: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton {
|
|
||||||
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(255, 255, 255, 255));
|
|
||||||
border: 1px solid gray;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 3px;
|
|
||||||
padding-left: 20px;
|
|
||||||
padding-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:hover {
|
|
||||||
background: white;
|
|
||||||
border: 2px solid gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:pressed {
|
|
||||||
background: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLineEdit {
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid gray;
|
|
||||||
background: white;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="frame_3">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Search:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="filter">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="listView">
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="frame_2">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QFrame {
|
|
||||||
background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(220, 220, 220, 255));
|
|
||||||
};</string>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>16</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>16</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>16</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>16</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="selectButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Start with the selected user profile.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Select User</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="Resources.qrc">
|
|
||||||
<normaloff>:/icons/forward.png</normaloff>:/icons/forward.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="newProfileButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Create a new user profile.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>New Profile</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Choose a different OSCAR data folder.</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Different Folder</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelAppName">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>15</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>OSCAR</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelVersion">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>[version]</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="quitButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Click here if you didn't want to start OSCAR.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Quit</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="frame">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Folder:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelFolder">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>The current location of OSCAR data store.</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 0px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>[data directory]</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources>
|
|
||||||
<include location="Resources.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>quitButton</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>ProfileSelect</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>52</x>
|
|
||||||
<y>276</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>199</x>
|
|
||||||
<y>149</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@ -353,6 +353,10 @@ void ProfileSelector::on_buttonDestroyProfile_clicked()
|
|||||||
QString name = proxy->data(proxy->index(ui->profileView->currentIndex().row(), 0, QModelIndex()), Qt::UserRole+2).toString();
|
QString name = proxy->data(proxy->index(ui->profileView->currentIndex().row(), 0, QModelIndex()), Qt::UserRole+2).toString();
|
||||||
Profile * profile = Profiles::profiles[name];
|
Profile * profile = Profiles::profiles[name];
|
||||||
QString path = profile->Get(PrefMacro(STR_GEN_DataFolder));
|
QString path = profile->Get(PrefMacro(STR_GEN_DataFolder));
|
||||||
|
if (path == (GetAppData() + "/Profiles/")) {
|
||||||
|
QMessageBox::warning(this, STR_MessageBox_Error, tr("The selected profile does not appear to contain any data and cannot be removed by OSCAR"), QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool verified = true;
|
bool verified = true;
|
||||||
if (profile->user->hasPassword()) {
|
if (profile->user->hasPassword()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user