void RemoveRedEyesWindow::startWorkerThread(const QList<QUrl>& urls)
{
    if (urls.isEmpty())
    {
        return;
    }

    if (d->busy)
    {
        return;
    }

    if (!d->locator || !d->saveMethod)
    {
        return;
    }

    if (!d->thread)
    {
        qCCritical(KIPIPLUGINS_LOG) << "Creation of WorkerThread failed!";
        setBusy(false);
        return;
    }

    // --------------------------------------------------------

    d->thread->setImagesList(urls);
    d->thread->setRunType(d->runtype);
    d->thread->loadSettings(d->settings);
    d->thread->setSaveMethod(d->saveMethod);
    d->thread->setLocator(d->locator);

    d->thread->setTempFile(d->originalImageTempFile.fileName(),  WorkerThread::OriginalImage);
    d->thread->setTempFile(d->correctedImageTempFile.fileName(), WorkerThread::CorrectedImage);
    d->thread->setTempFile(d->maskImageTempFile.fileName(),      WorkerThread::MaskImage);

    // --------------------------------------------------------

    setBusy(true);

    initProgressBar(urls.count());

    if (d->progress->isHidden())
    {
        d->progress->show();
    }

    connect(d->thread, SIGNAL(calculationFinished(WorkerThreadData*)),
            this, SLOT(calculationFinished(WorkerThreadData*)));

    // start image processing
    if (!d->thread->isRunning())
    {
        d->thread->start();
    }
}
Exemple #2
0
int PlayBack::startPlayBack()
{
	HWND hIcon;

	PlayBackPlayStatus(PlayStart);
	db_msg("xxxxxxxxxxxxxxx\n");
	SetTimer(mHwnd, PLAYBACK_TIMER, PROGRESSBAR_REFRESH_TIME);
	initProgressBar();
	mStopFlag = 0;
	start();

	return 0;
}
void HistoryDialog::init()
{
	if(mMetaContact)
	{
		HistoryLogger logger(mMetaContact, this);
		init(mMetaContact);
	}
	else
	{
		QPtrListIterator<Kopete::MetaContact> it(mMetaContactList);
		for(; it.current(); ++it)
		{
			HistoryLogger logger(*it, this);
			init(*it);
		}

	}

	initProgressBar(i18n("Loading..."),mInit.dateMCList.count());
	QTimer::singleShot(0,this,SLOT(slotLoadDays()));
}
Exemple #4
0
Btms::Btms(QWidget *parent, BtmsPage *page) :
    QMainWindow(parent),
    ui(new Ui::Btms)
{
    ui->setupUi(this);
    initProgressBar();

    systray = new QSystemTrayIcon(this);
    systray->setIcon(QIcon(QPixmap("://images/bus.ico")));

    ui->webView->setAttribute(Qt::WA_DeleteOnClose, true);

    if(page != 0) {
        ui->webView->setPage(page);
    } else {
        Btms::showMaximized();
        ui->webView->setPage(new BtmsPage(ui->webView));
        ui->webView->load(QUrl(BtmsSettings::Config->value("system/launch").toString()));
    }

    loadWebSettings();
}
/*
* How does the search work
* ------------------------
* We do the search respecting the current metacontact filter item. To do this, we iterate over the
* elements in the KListView (KListViewDateItems) and, for each one, we iterate over its subcontacts,
* manually searching the log files of each one. To avoid searching files twice, the months that have
* been searched already are stored in searchedMonths. The matches are placed in the matches QMap.
* Finally, the current date item is checked in the matches QMap, and if it is present, it is shown.
*
* Keyword highlighting is done in setMessages() : if the search field isn't empty, we highlight the
* search keyword.
*
* The search is _not_ case sensitive
*/
void HistoryDialog::slotSearch()
{
	if (mMainWidget->dateListView->childCount() == 0) return;

	QRegExp rx("^ <msg.*time=\"(\\d+) \\d+:\\d+:\\d+\" >([^<]*)<");
	QMap<QDate, QValueList<Kopete::MetaContact*> > monthsSearched;
	QMap<QDate, QValueList<Kopete::MetaContact*> > matches;

	// cancel button pressed
	if (mSearching)
	{
		listViewShowElements(true);
		goto searchFinished;
	}

	listViewShowElements(false);

	initProgressBar(i18n("Searching..."), mMainWidget->dateListView->childCount());
	mMainWidget->searchButton->setText(i18n("&Cancel"));
	mSearching = true;

	// iterate over items in the date list widget
	for(KListViewDateItem *curItem = static_cast<KListViewDateItem*>(mMainWidget->dateListView->firstChild());
		curItem != 0;
		curItem = static_cast<KListViewDateItem *>(curItem->nextSibling())
	)
	{
		qApp->processEvents();
		if (!mSearching) return;

		QDate month(curItem->date().year(),curItem->date().month(),1);
		// if we haven't searched the relevant history logs, search them now
		if (!monthsSearched[month].contains(curItem->metaContact()))
		{
			monthsSearched[month].push_back(curItem->metaContact());
			QPtrList<Kopete::Contact> contacts = curItem->metaContact()->contacts();
			for(QPtrListIterator<Kopete::Contact> it( contacts ); it.current(); ++it)
			{
				// get filename and open file
				QString filename(HistoryLogger::getFileName(*it, curItem->date()));
				if (!QFile::exists(filename)) continue;
				QFile file(filename);
				file.open(IO_ReadOnly);
				if (!file.isOpen())
				{
					kdWarning(14310) << k_funcinfo << "Error opening " <<
							file.name() << ": " << file.errorString() << endl;
					continue;
				}

				QTextStream stream(&file);
				QString textLine;
				while(!stream.atEnd())
				{
					textLine = stream.readLine();
					if (textLine.contains(mMainWidget->searchLine->text(), false))
					{
						if(rx.search(textLine) != -1)
						{
							// only match message body
							if (rx.cap(2).contains(mMainWidget->searchLine->text()))
								matches[QDate(curItem->date().year(),curItem->date().month(),rx.cap(1).toInt())].push_back(curItem->metaContact());
						}
						// this will happen when multiline messages are searched, properly
						// parsing the files would fix this
						else { }
					}
					qApp->processEvents();
					if (!mSearching) return;
				}
				file.close();
			}
		}

		// relevant logfiles have been searched now, check if current date matches
		if (matches[curItem->date()].contains(curItem->metaContact()))
			curItem->setVisible(true);

		// Next date item
		mMainWidget->searchProgress->advance(1);
	}

searchFinished:
	mMainWidget->searchButton->setText(i18n("Se&arch"));
	mSearching = false;
	doneProgressBar();
}