void Progression::onRemoveLabel(QString name) { qDebug() << "trying to remove label and progress bar for :" << name; for(int i = 0; i < vbl->count(); i++) { QLayoutItem* item = vbl->itemAt(i); QWidget* widget = item->widget(); if (widget) { QLabel *label = qobject_cast<QLabel *>(widget); if(label and label->objectName() == name ) { label->hide(); vbl->removeItem(item); qDebug() << "Remove Label"; i--; } QProgressBar * pb = qobject_cast<QProgressBar *>(widget); if(pb and pb->objectName() == name) { pb->hide(); vbl->removeItem(item); qDebug() << "Remove Progbar"; i--; } } } this->adjustSize(); }
void BrowserView::onLoadFinished(bool ok) { if (ok) { QProgressBar* bar = Sequencer::instance()->getProgressBar(); bar->setValue(100); bar->hide(); getMainWindow()->showMessage(QString()); } isLoading = false; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->textBrowser->setFont(QFont("Monospace",11)); ui->textBrowser->setLineWrapMode(QTextEdit::NoWrap); updater->moveToThread(pthread); fileTotal->moveToThread(fthread); //User selects directory, or action connect(this,SIGNAL(userSelect(QString)),updater,SLOT(action(QString))); connect(this,SIGNAL(selectDir(QString)),updater,SLOT(selectDir(QString))); connect(this,SIGNAL(selectDir(QString)),fileTotal,SLOT(selectDir(QString))); //Returning from Worker Thread connect(updater,SIGNAL(Finished(QString)),this,SLOT(action(QString))); //Clean up threads connect(updater,SIGNAL(close()),pthread,SLOT(quit())); connect(pthread, SIGNAL(finished()), updater, SLOT(deleteLater())); connect(fileTotal,SIGNAL(close()),fthread,SLOT(quit())); connect(fthread,SIGNAL(finished()),fileTotal,SLOT(deleteLater())); //Start Thread(s) pthread->start(); fthread->start(); //Get number of files in directory for progress bar //connect(this,SIGNAL(getfileTotal()),updater,SLOT(getfileTotal())); connect(this,SIGNAL(getfileTotal(QString)),fileTotal,SLOT(getfileTotal(QString))); //request from main thread connect(fileTotal,SIGNAL(finished(int)),updater,SLOT(getfileTotal(int))); //transfer total from getfiletotal object to worker object connect(updater,SIGNAL(getfileTotal(QString)),fileTotal,SLOT(getfileTotal(QString))); //request from updater connect(updater,SIGNAL(displayFileTotal(int)),this,SLOT(displayFileTotal(int))); connect(fileTotal,SIGNAL(finished(int)),this,SLOT(enableButton())); //Create ProgressBar QProgressBar *bar = new QProgressBar(ui->statusBar); ui->statusBar->addWidget(bar); bar->setRange(0,100); bar->setValue(0); bar->hide(); connect(updater,SIGNAL(percentChanged(int)),bar,SLOT(setValue(int))); connect(updater,SIGNAL(percentChanged(int)),bar,SLOT(show())); connect(this,SIGNAL(hidebar()),bar,SLOT(hide())); //fileTotal->getfileTotal(); emit getfileTotal(dirSelect); ui->pushButton->setEnabled(false); //TABLE FUNZ QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+C"), this); connect(shortcut,SIGNAL(activated()),this,SLOT(on_actionCopy_triggered())); // ui->tableWidget->setColumnCount(3); // ui->tableWidget->setRowCount(100); // ui->tableWidget->setHorizontalHeaderLabels(QStringList() << "File" << "Hash" << "Check"); // ui->tableWidget->horizontalHeader()->setStretchLastSection(true); // ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch); }