MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->setWindowTitle("Userfields Interface"); init_flag=0; //ui->tableWidget->hideColumn(0); QFile config_file(".\\config.ini"); QSettings setting(".\\config.ini",QSettings::IniFormat); if (!config_file.exists() || setting.status() != QSettings::NoError) { setting.setValue("filename","C:/program Files (x86)/Zeiss/CALYPSO 5.4/opt/om/protform/userfields.ini"); } fileName = setting.value("filename").toString(); QFile origin_name(fileName); if (!origin_name.exists()) { if (origin_name.copy(":/userfields.ini",fileName)) { QMessageBox msgbox(QMessageBox::Warning, tr("Warning"), tr("as your file didn't exist.\nI use a default one to instead."),0,this); msgbox.addButton(tr("Continue"), QMessageBox::AcceptRole); msgbox.exec(); } } origin_name.setPermissions(QFile::Permission(0x7777)); origin_name.remove("./qt_settings_format.ini"); origin_name.copy("./qt_settings_format.ini"); QFile temp_file("./qt_settings_format.ini"); temp_file.setPermissions(QFile::Permission(0x7777)); calypso = new QSettings("./qt_settings_format.ini",QSettings::IniFormat); all_list = calypso->childGroups(); QString str; foreach(str,all_list) { calypso->beginGroup(str); QStringList sub_list = calypso->childKeys(); calypso->endGroup(); if (sub_list.contains("name")) u_field_list.push_back(str); else u_value_list.push_back(str); }
void send_dumped_file(FiletransferOptions const *opts,char *dst_tosend) { char *fn = origin_name(dst_tosend); DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("dlt-system-filetransfer, sending dumped file:"),DLT_STRING(fn)); if(dlt_user_log_file_header_alias(&filetransferContext, dst_tosend, fn) == 0) { int pkgcount = dlt_user_log_file_packagesCount(&filetransferContext, dst_tosend); int lastpkg = 0; int success = 1; while(lastpkg < pkgcount) { int total = 2; int used = 2; dlt_user_check_buffer(&total, &used); while((total-used) < (total/2)) { struct timespec t; t.tv_sec = 0; t.tv_nsec = 1000000ul*opts->TimeoutBetweenLogs; nanosleep(&t, NULL); dlt_user_check_buffer(&total, &used); } lastpkg++; if(dlt_user_log_file_data(&filetransferContext, dst_tosend, lastpkg, opts->TimeoutBetweenLogs) < 0) { success = 0; break; } } if (success) dlt_user_log_file_end(&filetransferContext, dst_tosend, 1); } DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("dlt-system-filetransfer, sent dumped file")); }