ImportedBookmarksPreviewDialog::ImportedBookmarksPreviewDialog(DatabaseManager* dbm, BookmarkImporter* bmim, ImportedEntityList* elist, QWidget *parent) : QDialog(parent), ui(new Ui::ImportedBookmarksPreviewDialog), dbm(dbm) , canShowTheDialog(false), elist(elist) { ui->setupUi(this); setWindowTitle(QString(windowTitle() + " (%1 bookmarks)").arg(elist->iblist.size())); //With only stretches applied to the layout, the left widget changed size on each bookmark select // with different types (e.g exactly similar, already similar etc). We need to fix the size. int sizeForDPI = 300 * (qApp->screens()[0]->logicalDotsPerInch() / 96.0); ui->widLeftPane->setFixedWidth(sizeForDPI); ui->leTagsForAll->setModel(&dbm->tags.model); ui->leTagsForAll->setModelColumn(dbm->tags.tidx.TagName); ui->leTagsForBookmark->setModel(&dbm->tags.model); ui->leTagsForBookmark->setModelColumn(dbm->tags.tidx.TagName); ui->leTagsForFolder->setModel(&dbm->tags.model); ui->leTagsForFolder->setModelColumn(dbm->tags.tidx.TagName); ui->grpBookmarkProps->setVisible (false); ui->grpDuplBookmarkProps->setVisible (false); ui->grpDuplBookmarkSameProps->setVisible(false); ui->grpBookmarkFolderProps->setVisible (false); connect(ui->chkImportBookmark, SIGNAL(toggled(bool)), ui->leTagsForBookmark, SLOT(setEnabled(bool))); connect(ui->chkImportFolder , SIGNAL(toggled(bool)), ui->leTagsForFolder , SLOT(setEnabled(bool))); m_bookmarksProcessor = new ImportedBookmarksProcessor(dbm->conf->concurrentBookmarkProcessings, bmim, this, this); connect(m_bookmarksProcessor, SIGNAL(ProcessingDone()), this, SLOT(ProcessingDone())); connect(m_bookmarksProcessor, SIGNAL(ProcessingCanceled()), this, SLOT(ProcessingCanceled())); connect(m_bookmarksProcessor, SIGNAL(ImportedBookmarkProcessed(ImportedBookmark*,bool)), this, SLOT(ImportedBookmarkProcessed(ImportedBookmark*,bool))); icon_folder = QIcon(":/res/import_folder.png"); icon_folderdontimport = QIcon(":/res/import_folderdontimport.png"); icon_dontimport = QIcon(":/res/import_dontimport.png"); icon_okay = QIcon(":/res/import_ok.png"); icon_similar = QIcon(":/res/import_duplicate_similar.png"); icon_exact = QIcon(":/res/import_duplicate_exact.png"); icon_overwrite = QIcon(":/res/import_overwrite.png"); icon_append = QIcon(":/res/import_append.png"); icon_waiting = QIcon(":/res/import_waiting.png"); icon_fail = QIcon(":/res/import_fail.png"); //Initialize the data we will need during the conversion. for (int i = 0; i < elist->ibflist.size(); i++) folderItemsIndexInArray[elist->ibflist[i].intId] = i; AddItems(); canShowTheDialog = true; }
void __cdecl WorkerThread(void *unused) { int task,ret,firstTime; ts=time(NULL); AddToStatus(STATUS_MESSAGE,TranslateT("Database worker thread activated")); SetFilePointer(opts.hFile,0,NULL,FILE_BEGIN); spaceUsed=1; spaceProcessed=0; sp=0; firstTime=0; for(task=0;;) { if (spaceProcessed/(spaceUsed/1000+1) > sp) { sp = spaceProcessed/(spaceUsed/1000+1); SetProgressBar(sp); } WaitForSingleObject(hEventRun,INFINITE); if(WaitForSingleObject(hEventAbort,0)==WAIT_OBJECT_0) { AddToStatus(STATUS_FATAL,TranslateT("Processing aborted by user")); break; } ret=Workers[task](firstTime); firstTime=0; if(ret==ERROR_NO_MORE_ITEMS) { if(++task==sizeof(Workers)/sizeof(Workers[0])) { AddToStatus(STATUS_MESSAGE,TranslateT("Elapsed time: %d sec"), time(NULL)-ts); if(errorCount) AddToStatus(STATUS_SUCCESS,TranslateT("All tasks completed but with errors (%d)"),errorCount); else AddToStatus(STATUS_SUCCESS,TranslateT("All tasks completed successfully")); break; } firstTime=1; } else if(ret!=ERROR_SUCCESS) break; } ProcessingDone(); }