diff options
| author | Anton <anton@picapica> | 2017-12-01 21:55:53 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2017-12-01 21:55:53 +0400 |
| commit | ac041927bc0c82e33acaa9e15fd46ecca0b77172 (patch) | |
| tree | 742f1bf43917e79dae43c78684a2a3d055214e76 /pica-client/main.cpp | |
| parent | 32e742ed040c5a70edb4cbfb947581f1e192d5a6 (diff) | |
| parent | 9c0a5bf2bbd94539427ece7eb1cb8ea82c6c3dec (diff) | |
| download | pica-pica-ac041927bc0c82e33acaa9e15fd46ecca0b77172.tar.gz pica-pica-ac041927bc0c82e33acaa9e15fd46ecca0b77172.zip | |
Merge branch 'direct_c2c_connections'
Diffstat (limited to 'pica-client/main.cpp')
| -rw-r--r-- | pica-client/main.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/pica-client/main.cpp b/pica-client/main.cpp index 7df81ce..1441b5c 100644 --- a/pica-client/main.cpp +++ b/pica-client/main.cpp @@ -14,6 +14,8 @@ #include <QIcon> #include "../PICA_client.h" #include "dhparam.h" +#include "settings.h" +#include "dialogs/settingsdialog.h" //globals QString config_dir; @@ -135,7 +137,18 @@ static bool create_database() if (query.lastError().isValid()) goto showerror; - query.exec("insert into schema_version values (2, strftime('%s','now'));"); //current schema version. update when needed + query.exec("create table settings \ + ( \ + name varchar(255) not null, \ + value varchar(255) not null, \ + constraint pk primary key (name) on conflict replace \ + );" + ); + + if (query.lastError().isValid()) + goto showerror; + + query.exec("insert into schema_version values (3, strftime('%s','now'));"); //current schema version. update when needed if (query.lastError().isValid()) showerror: @@ -363,6 +376,23 @@ static bool update_database() schema_ver = 2; } + if (schema_ver == 2) + { + query.exec("create table settings \ + ( \ + name varchar(255) not null, \ + value varchar(255) not null, \ + constraint pk primary key (name) on conflict replace \ + );" + ); + + if (query.lastError().isValid()) + goto showerror; + + query.exec("insert into schema_version values (3, strftime('%s','now'));"); + schema_ver = 3; + } + if (query.lastError().isValid()) showerror: { @@ -465,6 +495,15 @@ int main(int argc, char *argv[]) picapica_ico_fly = QIcon("share\\picapica-icon-fly.png"); #endif + Settings st(config_dbname); + + if (st.isEmpty()) //show settings dialog on first start + { + SettingsDialog sd; + + sd.exec(); + } + PicaActionCenter ac; action_center = ∾ |
