64
65
// skin_widget = new SkinsWidget(mSettings);
65
66
// skinCenter = new SkinCenter();
66
67
// connect(skin_widget, SIGNAL(skinSignalToQML(QString)), this, SLOT(handler_change_skin(QString)));
68
QObject::connect(sessioniface,SIGNAL(display_scan_process(QString)),this,SLOT(handler_scan_process(QString)));
69
QObject::connect(sessioniface,SIGNAL(scan_complete(QString)),this,SLOT(handler_scan_complete(QString)));
68
//handler_change_titlebar_position
69
QObject::connect(sessioniface, SIGNAL(change_titlebar_position(QString)), this, SLOT(handler_change_titlebar_position(QString)));
70
QObject::connect(sessioniface, SIGNAL(display_scan_process(QString)), this, SLOT(handler_scan_process(QString)));
71
QObject::connect(sessioniface, SIGNAL(scan_complete(QString)), this, SLOT(handler_scan_complete(QString)));
70
72
QObject::connect(sessioniface, SIGNAL(access_weather(QString, QString)), this, SLOT(accord_flag_access_weather(QString, QString)));
71
QObject::connect(sessioniface,SIGNAL(total_data_transmit(QString, QString)),this,SLOT(handler_total_data_transmit(QString,QString)));
73
QObject::connect(sessioniface, SIGNAL(total_data_transmit(QString, QString)), this, SLOT(handler_total_data_transmit(QString,QString)));
73
75
//Apt and Soft center cache
74
76
QObject::connect(sessioniface, SIGNAL(data_transmit_by_cache(QString, QString, QString, QString)), this, SLOT(handler_append_cache_data_to_model(QString,QString,QString,QString)));
75
77
QObject::connect(sessioniface, SIGNAL(cache_transmit_complete(QString)), this, SLOT(handler_cache_scan_over(QString)));
78
// QObject::connect(sessioniface, SIGNAL(path_transmit_by_cache(QString, QString)), this, SLOT(handler_cache_path(QString, QString)));
77
80
//Uninstall unneed package and old kernel package
78
81
QObject::connect(sessioniface, SIGNAL(data_transmit_by_package(QString, QString, QString, QString)), this, SLOT(handler_append_package_data_to_model(QString,QString,QString,QString)));
86
89
QObject::connect(sessioniface, SIGNAL(data_transmit_by_cookies(QString, QString, QString)), this, SLOT(handler_append_cookies_to_model(QString,QString,QString)));
87
90
QObject::connect(sessioniface, SIGNAL(cookies_transmit_complete(QString)), this, SLOT(handler_cookies_scan_over(QString)));
93
QObject::connect(sessioniface, SIGNAL(upload_cloud_conf_signal(QString)), this, SLOT(handler_upload_cloud_conf(QString)));
94
QObject::connect(sessioniface, SIGNAL(download_cloud_conf_signal(QString)), this, SLOT(handler_download_cloud_conf(QString)));
90
QObject::connect(httpauth, SIGNAL(response(QString,QString,QString,QString)), this, SLOT(handle_data_after_login_success(QString,QString,QString,QString)));
91
QObject::connect(httpauth, SIGNAL(refresh(QString,QString)), this, SLOT(handle_data_after_search_success(QString,QString)));
97
QObject::connect(httpauth, SIGNAL(response(/*QString,*/QString,QString,QString)), this, SLOT(handle_data_after_login_success(/*QString,*/QString,QString,QString)));
98
QObject::connect(httpauth, SIGNAL(refresh(/*QString,*/QString)), this, SLOT(handle_data_after_search_success(/*QString,*/QString)));
92
99
QObject::connect(httpauth, SIGNAL(error(int)), this, SLOT(handle_data_when_login_failed(int)));
93
100
QObject::connect(httpauth, SIGNAL(failedCommunicate()), this, SLOT(resetTimerStatus()));
94
101
QObject::connect(httpauth, SIGNAL(successCommunicate()), this, SLOT(searchCurrentInfo()));
110
117
sessioniface->call("exit");
120
void SessionDispatcher::open_folder_qt(QString path) {
121
sessioniface->call("open_folder", path);
124
void SessionDispatcher::download_kysoft_cloud_conf_qt() {
125
sessioniface->call("download_kysoft_cloud_conf");
128
void SessionDispatcher::upload_kysoft_cloud_conf_qt() {
129
sessioniface->call("upload_kysoft_cloud_conf");
133
void SessionDispatcher::handler_download_cloud_conf(QString download) {
134
emit this->tellDownloadCloudConfToQML(download);
138
void SessionDispatcher::handler_upload_cloud_conf(QString upload) {
139
emit this->tellUploadCloudConfToQML(upload);
142
//准发发送信号告诉优客助手自己去改变自身的标题栏控制按钮位置
143
void SessionDispatcher::handler_change_titlebar_position(QString position) {
144
emit this->startChangeControlBtnPosition(position);
113
147
//每30minutes连接服务器beat一次
114
148
void SessionDispatcher::connectHttpServer(){
115
149
qDebug()<<"start to connect every 30 minutes...";
126
160
//beat失败处理,beat不成功,界面的用户信息消失,改为登录界面,提示网络出错
127
161
void SessionDispatcher::resetTimerStatus() {
129
QString requestData = QString("http://119.254.229.72/boxbeta/find_get.php?pp[type]=network");
163
QString requestData = QString("http://www.ubuntukylin.com/boxbeta/find_get.php?pp[type]=network");
130
164
QUrl url(requestData);
131
165
httpauth->sendGetRequest(url);
133
// QString requestData = QString("http://119.254.229.72/boxbeta/find_get.php?pp[type]=network");
134
// QUrl url(requestData);
135
// httpauth->sendGetRequest(url);
137
// if(waitTime >= 2){
139
// disconnect(timer, SIGNAL(timeout()), this, SLOT(connectHttpServer()));
140
// if(timer->isActive()) {
143
// emit loginFailedStatus(99); //超时次数到,向主界面发送网络出现错误的信号
144
// qDebug()<<"connect fail...";
146
// qDebug() << "continue connect...";
149
// if(waitTime >= 2){
151
// disconnect(timer, SIGNAL(timeout()), this, SLOT(connectHttpServer()));
152
// if(timer->isActive()) {
155
// emit loginFailedStatus(99); //超时次数到,向主界面发送网络出现错误的信号
156
// qDebug()<<"connect fail...";
158
// qDebug() << "continue connect...";
212
208
//点击登录框的确定按钮后,开始发送数据给服务端进行登录验证
213
209
void SessionDispatcher::verify_user_and_password(QString user, QString pwd) {
216
211
emit showLoginAnimatedImage();
220
QString requestData = QString("http://119.254.229.72/boxbeta/find_get.php?pp[type]=login&pp[table]=yk_member&name=%1&password=%2").arg(user).arg(pwd);
216
QString requestData = QString("http://www.ubuntukylin.com/boxbeta/find_get.php?pp[type]=login&pp[table]=yk_member&name=%1&password=%2").arg(user).arg(pwd);
221
217
QUrl url(requestData);
222
218
httpauth->sendGetRequest(url);
225
// QString requestData = QString("%1%2%3%4").arg("name=").arg(user).arg("&password=").arg(pwd);
226
// QUrl url("http://210.209.123.136/box/find.php");
227
// QByteArray postData;
228
// postData.append(requestData);
229
// httpauth->sendPostRequest(url, postData);
425
426
void SessionDispatcher::cookies_scan_function_qt(QString flag) {
426
// QDBusReply<QStringList> reply = sessioniface->call("scan_cookies_function", flag);//cookies_scan_function
427
// return reply.value();
428
427
sessioniface->call("cookies_scan_function", flag);
431
//QStringList SessionDispatcher::scan_unneed_packages_qt() {
432
// QDBusReply<QStringList> reply = sessioniface->call("scan_unneed_packages");
433
// return reply.value();
436
//QStringList SessionDispatcher::scan_apt_cruft_qt() {
437
// QDBusReply<QStringList> reply = sessioniface->call("scan_apt_cruft");
438
// return reply.value();
441
//QStringList SessionDispatcher::scan_softwarecenter_cruft_qt() {
442
// QDBusReply<QStringList> reply = sessioniface->call("scan_softwarecenter_cruft");
443
// return reply.value();
446
430
QStringList SessionDispatcher::get_cache_arglist(int i) {
575
553
this->alert_y = window_y + mainwindow_height - 400;
576
554
dialog->move(this->alert_x, this->alert_y);
578
// dialog->setModal(true);
558
bool SessionDispatcher::showConfirmDialog(QString title, QString content, int window_x, int window_y) {
559
WarningDialog *dialog = new WarningDialog(title, content);
560
this->alert_x = window_x + (mainwindow_width / 2) - (alert_width / 2);
561
this->alert_y = window_y + mainwindow_height - 400;
562
dialog->move(this->alert_x, this->alert_y);
563
dialog-> QWidget::setAttribute(Qt::WA_DeleteOnClose);
564
if(dialog->exec()==QDialog::Rejected) {
572
//void SessionDispatcher::handler_confirm_cloud_action() {
573
// emit this->tellQMLCloudConfirm();
582
576
QString SessionDispatcher::getSingleInfo(QString key) {
583
577
QVariant info = systemInfo.value(key);
728
726
sessioniface->call("set_cursor_size", size);
730
QStringList SessionDispatcher::get_window_themes_qt() {
731
QDBusReply<QStringList> reply = sessioniface->call("get_window_themes");
732
return reply.value();
735
QString SessionDispatcher::get_current_window_theme_qt() {
736
QDBusReply<QString> reply = sessioniface->call("get_current_window_theme");
737
return reply.value();
740
void SessionDispatcher::set_window_theme_qt(QString theme) {
741
sessioniface->call("set_window_theme", theme);
731
744
/*-----------------------------font of beauty-----------------------------*/
732
745
QString SessionDispatcher::get_default_theme_sring_qt(QString flag/*QString schema, QString key*/) {
733
746
if(flag == "icontheme") {
734
747
QDBusReply<QString> reply = sessioniface->call("get_default_font_sring", "org.gnome.desktop.interface", "icon-theme");
735
748
return reply.value();
750
else if(flag == "windowtheme") {
751
QDBusReply<QString> reply = sessioniface->call("get_default_font_sring", "org.gnome.desktop.wm.preferences", "theme");
752
return reply.value();
737
754
else if(flag == "mousetheme") {
738
755
QDBusReply<QString> reply = sessioniface->call("get_default_font_sring", "org.gnome.desktop.interface", "cursor-theme");
739
756
return reply.value();
758
else if(flag == "smoothstyle") {
759
QDBusReply<QString> reply = sessioniface->call("get_default_font_sring", "org.gnome.settings-daemon.plugins.xsettings", "hinting");
760
return reply.value();
762
else if(flag == "antialiasingstyle") {
763
QDBusReply<QString> reply = sessioniface->call("get_default_font_sring", "org.gnome.settings-daemon.plugins.xsettings", "antialiasing");
764
return reply.value();
767
791
else if(flag == "titlebarfont") {
768
792
sessioniface->call("set_default_font", "org.gnome.desktop.wm.preferences", "titlebar-font", "string");
794
else if(flag == "smoothstyle") {
795
sessioniface->call("set_default_font", "org.gnome.settings-daemon.plugins.xsettings", "hinting", "string");
797
else if(flag == "antialiasingstyle") {
798
sessioniface->call("set_default_font", "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "string");
771
//-------------------桌面图标-------------------
772
801
else if(flag == "icontheme") {//图标主题
773
802
sessioniface->call("set_default_font", "org.gnome.desktop.interface", "icon-theme", "string");
804
else if(flag == "windowtheme") {//窗口主题
805
sessioniface->call("set_default_font", "org.gnome.desktop.wm.preferences", "theme", "string");
775
807
else if(flag == "mousetheme") {//鼠标指针主题
776
808
sessioniface->call("set_default_font", "org.gnome.desktop.interface", "cursor-theme", "string");
810
else if(flag == "cursorsize") {//光标大小
811
sessioniface->call("set_default_font", "org.gnome.desktop.interface", "cursor-size", "int");
780
815
bool SessionDispatcher::get_default_desktop_bool_qt(QString schema, QString key) {
901
936
return reply.value();
939
QStringList SessionDispatcher::get_smooth_style_list_qt() {
940
QDBusReply<QStringList> reply = sessioniface->call("get_smooth_style_list");
941
return reply.value();
944
QString SessionDispatcher::get_smooth_style_qt() {
945
QDBusReply<QString> reply = sessioniface->call("get_smooth_style");
946
return reply.value();
949
bool SessionDispatcher::set_smooth_style_qt(QString style) {
950
QDBusReply<bool> reply = sessioniface->call("set_smooth_style", style);
951
return reply.value();
954
QStringList SessionDispatcher::get_antialiasing_style_list_qt() {
955
QDBusReply<QStringList> reply = sessioniface->call("get_antialiasing_style_list");
956
return reply.value();
959
QString SessionDispatcher::get_antialiasing_style_qt() {
960
QDBusReply<QString> reply = sessioniface->call("get_antialiasing_style");
961
return reply.value();
964
bool SessionDispatcher::set_antialiasing_style_qt(QString style) {
965
QDBusReply<bool> reply = sessioniface->call("set_antialiasing_style", style);
966
return reply.value();
904
970
void SessionDispatcher::restore_default_font_signal(QString flag) {
905
971
emit notifyFontStyleToQML(flag); //font_style
934
1000
selectedFont.clear();
935
1001
emit notifyFontStyleToQML(flag); //font_style
938
// const QFont& font = QFontDialog::getFont(&ok, 0);
940
// QString fontsize = QString("%1").arg(font.pointSize());
941
// QString fontstyle = font.family() + " " + font.styleName() + " " + fontsize;
942
// if(flag == "font")
943
// set_font_qt(fontstyle);//set font
944
// else if(flag == "desktopfont")
945
// set_desktop_font_qt(fontstyle);//set desktopfont
946
// else if(flag == "monospacefont")
947
// set_monospace_font_qt(fontstyle);//set monospacefont
948
// else if(flag == "documentfont")
949
// set_document_font_qt(fontstyle);//set documentfont
950
// else if(flag == "titlebarfont")
951
// set_window_title_font_qt(fontstyle);//set titlebarfont
952
// emit notifyFontStyleToQML(flag); //font_style
956
1005
QString SessionDispatcher::show_folder_dialog() {
979
1028
/*-----------------------------touchpad of beauty-----------------------------*/
980
QString SessionDispatcher::get_default_system_sring_qt(QString schema, QString key) {
981
QDBusReply<QString> reply = sessioniface->call("get_default_system_sring", schema, key);
982
return reply.value();
1029
QString SessionDispatcher::get_default_system_sring_qt(QString flag) {
1030
if(flag == "wheel-action") {//菜单项旁显示图标
1031
QDBusReply<QString> reply = sessioniface->call("get_default_system_sring", "org.compiz.gwd", "mouse-wheel-action");
1032
return reply.value();
1034
else if(flag == "double-click") {//标题栏双击动作
1035
QDBusReply<QString> reply = sessioniface->call("get_default_system_sring", "org.gnome.desktop.wm.preferences", "action-double-click-titlebar");
1036
return reply.value();
1038
else if(flag == "middle-click") {//标题栏中键动作
1039
QDBusReply<QString> reply = sessioniface->call("get_default_system_sring", "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar");
1040
return reply.value();
1042
else if(flag == "right-click") {//标题栏右键动作
1043
QDBusReply<QString> reply = sessioniface->call("get_default_system_sring", "org.gnome.desktop.wm.preferences", "action-right-click-titlebar");
1044
return reply.value();
985
1049
bool SessionDispatcher::get_default_system_bool_qt(QString schema, QString key) {
1000
1064
else if(flag == "horiz-scroll-enabled") {//触摸板横向滚动
1001
1065
sessioniface->call("set_default_system", "org.gnome.settings-daemon.peripherals.touchpad", "horiz-scroll-enabled", "boolean");
1067
else if(flag == "control-button-position") {//窗口控制按钮位置
1068
sessioniface->call("set_default_system", "org.gnome.desktop.wm.preferences", "button-layout", "string");
1070
else if(flag == "menu-with-icons") {//菜单项旁显示图标
1071
sessioniface->call("set_default_system", "org.gnome.desktop.interface", "menus-have-icons", "boolean");
1073
else if(flag == "wheel-action") {//标题栏鼠标滚轮动作
1074
sessioniface->call("set_default_system", "org.compiz.gwd", "mouse-wheel-action", "string");
1076
else if(flag == "double-click") {//标题栏双击动作
1077
sessioniface->call("set_default_system", "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", "string");
1079
else if(flag == "middle-click") {//标题栏中键动作
1080
sessioniface->call("set_default_system", "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "string");
1082
else if(flag == "right-click") {//标题栏右键动作
1083
sessioniface->call("set_default_system", "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "string");
1042
1124
/*-----------------------------window of beauty-----------------------------*/
1043
bool SessionDispatcher::set_window_button_align_left_qt() {
1044
QDBusReply<bool> reply = sessioniface->call("set_window_button_align_left");
1045
return reply.value();
1125
void SessionDispatcher::set_window_button_align_left_qt() {
1126
sessioniface->call("set_window_button_align_left");
1048
bool SessionDispatcher::set_window_button_align_right_qt() {
1049
QDBusReply<bool> reply = sessioniface->call("set_window_button_align_right");
1050
return reply.value();
1129
void SessionDispatcher::set_window_button_align_right_qt() {
1130
sessioniface->call("set_window_button_align_right");
1053
1133
QString SessionDispatcher::get_window_button_align_qt() {
1065
1145
return reply.value();
1148
QStringList SessionDispatcher::get_titlebar_wheel_qt() {
1149
QDBusReply<QStringList> reply = sessioniface->call("get_titlebar_wheel");
1150
return reply.value();
1153
QString SessionDispatcher::get_current_titlebar_wheel_qt() {
1154
QDBusReply<QString> reply = sessioniface->call("get_current_titlebar_wheel");
1155
return reply.value();
1158
void SessionDispatcher::set_titlebar_wheel_qt(QString value) {
1159
sessioniface->call("set_titlebar_wheel", value);
1162
QStringList SessionDispatcher::get_titlebar_double_qt() {
1163
QDBusReply<QStringList> reply = sessioniface->call("get_titlebar_double");
1164
return reply.value();
1167
QString SessionDispatcher::get_current_titlebar_double_qt() {
1168
QDBusReply<QString> reply = sessioniface->call("get_current_titlebar_double");
1169
return reply.value();
1172
void SessionDispatcher::set_titlebar_double_qt(QString value) {
1173
sessioniface->call("set_titlebar_double", value);
1176
QStringList SessionDispatcher::get_titlebar_middle_qt() {
1177
QDBusReply<QStringList> reply = sessioniface->call("get_titlebar_middle");
1178
return reply.value();
1181
QString SessionDispatcher::get_current_titlebar_middle_qt() {
1182
QDBusReply<QString> reply = sessioniface->call("get_current_titlebar_middle");
1183
return reply.value();
1186
void SessionDispatcher::set_titlebar_middle_qt(QString value) {
1187
sessioniface->call("set_titlebar_middle", value);
1190
QStringList SessionDispatcher::get_titlebar_right_qt() {
1191
QDBusReply<QStringList> reply = sessioniface->call("get_titlebar_right");
1192
return reply.value();
1195
QString SessionDispatcher::get_current_titlebar_right_qt() {
1196
QDBusReply<QString> reply = sessioniface->call("get_current_titlebar_right");
1197
return reply.value();
1200
void SessionDispatcher::set_titlebar_right_qt(QString value) {
1201
sessioniface->call("set_titlebar_right", value);
1068
1205
/*-----------------------------sound of beauty-----------------------------*/
1069
1206
void SessionDispatcher::set_login_music_enable_qt(bool flag) {
1070
1207
sessioniface->call("set_login_music_enable", flag);
1084
1221
sessioniface->call("set_sound_theme", theme);
1224
/*-------------------filemanager of beauty-------------------*/
1225
//bool SessionDispatcher::get_default_filemanager_bool_qt(QString flag) {
1229
//int SessionDispatcher::get_default_filemanager_int_qt(QString flag) {
1233
void SessionDispatcher::set_default_filemanager_qt(QString flag) {
1234
if(flag == "pathbar") {//路径输入框取代路径栏
1235
sessioniface->call("set_default_filemanager", "org.gnome.nautilus.preferences", "always-use-location-entry", "boolean");
1237
else if(flag == "media") {//自动挂载媒体
1238
sessioniface->call("set_default_filemanager", "org.gnome.desktop.media-handling", "automount", "boolean");
1240
else if(flag == "folder") {//自动打开文件夹
1241
sessioniface->call("set_default_filemanager", "org.gnome.desktop.media-handling", "automount-open", "boolean");
1243
else if(flag == "programs") {//提示自动运行的程序
1244
sessioniface->call("set_default_filemanager", "org.gnome.desktop.media-handling", "autorun-never", "boolean");
1246
else if(flag == "iconsize") {//缩略图图标尺寸(像素)
1247
sessioniface->call("set_default_filemanager", "org.gnome.nautilus.icon-view", "thumbnail-size", "int");
1249
else if(flag == "cachetime") {//缩略图缓存时间(天数)
1250
sessioniface->call("set_default_filemanager", "org.gnome.desktop.thumbnail-cache", "maximum-age", "int");
1252
else if(flag == "maxsize") {//最大缩略图缓存尺寸(MB)
1253
sessioniface->call("set_default_filemanager", "org.gnome.desktop.thumbnail-cache", "maximum-size", "int");
1257
void SessionDispatcher::set_location_replace_pathbar_qt(bool flag) {
1258
sessioniface->call("set_location_replace_pathbar", flag);
1261
bool SessionDispatcher::get_location_replace_pathbar_qt() {
1262
QDBusReply<bool> reply = sessioniface->call("get_location_replace_pathbar");
1263
return reply.value();
1266
void SessionDispatcher::set_auto_mount_media_qt(bool flag) {
1267
sessioniface->call("set_auto_mount_media", flag);
1270
bool SessionDispatcher::get_auto_mount_media_qt() {
1271
QDBusReply<bool> reply = sessioniface->call("get_auto_mount_media");
1272
return reply.value();
1275
void SessionDispatcher::set_auto_open_folder_qt(bool flag) {
1276
sessioniface->call("set_auto_open_folder", flag);
1279
bool SessionDispatcher::get_auto_open_folder_qt() {
1280
QDBusReply<bool> reply = sessioniface->call("get_auto_open_folder");
1281
return reply.value();
1284
void SessionDispatcher::set_prompt_autorun_programs_qt(bool flag) {
1285
sessioniface->call("set_prompt_autorun_programs", flag);
1288
bool SessionDispatcher::get_prompt_autorun_programs_qt() {
1289
QDBusReply<bool> reply = sessioniface->call("get_prompt_autorun_programs");
1290
return reply.value();
1293
void SessionDispatcher::set_thumbnail_icon_size_qt(int size) {
1294
sessioniface->call("set_thumbnail_icon_size", size);
1297
int SessionDispatcher::get_thumbnail_icon_size_qt() {
1298
QDBusReply<int> reply = sessioniface->call("get_thumbnail_icon_size");
1299
return reply.value();
1302
void SessionDispatcher::set_thumbnail_cache_time_qt(int value) {
1303
sessioniface->call("set_thumbnail_cache_time", value);
1306
int SessionDispatcher::get_thumbnail_cache_time_qt() {
1307
QDBusReply<int> reply = sessioniface->call("get_thumbnail_cache_time");
1308
return reply.value();
1311
void SessionDispatcher::set_thumbnail_cache_size_qt(int size) {
1312
sessioniface->call("set_thumbnail_cache_size", size);
1315
int SessionDispatcher::get_thumbnail_cache_size_qt() {
1316
QDBusReply<int> reply = sessioniface->call("get_thumbnail_cache_size");
1317
return reply.value();
1087
1320
//-----------------------monitorball------------------------
1088
1321
double SessionDispatcher::get_cpu_percent_qt() {
1089
1322
QDBusReply<double> reply = sessioniface->call("get_cpu_percent");
1174
1399
yahooforecastInfo = reply.value();
1177
/*bool*/void SessionDispatcher::get_current_weather_qt() {
1402
void SessionDispatcher::get_current_weather_qt() {
1178
1403
getCityIdInfo();
1179
// qDebug() << initCityId;
1180
1404
QStringList tmplist;
1181
1405
tmplist << "Kobe" << "Lee";
1183
1407
bool flag = Util::id_exists_in_location_file(initCityId);
1184
1408
if(flag) {//获取中国气象局数据
1185
// sessioniface->call("get_current_weather", initCityId);
1186
// qDebug() << initCityId;
1187
1409
KThread *thread = new KThread(tmplist, sessioniface, "get_current_weather", initCityId);
1188
1410
thread->start();
1190
1412
else {//获取雅虎气象数据
1191
1413
QStringList latlon = this->getLatandLon(initCityId);
1192
// qDebug() << latlon;
1193
// qDebug() << initCityId;
1194
// sessioniface->call("get_current_yahoo_weather", latlon, initCityId);
1195
1414
KThread *thread = new KThread(latlon, sessioniface, "get_current_yahoo_weather", initCityId);
1196
1415
thread->start();
1199
// QDBusReply<QMap<QString, QVariant> > reply = sessioniface->call("get_current_weather", initCityId);
1200
// currentInfo = reply.value();
1201
// if(currentInfo.isEmpty()) {
1209
1419
void SessionDispatcher::get_current_weather_dict_qt() {
1214
1424
void SessionDispatcher::get_current_yahoo_weather_dict_qt() {
1215
1425
QDBusReply<QMap<QString, QVariant> > reply = sessioniface->call("get_current_yahoo_weather_dict");
1216
1426
yahoocurrentInfo = reply.value();
1217
// qDebug() << "yahoo data->";
1218
// qDebug() << yahoocurrentInfo;
1221
//QString SessionDispatcher::get_current_pm25_qt() {
1223
// QDBusReply<QString> reply = sessioniface->call("get_current_pm25", initCityId);
1224
// return reply.value();
1227
1429
void SessionDispatcher::get_current_pm25_qt() {
1228
1430
getCityIdInfo();
1229
1431
QStringList tmplist;
1230
1432
tmplist << "Kobe" << "Lee";
1231
1433
KThread *thread = new KThread(tmplist, sessioniface, "get_current_pm25", initCityId);
1232
1434
thread->start();
1234
// QDBusReply<QString> reply = sessioniface->call("get_current_pm25", initCityId);
1235
// return reply.value();
1238
1437
void SessionDispatcher::get_pm25_str_qt() {
1343
1531
void SessionDispatcher::initConfigFile() {
1344
// mSettings->beginGroup("account");
1345
// QString id = mSettings->value("id").toString();
1346
// if(id.isEmpty()) {
1347
// mSettings->setValue("id", "0");
1349
// QString firststart = mSettings->value("firststart").toString();
1350
// if(firststart.isEmpty()) {
1351
// firststart = "true";
1352
// mSettings->setValue("firststart", firststart);
1354
// QString current_date = mSettings->value("date").toString();
1355
// if(current_date.isEmpty()) {
1356
// current_date = this->get_currrent_date_qt();
1357
// mSettings->setValue("date", current_date);
1359
// mSettings->endGroup();
1360
// mSettings->sync();
1363
1532
mSettings->beginGroup("user");
1364
1533
QString id = mSettings->value("id").toString();
1365
1534
if(id.isEmpty()) {