frmNapiProjektUpload::frmNapiProjektUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory())); connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged())); connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked())); connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool))); connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString))); connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked())); connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished())); connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int))); connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString))); connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass())); connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass())); if(QFileInfo(GlobalConfig().previousDialogPath()).isDir()) ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath()); QRect position = frameGeometry(); position.moveCenter(QDesktopWidget().availableGeometry().center()); move(position.topLeft()); }
frmUpload::frmUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { ui.setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory())); connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged())); connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked())); connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool))); connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString))); connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked())); connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished())); connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int))); connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString))); connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass())); connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass())); if(QFileInfo(GlobalConfig().previousDialogPath()).isDir()) ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath()); // workaround dla compiza? move((QApplication::desktop()->width() - width()) / 2, (QApplication::desktop()->height() - height()) / 2); }
bool ScanThread::doScan(const QString & path, QDir::Filters filters) { QString myPath = QFileInfo(path).absoluteFilePath(); if(!QDir().exists(myPath)) return false; QString myCPath = QDir(path).canonicalPath(); if(visited.contains(myCPath)) return true; visited << myCPath; emit folderChange(myPath); ++folders; QFileInfoList list = QDir(myPath).entryInfoList(searchFilters, filters); for(QFileInfoList::iterator p=list.begin(); p != list.end(); p++) { if(abort) return false; if((*p).isDir() && ((*p).absoluteFilePath() != myPath)) { if(!doScan((*p).absoluteFilePath(), filters)) return false; } else { if(!QFile::exists((*p).absoluteFilePath())) continue; ++movies; if(QFile::exists((*p).absolutePath() + "/" + (*p).completeBaseName() + ".txt")) { ++subtitles; fileList << (*p).absoluteFilePath(); } } } return true; }