Skip login screen take #2

This commit is contained in:
Mark Watkins 2011-11-18 19:18:41 +10:00
parent 16cb50cbb2
commit 9094888227
3 changed files with 13 additions and 3 deletions

View File

@ -96,7 +96,8 @@ int main(int argc, char *argv[])
ResmedLoader::Register(); ResmedLoader::Register();
Profiles::Scan(); Profiles::Scan();
PREF["AppName"]="SleepyHead"; PREF["AppName"]="SleepyHead";
bool skip_login=(!PREF.ExistsAndTrue("SkipLoginScreen")) || force_login_screen; bool skip_login=(PREF.ExistsAndTrue("SkipLoginScreen"));
if (force_login_screen) skip_login=false;
QString Version=QString("%1.%2.%3").arg(major_version).arg(minor_version).arg(revision_number); QString Version=QString("%1.%2.%3").arg(major_version).arg(minor_version).arg(revision_number);
@ -139,11 +140,15 @@ int main(int argc, char *argv[])
check_updates=false; check_updates=false;
} }
} }
ProfileSelect profsel(0);
if (skip_login) { if (skip_login) {
profsel.QuickLogin();
if (profsel.result()==ProfileSelect::Rejected) {
exit(1);
}
p_profile=Profiles::Get(PREF["Profile"].toString()); p_profile=Profiles::Get(PREF["Profile"].toString());
} else p_profile=NULL; } else p_profile=NULL;
if (p_profile) { if (!p_profile) {
ProfileSelect profsel(0);
if (profsel.exec()==ProfileSelect::Rejected) { if (profsel.exec()==ProfileSelect::Rejected) {
exit(1); exit(1);
} }

View File

@ -159,6 +159,10 @@ void ProfileSelect::deleteProfile()
} }
} }
} }
void ProfileSelect::QuickLogin()
{
on_listView_activated(ui->listView->currentIndex());
}
void ProfileSelect::on_selectButton_clicked() void ProfileSelect::on_selectButton_clicked()
{ {

View File

@ -18,6 +18,7 @@ public:
~ProfileSelect(); ~ProfileSelect();
QString selectedProfile(); QString selectedProfile();
void QuickLogin();
private slots: private slots:
void on_selectButton_clicked(); void on_selectButton_clicked();