: Plugin( parent, name ) { // Instantiate all of your actions here. These will appear in // Konqueror's menu and toolbars. (void) new KAction( i18n("&Plugin Action"), "${APP_NAME_LC}", 0, this, SLOT(slotAction()), actionCollection(), "plugin_action" ); }
void PreProcessingPage::cancel() { disconnect(d->mngr->thread(), SIGNAL(finished(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); d->mngr->thread()->cancel(); d->progressTimer->stop(); d->progressLabel->clear(); resetTitle(); }
ItemsPage::ItemsPage(Manager* const mngr, KAssistantDialog* const dlg) : KPWizardPage(dlg, i18n("<b>Set Bracketed Images</b>")), d(new ItemsPagePriv) { d->mngr = mngr; KVBox* vbox = new KVBox(this); QLabel* label1 = new QLabel(vbox); label1->setWordWrap(true); label1->setText(i18n("<qt>" "<p>Set here the list of your bracketed images to fuse. Please follow these conditions:</p>" "<ul><li>At least 2 images from the same subject must be added to the stack.</li>" "<li>Do not mix images with different color depth.</li>" "<li>All images must have the same dimensions.</li></ul>" "</qt>")); d->list = new KPImagesList(vbox); d->list->listView()->setColumn(KPImagesListView::User1, i18n("Exposure (EV)"), true); d->list->slotAddImages(d->mngr->itemsList()); setPageWidget(vbox); QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_expoblending/pics/assistant-stack.png"); setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation)); connect(d->mngr->thread(), SIGNAL(starting(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); connect(d->mngr->thread(), SIGNAL(finished(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); connect(d->list, SIGNAL(signalAddItems(KUrl::List)), this, SLOT(slotAddItems(KUrl::List))); connect(d->list, SIGNAL(signalImageListChanged()), this, SLOT(slotImageListChanged())); QTimer::singleShot(0, this, SLOT(slotSetupList())); }
PreProcessingPage::PreProcessingPage(Manager* const mngr, KAssistantDialog* const dlg) : KPWizardPage(dlg, i18n("<b>Pre-Processing Bracketed Images</b>")), d(new PreProcessingPagePriv) { d->mngr = mngr; d->progressTimer = new QTimer(this); KVBox *vbox = new KVBox(this); d->title = new QLabel(vbox); d->title->setWordWrap(true); d->title->setOpenExternalLinks(true); d->alignCheckBox = new QCheckBox(i18n("Align bracketed images"), vbox); KConfig config("kipirc"); KConfigGroup group = config.group(QString("ExpoBlending Settings")); d->alignCheckBox->setChecked(group.readEntry("Auto Alignment", true)); QLabel* space1 = new QLabel(vbox); KHBox* hbox = new KHBox(vbox); d->detailsBtn = new QPushButton(hbox); d->detailsBtn->setText(i18n("Details...")); d->detailsBtn->hide(); QLabel* space2 = new QLabel(hbox); hbox->setStretchFactor(space2, 10); QLabel* space3 = new QLabel(vbox); d->progressLabel = new QLabel(vbox); d->progressLabel->setAlignment(Qt::AlignCenter); QLabel* space4 = new QLabel(vbox); vbox->setStretchFactor(space1, 2); vbox->setStretchFactor(space3, 2); vbox->setStretchFactor(space4, 10); vbox->setSpacing(KDialog::spacingHint()); vbox->setMargin(KDialog::spacingHint()); setPageWidget(vbox); resetTitle(); QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_expoblending/pics/assistant-preprocessing.png"); setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation)); connect(d->mngr->thread(), SIGNAL(starting(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); connect(d->progressTimer, SIGNAL(timeout()), this, SLOT(slotProgressTimerDone())); connect(d->detailsBtn, SIGNAL(clicked()), this, SLOT(slotShowDetails())); }
void PreProcessingPage::process() { d->title->setText(i18n("<qt>" "<p>Pre-processing is under progress, please wait.</p>" "<p>This can take a while...</p>" "</qt>")); d->alignCheckBox->hide(); d->progressTimer->start(300); connect(d->mngr->thread(), SIGNAL(finished(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); d->mngr->thread()->setPreProcessingSettings(d->alignCheckBox->isChecked(), d->mngr->rawDecodingSettings()); d->mngr->thread()->preProcessFiles(d->mngr->itemsList(), d->mngr->alignBinary().path()); if (!d->mngr->thread()->isRunning()) d->mngr->thread()->start(); }
bool OptimizePage::cancel() { d->canceled = true; disconnect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->mngr->thread()->cancel(); QMutexLocker lock(&d->progressMutex); if (d->progressTimer->isActive()) { d->progressTimer->stop(); d->progressLabel->clear(); resetTitle(); return false; } return true; }
void OptimizePage::process() { QMutexLocker lock(&d->progressMutex); d->title->setText(i18n("<qt>" "<p>Optimization is in progress, please wait.</p>" "<p>This can take a while...</p>" "</qt>")); d->horizonCheckbox->hide(); d->projectionAndSizeCheckbox->hide(); d->progressTimer->start(300); connect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->mngr->thread()->optimizeProject(d->mngr->cpFindUrl(), d->horizonCheckbox->isChecked(), d->projectionAndSizeCheckbox->isChecked(), d->mngr->autoOptimiserBinary().path()); if (!d->mngr->thread()->isRunning()) d->mngr->thread()->start(); }
void PreProcessingPage::process() { QMutexLocker lock(&d->progressMutex); d->title->setText(i18n("<qt>" "<p>Pre-processing is in progress, please wait.</p>" "<p>This can take a while...</p>" "</qt>")); d->celesteCheckBox->hide(); d->progressTimer->start(300); connect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->mngr->thread()->setPreProcessingSettings(d->celesteCheckBox->isChecked(), d->mngr->hdr(), d->mngr->format(), d->mngr->rawDecodingSettings()); d->mngr->thread()->preProcessFiles(d->mngr->itemsList(), d->mngr->cpCleanBinary().path(), d->mngr->cpFindBinary().path()); if (!d->mngr->thread()->isRunning()) d->mngr->thread()->start(); }
void OptimizePage::slotAction(const KIPIPanoramaPlugin::ActionData& ad) { QString text; QMutexLocker lock(&d->progressMutex); if (!ad.starting) // Something is complete... { if (!ad.success) // Something is failed... { if (d->canceled) // In that case, the error is expected { return; } switch (ad.action) { case(OPTIMIZE): { disconnect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->title->setText(i18n("<qt>" "<p>Optimization has failed.</p>" "<p>Press \"Details\" to show processing messages.</p>" "</qt>")); d->progressTimer->stop(); d->horizonCheckbox->hide(); d->projectionAndSizeCheckbox->hide(); d->detailsBtn->show(); d->progressLabel->clear(); d->output = ad.message; emit signalOptimized(KUrl()); break; } default: { kWarning() << "Unknown action " << ad.action; break; } } } else // Something is done... { switch (ad.action) { case(OPTIMIZE): { disconnect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->progressTimer->stop(); d->progressLabel->clear(); emit signalOptimized(ad.ptoUrl); break; } default: { kWarning() << "Unknown action " << ad.action; break; } } } } }
void QueueMgrWindow::setupConnections() { // -- Assigned tools list connections ----------------------------------- connect(d->assignedList, SIGNAL(signalToolSelected(BatchToolSet)), d->toolSettings, SLOT(slotToolSelected(BatchToolSet))); connect(d->assignedList, SIGNAL(signalAssignedToolsChanged(AssignedBatchTools)), d->queuePool, SLOT(slotAssignedToolsChanged(AssignedBatchTools))); connect(d->toolSettings, SIGNAL(signalSettingsChanged(BatchToolSet)), d->assignedList, SLOT(slotSettingsChanged(BatchToolSet))); connect(d->assignedList, SIGNAL(signalAssignedToolsChanged(AssignedBatchTools)), this, SLOT(slotAssignedToolsChanged(AssignedBatchTools))); connect(d->toolsView, SIGNAL(signalAssignTools(QMap<int,QString>)), d->assignedList, SLOT(slotAssignTools(QMap<int,QString>))); // -- Queued Items list connections ------------------------------------- connect(d->queuePool, SIGNAL(signalQueueSelected(int,QueueSettings,AssignedBatchTools)), d->queueSettingsView, SLOT(slotQueueSelected(int,QueueSettings,AssignedBatchTools))); connect(d->queuePool, SIGNAL(signalQueueSelected(int,QueueSettings,AssignedBatchTools)), d->assignedList, SLOT(slotQueueSelected(int,QueueSettings,AssignedBatchTools))); connect(d->queueSettingsView, SIGNAL(signalSettingsChanged(QueueSettings)), d->queuePool, SLOT(slotSettingsChanged(QueueSettings))); connect(d->queueSettingsView, SIGNAL(signalSettingsChanged(QueueSettings)), this, SLOT(slotQueueContentsChanged())); connect(d->queuePool, SIGNAL(signalQueueSelected(int,QueueSettings,AssignedBatchTools)), this, SLOT(slotQueueContentsChanged())); connect(d->queuePool, SIGNAL(signalQueuePoolChanged()), this, SLOT(slotQueueContentsChanged())); connect(d->queuePool, SIGNAL(signalQueueContentsChanged()), this, SLOT(slotQueueContentsChanged())); connect(d->queuePool, SIGNAL(signalItemSelectionChanged()), this, SLOT(slotItemSelectionChanged())); // -- Multithreaded interface connections ------------------------------- connect(d->thread, SIGNAL(signalStarting(Digikam::ActionData)), this, SLOT(slotAction(Digikam::ActionData))); connect(d->thread, SIGNAL(signalFinished(Digikam::ActionData)), this, SLOT(slotAction(Digikam::ActionData))); connect(d->thread, SIGNAL(signalQueueProcessed()), this, SLOT(slotQueueProcessed())); // -- GUI connections --------------------------------------------------- connect(d->toolsView, SIGNAL(signalHistoryEntryClicked(int,qlonglong)), this, SLOT(slotHistoryEntryClicked(int,qlonglong))); connect(d->toolsView, SIGNAL(signalAssignQueueSettings(QString)), this, SLOT(slotAssignQueueSettings(QString))); }
// Remove forwards void * removeForwards (Proto proto) { int i, j, k; Proto newObj; Proto blob; Proto tmp; ProtoSlot slotPtr; // Determine the type of reference this is i = PROTO_REFTYPE(proto); if (proto == nil) { return proto; } switch (i) { case PROTO_REF_PROTO: case PROTO_REF_BLOCK: case PROTO_REF_CODE: // If this is a forward, flatten it while (PROTO_ISFORWARDER(proto)) { proto = PROTO_FORWARDVALUE(proto); } // enumerate through the proto j = 0; while (1) { slotPtr = objectEnumerate(proto, &j, 1); if (slotPtr == nil) { break; } k = slotAction(slotPtr); switch (k) { case PROTO_ACTION_GET: case PROTO_ACTION_SET: case PROTO_ACTION_PASSTHRU: // Access the data and print it newObj = removeForwards(protoSlotData(proto, slotPtr)); objectSetSlot(proto, (Atom) slotKey(slotPtr), k, (uint32) newObj); break; } } i = objectGetSlot(proto, ATOMsize, &tmp); if (i) { i = objectGetSlot(proto, ATOM_array, &blob); assert(i); j = objectIntegerValue(tmp); for (i = 0; i <= j; i++) { tmp = objectBlobAtGet(blob, i); newObj = removeForwards(tmp); objectBlobAtSet(blob, i, newObj); } } break; } return proto; }
void PreProcessingPage::slotAction(const KIPIPanoramaPlugin::ActionData& ad) { kDebug() << "SlotAction"; QString text; QMutexLocker lock(&d->progressMutex); if (!ad.starting) // Something is complete... { if (!ad.success) // Something is failed... { if (d->canceled) // In that case, the error is expected { return; } switch (ad.action) { case PREPROCESS_INPUT: case CREATEPTO: case CPFIND: case CPCLEAN: { disconnect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->title->setText(i18n("<qt>" "<p>Pre-processing has failed.</p>" "<p>Press \"Details\" to show processing messages.</p>" "</qt>")); d->progressTimer->stop(); d->celesteCheckBox->hide(); d->detailsBtn->show(); d->progressLabel->clear(); d->output = ad.message; emit signalPreProcessed(false); break; } default: { kWarning() << "Unknown action " << ad.action; break; } } } else // Something is done... { switch (ad.action) { case PREPROCESS_INPUT: { // QMutexLocker nbProcessed(&d->nbFilesProcessed_mutex); // d->nbFilesProcessed++; break; } case CREATEPTO: case CPFIND: { // Nothing to do, that just another step towards the end break; } case CPCLEAN: { disconnect(d->mngr->thread(), SIGNAL(finished(KIPIPanoramaPlugin::ActionData)), this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData))); d->progressTimer->stop(); d->progressLabel->clear(); emit signalPreProcessed(true); break; } default: { kWarning() << "Unknown action " << ad.action; break; } } } } }
Pong::Pong(QRect rect, QObject * parent) : QGraphicsScene(rect, parent) { setBackgroundBrush(QBrush(Qt::black)); mSeed = (uint) QTime::currentTime().msec(); mRect = rect; mMode = MODE_SINGLE; mThisPIsLeftP = true; mStoppable = false; mPort = NULL; mStirr = 15; mStirrAngle = 135; mSpeedX = 10; mSpeedY = 10; mMaxSpeedX = 20; mMaxSpeedY = 20; mMinSpeedX = 1; mMinSpeedY = 1; mFrequency = 35; mActionPeriod = 15; mNumberOfBalls = 5; mPoints = 10; mPaddleHeight = 96; mPaddleInc = mPaddleHeight / 1.5; mLeftP = new Player(); mLeftP->r = new QGraphicsRectItem(0, 0, mRect.width() / 25, mRect.height() / 5); mLeftP->r->setPos(mLeftP->r->x(), mRect.height() / 2 - mLeftP->r->rect().height() / 2); mLeftP->r->setBrush(QBrush(PLAYER_BRUSH_COLOR)); addItem(mLeftP->r); mRightP = new Player(); mRightP->r = new QGraphicsRectItem(0, 0, mRect.width() / 25, mRect.height() / 5); mRightP->r->setPos(mRect.width() - mRightP->r->rect().width(), mRect.height() / 2 - mRightP->r->rect().height() / 2); mRightP->r->setBrush(QBrush(PLAYER_BRUSH_COLOR)); addItem(mRightP->r); dsmax = (qreal) (mMaxSpeedX - mSpeedX) / (mActionPeriod * mFrequency); dsmin = (qreal) (mSpeedX - mMinSpeedX) / (mActionPeriod * mFrequency); mScoreTextGroup = new QGraphicsItemGroup(); mSeparator = new QGraphicsSimpleTextItem(); mSeparator->setText(":"); mSeparator->setPen(QPen(Qt::black)); mSeparator->setBrush(QBrush(Qt::white)); mSeparator->setFont(QFont("Comic Sans", 25, QFont::Black)); mSeparator->setPos(mRect.width() / 2 - mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mSeparator); mLeftPScoreText = new QGraphicsSimpleTextItem(); mLeftPScoreText->setText("0"); mLeftPScoreText->setPen(QPen(Qt::black)); mLeftPScoreText->setBrush(QBrush(Qt::white)); mLeftPScoreText->setFont(QFont("Comic Sans", 25, QFont::Black)); mLeftPScoreText->setPos(mRect.width() / 2 - mLeftPScoreText->boundingRect().width() - mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mLeftPScoreText); mRightPScoreText = new QGraphicsSimpleTextItem(); mRightPScoreText->setText("0"); mRightPScoreText->setPen(QPen(Qt::black)); mRightPScoreText->setBrush(QBrush(Qt::white)); mRightPScoreText->setFont(QFont("Comic Sans", 25, QFont::Black)); mRightPScoreText->setPos(mRect.width() / 2 + mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mRightPScoreText); addItem(mScoreTextGroup); mTimer = new QTimer(this); connect(mTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); mActionTimer = new QTimer(this); connect(mActionTimer, SIGNAL(timeout()), this, SLOT(slotAction())); slotNewGame(); }