DatabaseImportForm::DatabaseImportForm(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); import_thread=new QThread(this); import_helper.moveToThread(import_thread); model_wgt=nullptr; connect(close_btn, SIGNAL(clicked(bool)), this, SLOT(close(void))); connect(connect_tb, SIGNAL(clicked(bool)), this, SLOT(listDatabases(void))); connect(database_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(listObjects(void))); connect(import_sys_objs_chk, SIGNAL(clicked(bool)), this, SLOT(listObjects(void))); connect(import_ext_objs_chk, SIGNAL(clicked(bool)), this, SLOT(listObjects(void))); connect(by_oid_chk, SIGNAL(toggled(bool)), this, SLOT(filterObjects(void))); connect(expand_all_tb, SIGNAL(clicked(bool)), db_objects_tw, SLOT(expandAll(void))); connect(collapse_all_tb, SIGNAL(clicked(bool)), db_objects_tw, SLOT(collapseAll(void))); connect(db_objects_tw, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(setItemCheckState(QTreeWidgetItem*,int))); connect(select_all_tb, SIGNAL(clicked(bool)), this, SLOT(setItemsCheckState(void))); connect(clear_all_tb, SIGNAL(clicked(bool)), this, SLOT(setItemsCheckState(void))); connect(filter_edt, SIGNAL(textChanged(QString)), this, SLOT(filterObjects(void))); connect(&import_helper, SIGNAL(s_importFinished(Exception)), this, SLOT(handleImportFinished(Exception))); connect(&import_helper, SIGNAL(s_importCanceled(void)), this, SLOT(handleImportCanceled(void))); connect(&import_helper, SIGNAL(s_importAborted(Exception)), this, SLOT(captureThreadError(Exception))); connect(&import_helper, SIGNAL(s_progressUpdated(int,QString,ObjectType)), this, SLOT(updateProgress(int,QString,ObjectType))); connect(import_btn, SIGNAL(clicked(bool)), this, SLOT(importDatabase(void))); connect(cancel_btn, SIGNAL(clicked(bool)), this, SLOT(cancelImport(void))); connect(&timer, SIGNAL(timeout(void)), this, SLOT(hideProgress())); connect(import_thread, SIGNAL(started(void)), &import_helper, SLOT(importDatabase(void))); connect(import_thread, &QThread::started, [=](){ import_thread->setPriority(QThread::LowPriority); }); }
void DatabaseImportForm::createThread(void) { import_thread=new QThread; import_helper=new DatabaseImportHelper; import_helper->moveToThread(import_thread); connect(import_thread, SIGNAL(started(void)), import_helper, SLOT(importDatabase())); connect(import_helper, SIGNAL(s_importCanceled()), this, SLOT(handleImportCanceled())); connect(import_helper, SIGNAL(s_importFinished(Exception)), this, SLOT(handleImportFinished(Exception))); connect(import_helper, SIGNAL(s_importAborted(Exception)), this, SLOT(captureThreadError(Exception))); connect(import_helper, SIGNAL(s_progressUpdated(int,QString,ObjectType)), this, SLOT(updateProgress(int,QString,ObjectType)), Qt::BlockingQueuedConnection); }
ModelValidationHelper::ModelValidationHelper(void) { warn_count=error_count=progress=0; db_model=nullptr; conn=nullptr; valid_canceled=fix_mode=false; export_thread=new QThread(this); export_helper.moveToThread(export_thread); connect(&export_helper, SIGNAL(s_progressUpdated(int,QString, ObjectType)), this, SLOT(redirectExportProgress(int,QString,ObjectType))); connect(export_thread, SIGNAL(started(void)), &export_helper, SLOT(exportToDBMS(void))); connect(&export_helper, SIGNAL(s_exportFinished(void)), this, SLOT(emitValidationFinished(void))); connect(&export_helper, SIGNAL(s_exportAborted(Exception)), this, SLOT(captureThreadError(Exception))); }
ModelExportForm::ModelExportForm(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { vector<QString> versions; model=nullptr; setupUi(this); export_thread=new QThread(this); export_hlp.moveToThread(export_thread); connect(export_to_file_rb, SIGNAL(toggled(bool)), this, SLOT(enableExportMode(void))); connect(export_to_dbms_rb, SIGNAL(toggled(bool)), this, SLOT(enableExportMode(void))); connect(export_to_img_rb, SIGNAL(toggled(bool)), this, SLOT(enableExportMode(void))); connect(pgsqlvers_chk, SIGNAL(toggled(bool)), pgsqlvers1_cmb, SLOT(setEnabled(bool))); connect(close_btn, SIGNAL(clicked(bool)), this, SLOT(close(void))); connect(select_file_tb, SIGNAL(clicked(void)), this, SLOT(selectOutputFile(void))); connect(select_img_tb, SIGNAL(clicked(void)), this, SLOT(selectOutputFile(void))); connect(export_btn, SIGNAL(clicked(void)), this, SLOT(exportModel(void))); connect(&export_hlp, SIGNAL(s_progressUpdated(int,QString,ObjectType)), this, SLOT(updateProgress(int,QString,ObjectType))); connect(export_thread, SIGNAL(started(void)), &export_hlp, SLOT(exportToDBMS(void))); connect(&export_hlp, SIGNAL(s_exportFinished(void)), this, SLOT(handleExportFinished(void))); connect(&export_hlp, SIGNAL(s_exportCanceled(void)), this, SLOT(handleExportCanceled(void))); connect(&export_hlp, SIGNAL(s_exportAborted(Exception)), this, SLOT(captureThreadError(Exception))); connect(cancel_btn, SIGNAL(clicked(bool)), this, SLOT(cancelExport(void))); connect(&timer, SIGNAL(timeout(void)), this, SLOT(hideProgress())); SchemaParser::getPgSQLVersions(versions); pgsqlvers_cmb->addItems(QStringList(QList<QString>::fromVector(QVector<QString>::fromStdVector(versions)))); pgsqlvers1_cmb->addItems(QStringList(QList<QString>::fromVector(QVector<QString>::fromStdVector(versions)))); #ifdef Q_OS_WIN this->frame->setFrameShape(QFrame::WinPanel); #endif float values[]={ ModelWidget::MINIMUM_ZOOM, 0.5f, 0.75f, 1, 1.25f, 1.50f, 1.75f, 2, 2.25, 2.50, 2.75, 3, 3.25, 3.50, 3.75, ModelWidget::MAXIMUM_ZOOM }; unsigned cnt=sizeof(values)/sizeof(float); for(unsigned i=0; i < cnt; i++) zoom_cmb->addItem(QString("%1%").arg(values[i] * 100), QVariant(values[i])); zoom_cmb->setCurrentIndex(zoom_cmb->findText("100%")); }