示例#1
0
void FaceDetector::slotContinueAlbumListing()
{
    kDebug() << d->albumListing.isRunning() << !d->pipeline.hasFinished();

    // we get here by the finished signal from both, and want both to have finished to continue
    if (d->albumListing.isRunning() || !d->pipeline.hasFinished())
    {
        return;
    }

    // list can have null pointer if album was deleted recently
    Album* album = 0;

    do
    {
        if (d->albumTodoList.isEmpty())
        {
            return slotDone();
        }

        album = d->albumTodoList.takeFirst();
    }
    while (!album);

    d->albumListing.allItemsFromAlbum(album);
}
void VKAuth::slotLinkChanged(QUrl url)
{
    if ("/blank.html" == url.path()) {
        QRegExp regexp("access_token=([^,]+)&expires_in=([^,]+)&user_id=([^,]+)");

        QString str= url.fragment();

        if( -1 != regexp.indexIn(str) ){
            QString access_token = regexp.cap(1);
            QString expires_in = regexp.cap(2);
            QString user_id = regexp.cap(3);

            QUrl request(QString("https://api.vk.com/method/%1.xml?").arg("friends.get"));
            request.addQueryItem("user_id", user_id);
            request.addQueryItem("fields", "online");
            request.addQueryItem("v", "5.2");
            request.addQueryItem("access_token", access_token);

            QNetworkAccessManager *manager = new QNetworkAccessManager(this);
            m_http = manager->get(QNetworkRequest(request));
            QObject::connect(m_http, SIGNAL(finished()), this, SLOT(slotDone()));
        }
    }
    else if("/api/login_failure.html" == url.path()){
        emit unsuccess();
    }
}
void DescrGeneratorInterface::slotCrea()
{
    if (verificaCampi())
    {
        if (worker_thread == 0 && generator == 0)
        {
            saveConfig();

            openDB::BackendConnector* connector = &parentWindow->backendConnector();
            std::string cat_merc = editCatMerc->text().toStdString();
            std::string natura = editNatura->text().toStdString();
            std::string mainTemFile = editMainTemplate->text().toStdString();
            std::string resTempFile = editResourcesTemplate->text().toStdString();
            std::string videoResTempFile = editVideoResourcesTemplate->text().toStdString();
            std::string videoTempFile = editVideoTemplate->text().toStdString();
            std::string destinationFile = editFile->text().toStdString();

            generator = new DescrGenerator(connector, cat_merc, natura, mainTemFile, resTempFile, videoResTempFile, videoTempFile, destinationFile);
            worker_thread = new QThread;
            generator->moveToThread(worker_thread);

            connect (worker_thread, SIGNAL(started()), generator, SLOT(start()));
            connect (generator, SIGNAL(totalRecords(unsigned int)), this, SLOT(slotTotal(unsigned int)));
            connect (generator, SIGNAL(incProgress()), this, SLOT(slotIncProgress()));
            connect (generator, SIGNAL(done()), this, SLOT(slotDone()));

            worker_thread->start();
        }
        else
示例#4
0
LightDialog::LightDialog(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f) 
  : QDialog(parent, name, f) {
  assert(doc != NULL);
  p_Doc = doc;
  p_Behavior = NULL;

  QLabel * labelR = new QLabel("r", this);
  QLabel * labelG = new QLabel("g", this);
  QLabel * labelB = new QLabel("b", this);
  QLabel * labelX = new QLabel("x", this);
  QLabel * labelY = new QLabel("y", this);
  QLabel * labelZ = new QLabel("z", this);
  p_EditR = new QLineEdit(this);
  p_EditG = new QLineEdit(this);
  p_EditB = new QLineEdit(this);
  p_EditX = new QLineEdit(this);
  p_EditY = new QLineEdit(this);
  p_EditZ = new QLineEdit(this);
  p_BoxBlink = new QCheckBox("blink", this);
  p_SpinDelay = new QSpinBox(10, 100, 10, this);

  QPushButton * donebutton = new QPushButton("ok", this);
  connect(donebutton, SIGNAL(clicked()), this, SLOT(slotDone()));
  QPushButton * removebutton = new QPushButton("remove light", this);
  connect(removebutton, SIGNAL(clicked()), this, SLOT(slotRemove()));
  QPushButton * cancelbutton = new QPushButton("cancel", this);
  connect(cancelbutton, SIGNAL(clicked()), this, SLOT(slotCancel()));

  // the layout of the objects
  Q3BoxLayout * vlayout = new Q3VBoxLayout(this);
	
  Q3BoxLayout * hlayout1 = new Q3HBoxLayout(vlayout);
  hlayout1->addWidget(labelR);
  hlayout1->addWidget(p_EditR);
  hlayout1->addWidget(labelG);
  hlayout1->addWidget(p_EditG);
  hlayout1->addWidget(labelB);
  hlayout1->addWidget(p_EditB);
  Q3BoxLayout * hlayout2 = new Q3HBoxLayout(vlayout);
  hlayout2->addWidget(labelX);
  hlayout2->addWidget(p_EditX);
  hlayout2->addWidget(labelY);
  hlayout2->addWidget(p_EditY);
  hlayout2->addWidget(labelZ);
  hlayout2->addWidget(p_EditZ);
  Q3BoxLayout * hlayout3 = new Q3HBoxLayout(vlayout);
  hlayout3->addWidget(p_BoxBlink);
  hlayout3->addWidget(p_SpinDelay);
  Q3BoxLayout * hlayout4 = new Q3HBoxLayout(vlayout);
  hlayout4->addWidget(donebutton);
  hlayout4->addWidget(removebutton);
  hlayout4->addWidget(cancelbutton);

  EM_CERR("lightdialog::lightdialog");
}
void WidgetMain::createUploadSetting()
{
    if(NULL == pUploadSetting_)
    {
        pUploadSetting_ = new UploadSettingForm(this->rect(), this);
        connect(pUploadSetting_.data(), SIGNAL(signalDone()), this, SLOT(slotDone()));
        connect(pUploadSetting_, SIGNAL(signalSelectBoardType(QString,QString)), this, SLOT(slotBoardTypeItemClicked(QString,QString)));
        connect(pUploadSetting_, SIGNAL(signalSelectSerial(QString)), this, SLOT(slotSerialItemClicked(QString)));

        pUploadSetting_ ->setAttribute(Qt::WA_DeleteOnClose);
        qDebug() << this->pos();
        pUploadSetting_->show();
    }
}
示例#6
0
void ThumbsGenerator::init(const bool rebuildAll)
{
    setLabel(i18n("Thumbs"));
    ProgressManager::addProgressItem(this);

    d->rebuildAll = rebuildAll;
    d->thread     = new MaintenanceThread(this);

    connect(d->thread, SIGNAL(signalCompleted()),
            this, SLOT(slotDone()));

    connect(d->thread, SIGNAL(signalAdvance(QImage)),
            this, SLOT(slotAdvance(QImage)));
}
void lifeRestoreProgress::widgetInit(QString preserver, QString targetBackup, QString restoreFileListString)
{ 
   qDebug() << "Starting restore widget...";
   setWindowModality( Qt::WindowModal );

   restorePreserver = new PRESERVER(preserver);
   workingBackup = targetBackup;
   restoreList = restoreFileListString;
   
   connect(pushDone,SIGNAL(clicked()),this,SLOT(slotDone()));

   relKeepPath = false;

   viewRestoreOutput->setMaximumBlockCount(10000);
}
ModuleDialog::ModuleDialog(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f) 
: QDialog(parent, name, f) {
	EM_CERR("ModuleDialog::ModuleDialog");
	assert(doc != NULL);
	p_Doc = doc;
	p_FakeModuleBehavior = NULL;

	p_EditModule = new QLineEdit(this);
	QPushButton * choosebutton = new QPushButton("choose", this);
	connect(choosebutton, SIGNAL(clicked()), this, SLOT(slotChooseModule()));

	QPushButton * donebutton = new QPushButton("done", this);
	connect(donebutton, SIGNAL(clicked()), this, SLOT(slotDone()));

	Q3BoxLayout * hlayout = new Q3HBoxLayout(this);
	hlayout->addWidget(p_EditModule);
	hlayout->addWidget(choosebutton);
	hlayout->addWidget(donebutton);
}
示例#9
0
Kleo::ProgressDialog::ProgressDialog(Job *job, const QString &baseText,
                                     QWidget *creator, const char *name, WFlags f)
    : QProgressDialog(creator, name, false, f), mBaseText(baseText)
{
    assert(job);
    setBar(new ProgressBar(this, "replacement progressbar in Kleo::ProgressDialog"));

    setMinimumDuration(2000 /*ms*/);
    setAutoReset(false);
    setAutoClose(false);
    setLabelText(baseText);
    setProgress(0, 0);   // activate busy indicator

    connect(job, SIGNAL(progress(const QString &, int, int)),
            SLOT(slotProgress(const QString &, int, int)));
    connect(job, SIGNAL(done()), SLOT(slotDone()));
    connect(this, SIGNAL(canceled()),
            job, SLOT(slotCancel()));

    QTimer::singleShot(minimumDuration(), this, SLOT(forceShow()));
}
void StatusBarSpaceInfo::refresh()
{
    m_gettingSize = true;
    m_kBSize = 0;
    m_kBAvailable = 0;

    const QString mountPoint(KIO::findPathMountPoint(m_url.path()));

    KDiskFreeSp* job = new KDiskFreeSp(this);
    connect(job, SIGNAL(foundMountPoint(const unsigned long&,
                                        const unsigned long&,
                                        const unsigned long&,
                                        const QString& )),
            this, SLOT(slotFoundMountPoint(const unsigned long&,
                                           const unsigned long&,
                                           const unsigned long&,
                                           const QString& )));
    connect(job, SIGNAL(done()),
            this, SLOT(slotDone()));

    job->readDF(mountPoint);
}
示例#11
0
void DuplicatesFinder::slotStart()
{
    MaintenanceTool::slotStart();
    setLabel(i18n("Find duplicates items"));
    setThumbnail(QIcon::fromTheme(QLatin1String("tools-wizard")).pixmap(22));
    ProgressManager::addProgressItem(this);

    double minThresh = d->minSimilarity / 100.0;
    double maxThresh = d->maxSimilarity / 100.0;
    SearchesDBJobInfo jobInfo;
    jobInfo.setDuplicatesJob();
    jobInfo.setMinThreshold(minThresh);
    jobInfo.setMaxThreshold(maxThresh);
    jobInfo.setAlbumsIds(d->albumsIdList);
    jobInfo.setImageIds(d->imageIdList);
    jobInfo.setAlbumTagRelation(d->albumTagRelation);
    jobInfo.setSearchResultRestriction(d->searchResultRestriction);

    if (d->isAlbumUpdate)
        jobInfo.setAlbumUpdate();

    if (!d->tagsIdList.isEmpty())
        jobInfo.setTagsIds(d->tagsIdList);

    d->job = DBJobsManager::instance()->startSearchesJobThread(jobInfo);

    connect(d->job, SIGNAL(finished()),
            this, SLOT(slotDone()));

    connect(d->job, SIGNAL(totalSize(int)),
            this, SLOT(slotDuplicatesSearchTotalAmount(int)));

    connect(d->job, SIGNAL(processedSize(int)),
            this, SLOT(slotDuplicatesSearchProcessedAmount(int)));

    connect(this, SIGNAL(progressItemCanceled(ProgressItem*)),
            this, SIGNAL(signalComplete()));
}
示例#12
0
void KRootPixmap::repaint(bool force)
{
    QPoint p1 = m_pWidget->mapToGlobal(m_pWidget->rect().topLeft());
    QPoint p2 = m_pWidget->mapToGlobal(m_pWidget->rect().bottomRight());
    if(!force && (m_Rect == QRect(p1, p2)))
        return;

    // Due to northwest bit gravity, we don't need to do anything if the
    // bottom right corner of the widget is moved inward.
    // That said, konsole clears the background when it is resized, so
    // we have to reset the background pixmap.
    if((p1 == m_Rect.topLeft()) && (m_pWidget->width() < m_Rect.width()) && (m_pWidget->height() < m_Rect.height()))
    {
        m_Rect = QRect(p1, p2);
        updateBackground(m_pPixmap);
        return;
    }
    m_Rect = QRect(p1, p2);
#ifdef Q_WS_X11
    m_Desk = KWin::windowInfo(m_pWidget->topLevelWidget()->winId()).desktop();
    if(m_Desk == NET::OnAllDesktops)
        m_Desk = currentDesktop();

    // KSharedPixmap will correctly generate a tile for us.
    m_pPixmap->loadFromShared(pixmapName(m_Desk), m_Rect);
#else
    m_Desk = currentDesktop();
    // !x11 note: tile is not generated!
    // TODO: pixmapName() is a nonsense now!
    m_pPixmap->load(pixmapName(m_Desk));
    if(!m_pPixmap->isNull())
    {
        m_pPixmap->resize(m_Rect.size());
        slotDone(true);
    }
#endif
}
示例#13
0
BumperDialog::BumperDialog(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f) 
  : QDialog(parent, name, f) {
  EM_CERR("BumperDialog::BumperDialog");
  assert(doc != NULL);
  p_Doc = doc;
  p_BumperBehavior = NULL;

  QLabel * label = new QLabel("sound", this);

  p_SpinPower = new QSpinBox(0, 100, 1, this);
  p_EditSound = new QLineEdit(this);
  QPushButton * choosebutton = new QPushButton("choose", this);
  connect(choosebutton, SIGNAL(clicked()), this, SLOT(slotChooseSound()));

  QPushButton * donebutton = new QPushButton("done", this);
  connect(donebutton, SIGNAL(clicked()), this, SLOT(slotDone()));

  Q3BoxLayout * hlayout = new Q3HBoxLayout(this);
  hlayout->addWidget(p_SpinPower);
  hlayout->addWidget(label);
  hlayout->addWidget(p_EditSound);
  hlayout->addWidget(choosebutton);
  hlayout->addWidget(donebutton);
}
示例#14
0
void ThumbsGenerator::slotStart()
{
    MaintenanceTool::slotStart();

    QApplication::setOverrideCursor(Qt::WaitCursor);

    if (d->albumList.isEmpty())
    {
        d->albumList = AlbumManager::instance()->allPAlbums();
    }

    for (AlbumList::const_iterator it = d->albumList.constBegin();
         !canceled() && (it != d->albumList.constEnd()); ++it)
    {
        if (!(*it))
        {
            continue;
        }

        if ((*it)->type() == Album::PHYSICAL)
        {
            d->allPicturesPath += CoreDbAccess().db()->getItemURLsInAlbum((*it)->id());
        }
        else if ((*it)->type() == Album::TAG)
        {
            d->allPicturesPath += CoreDbAccess().db()->getItemURLsInTag((*it)->id());
        }
    }

    if (!d->rebuildAll)
    {
        QHash<QString, int> filePaths = ThumbsDbAccess().db()->getFilePathsWithThumbnail();
        QStringList::iterator it      = d->allPicturesPath.begin();

        while (it != d->allPicturesPath.end())
        {
            if (filePaths.contains(*it))
            {
                it = d->allPicturesPath.erase(it);
            }
            else
            {
                ++it;
            }
        }
    }

    // remove non-image or video files from the list
    QStringList::iterator it = d->allPicturesPath.begin();

    while (it != d->allPicturesPath.end())
    {
        ItemInfo info = ItemInfo::fromLocalFile(*it);

        if (info.category() != DatabaseItem::Image &&
            info.category() != DatabaseItem::Video &&
            info.category() != DatabaseItem::Audio)
        {
            it = d->allPicturesPath.erase(it);
        }
        else
        {
            ++it;
        }
    }

    QApplication::restoreOverrideCursor();

    if (d->allPicturesPath.isEmpty())
    {
        slotDone();
        return;
    }

    setTotalItems(d->allPicturesPath.count());

    d->thread->generateThumbs(d->allPicturesPath);
    d->thread->start();
}