void IOThread::run() { while (1) { Request r = queue.pull(); switch (r.type) { case Stop: return; case Load: if (queue.size() < 8) { // start ignoring old loads if I get hammered with requests r.image->load(); emit loadFinished(r.image); break; } case Save: r.image->save(); emit saveFinished(r.image); break; case LoadThumbnail: if (queue.size() < 8) { // start ignoring old loads if I get hammered with requests r.image->loadThumbnail(); emit loadFinished(r.image); break; } case Demosaic: r.image->demosaic(); emit demosaicFinished(); break; } } }
PluginDialog::PluginDialog(FcitxQtConfigUIWidget* widget, QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) ,m_widget(widget) { setWindowTitle(widget->title()); setWindowIcon(QIcon::fromTheme(widget->icon())); QHBoxLayout* dialogLayout = new QHBoxLayout; setLayout(dialogLayout); m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults); dialogLayout->addWidget(m_widget); dialogLayout->addWidget(m_buttonBox); connect(m_widget, SIGNAL(changed(bool)), this, SLOT(changed(bool))); if (m_widget->asyncSave()) connect(m_widget, SIGNAL(saveFinished()), this, SLOT(saveFinished())); connect(m_buttonBox, &QDialogButtonBox::clicked, this, [this](QAbstractButton* button) { slotButtonClicked(m_buttonBox->standardButton(button)); }); connect(m_buttonBox, &QDialogButtonBox::accepted, this, &PluginDialog::accept); connect(m_buttonBox, &QDialogButtonBox::rejected, this, &PluginDialog::reject); }
void Minutor::savePNG(QString filename, bool autoclose, bool regionChecker, bool chunkChecker) { progressAutoclose = autoclose; if (!filename.isEmpty()) { WorldSave *ws = new WorldSave(filename, mapview, regionChecker, chunkChecker); progress = new QProgressDialog(); progress->setCancelButton(NULL); progress->setMaximum(100); progress->show(); connect(ws, SIGNAL(progress(QString, double)), this, SLOT(saveProgress(QString, double))); connect(ws, SIGNAL(finished()), this, SLOT(saveFinished())); QThreadPool::globalInstance()->start(ws); }