MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); view = new QGraphicsView; scene = new ExQGraphicsScene; inputParams = new InputParamsDialog; exportImageDialog = new ExportImageDialog; progressBar = new ProgressBarWidget; this->zoomFactor=1.2; this->load(); QObject::connect(this->scene,SIGNAL(mouse_pressed()),this,SLOT(moused())); QObject::connect(inputParams,SIGNAL(accepted()),this,SLOT(draw())); QObject::connect(ui->closeBtn,SIGNAL(clicked()),this,SLOT(close())); QObject::connect(ui->closeBtn,SIGNAL(clicked()),this->view,SLOT(close())); QObject::connect(ui->zoomInBtn,SIGNAL(clicked()),this,SLOT(zoomIn())); QObject::connect(ui->zoomOutBtn,SIGNAL(clicked()),this,SLOT(zoomOut())); QObject::connect(ui->exportBtn,SIGNAL(clicked()),this,SLOT(exportCalled())); QObject::connect(exportImageDialog,SIGNAL(accepted()),this,SLOT(exportImage())); QObject::connect(exportImageDialog,SIGNAL(accepted()),this,SLOT(showProgressBar())); QObject::connect(exportImageDialog,SIGNAL(accepted()),this->progressBar,SLOT(start())); }
void StatGetterThread::onStart() { setLabel("Retrieving files count.."); emit showLabel(); emit setProgressRange(0, 0); emit setProgressValue(0); emit showProgressBar(); FillPreAnalysisTree(); const size_t totalValue = preAnalysisTree_.size(); setLabel("Calculating statistics.."); emit setProgressRange(0, totalValue); emit setProgressValue(0); FillStatTreeByPath(); GetSubdirsCount(); emit setProgressValue(totalValue); emit hideLabel(); emit hideProgressBar(); emit finished(); }
bool PostEntry::uploadMediaFiles( Backend *backend ) { kDebug(); bool localBackend = false; bool result = true; if( !backend ) { localBackend = true; backend = new Backend( d->mCurrentPostBlogId, this ); } QList<BilboMedia*> lImages = localImages(); if( lImages.size()>0 ) { showProgressBar(); QList<BilboMedia*>::iterator it = lImages.begin(); QList<BilboMedia*>::iterator endIt = lImages.end(); for ( ; it != endIt; ++it ) { BilboMedia *media = (*it); SyncUploader *uploader = new SyncUploader(this); if( uploader->uploadMedia( backend, media ) ){ replaceImageSrc( media->localUrl().url(), media->remoteUrl().url()); } else { QString err = i18n( "Uploading the media file %1 failed.\n%2", media->name(), uploader->errorMessage()); emit postPublishingDone( true, err ); result = false; break; } uploader->deleteLater(); } d->mCurrentPost.setContent( htmlContent() ); } if(localBackend) backend->deleteLater(); return result; }
void PostEntry::submitPost(int blogId, const BilboPost &postData) { setCurrentPostFromEditor(); if (d->mCurrentPost.content().isEmpty() || d->mCurrentPost.title().isEmpty()) { if (KMessageBox::warningContinueCancel(this, i18n("Your post title or body is empty.\nAre you sure you want to submit this post?") ) == KMessageBox::Cancel) { return; } } bool isNew = false; if (d->mCurrentPost.status() == BilboPost::New) { isNew = true; } QPointer<SendToBlogDialog> dia = new SendToBlogDialog(isNew, d->mCurrentPost.isPrivate(), this); dia->setAttribute(Qt::WA_DeleteOnClose, false); if (dia->exec() == QDialog::Accepted) { this->setCursor(Qt::BusyCursor); d->mCurrentPost.setProperties(postData); d->mCurrentPostBlogId = blogId; QString msgType; if (dia->isPrivate()) { msgType = i18nc("Post status, e.g Draft or Published Post", "draft"); d->mCurrentPost.setPrivate(true); } else { msgType = i18nc("Post status, e.g Draft or Published Post", "post"); d->mCurrentPost.setPrivate(false); } QString statusMsg; if (dia->isNew()) { statusMsg = i18n("Submitting new %1...", msgType); d->isNewPost = true; } else { statusMsg = i18n("Modifying %1...", msgType); d->isNewPost = false; } Q_EMIT showStatusMessage(statusMsg, true); Backend *b = new Backend(d->mCurrentPostBlogId, this); connect(b, &Backend::sigError, this, &PostEntry::slotError); if (uploadMediaFiles(b)) { qCDebug(BLOGILO_LOG) << "Uploading"; showProgressBar(); connect(b, &Backend::sigPostPublished, this, &PostEntry::slotPostPublished); if (d->isNewPost) { b->publishPost(&d->mCurrentPost); } else { b->modifyPost(&d->mCurrentPost); } } else { deleteProgressBar(); } } delete dia; }
/** @brief Process update all feeds action *---------------------------------------------------------------------------*/ void UpdateObject::slotGetAllFeeds() { QSqlQuery q(db_); q.exec("SELECT id, xmlUrl, lastBuildDate, authentication FROM feeds WHERE xmlUrl!='' AND disableUpdate=0"); while (q.next()) { addFeedInQueue(q.value(0).toInt(), q.value(1).toString(), q.value(2).toDateTime(), q.value(3).toInt()); } emit showProgressBar(updateFeedsCount_); }
void VConnectionInfoWidget::setErrorIcon(bool c) { if( c ) { warningLabel->setPixmap( errorIcon.pixmap( QSize(22,22) ) ); showProgressBar( !c, c); } else warningLabel->setPixmap( okIcon.pixmap( QSize(22,22) ) ); }
VConnectionInfoWidget::VConnectionInfoWidget(QWidget *parent) : QWidget(parent) { setupUi(this); okIcon = style()->standardPixmap(QStyle::SP_DialogApplyButton); errorIcon = style()->standardPixmap(QStyle::SP_MessageBoxCritical); warningLabel->setPixmap( okIcon.pixmap( QSize(22,22) ) ); showProgressBar( false ); }
void UpdateObject::slotGetFeedTimer(int feedId) { QSqlQuery q(db_); q.exec(QString("SELECT xmlUrl, lastBuildDate, authentication FROM feeds WHERE id=='%1' AND disableUpdate=0") .arg(feedId)); if (q.next()) { addFeedInQueue(feedId, q.value(0).toString(), q.value(1).toDateTime(), q.value(2).toInt()); } emit showProgressBar(updateFeedsCount_); }
/** @brief Process update feed in folder action *---------------------------------------------------------------------------*/ void UpdateObject::slotGetFeedsFolder(QString query) { QSqlQuery q(db_); q.exec(query); while (q.next()) { addFeedInQueue(q.value(0).toInt(), q.value(1).toString(), q.value(2).toDateTime(), q.value(3).toInt()); } emit showProgressBar(updateFeedsCount_); }
IProgressWorker::IProgressWorker(QProgressBar* progBar, QLabel* label, QObject* parent) : QObject(parent) { connect(this, SIGNAL(setProgressRange(int,int)), progBar, SLOT(setRange(int,int))); connect(this, SIGNAL(setProgressValue(int)), progBar, SLOT(setValue(int))); connect(this, SIGNAL(showProgressBar()), progBar, SLOT(show())); connect(this, SIGNAL(hideProgressBar()), progBar, SLOT(hide())); connect(this, SIGNAL(setLabel(QString)), label, SLOT(setText(QString))); connect(this, SIGNAL(showLabel()), label, SLOT(show())); connect(this, SIGNAL(hideLabel()), label, SLOT(hide())); }
void TwitterClient::post(QString url, QString text, QString user, QString pass, bool showProgressbar, QPoint pos) { qDebug() << "posting url" << url << "and txt" << text; this->user = user; QVector<QPair<QString, QString> > data; data.append(qMakePair(QString("username"), user)); data.append(qMakePair(QString("password"), pass)); data.append(qMakePair(QString("message"), text)); data.append(qMakePair(QString("url"), url)); data.append(qMakePair(QString("key"), QString(DEVELOPER_KEY))); qDebug() << data; http.post(QString("http://") + TWITTER_HOST + TWITTER_PATH, data); if (showProgressbar) showProgressBar(pos); }
void AddFeedWizard::addFeed() { // Set URL-schema for URL-address "http://" or leave it "https://" feedUrlString_ = urlFeedEdit_->text().simplified(); if (feedUrlString_.contains("feed:", Qt::CaseInsensitive)) { if (feedUrlString_.contains("https://", Qt::CaseInsensitive)) { feedUrlString_.remove(0, 5); urlFeedEdit_->setText(feedUrlString_); } else { feedUrlString_.remove(0, 7); urlFeedEdit_->setText("http://" + feedUrlString_); } } QUrl feedUrl(urlFeedEdit_->text().simplified()); if (feedUrl.scheme().isEmpty()) { feedUrl.setUrl("http://" % urlFeedEdit_->text().simplified()); } feedUrlString_ = feedUrl.toString(); urlFeedEdit_->setText(feedUrlString_); #if QT_VERSION >= 0x040800 if (feedUrl.host().isEmpty() && !feedUrl.isLocalFile()) { #else if (feedUrl.host().isEmpty() && (feedUrl.scheme() != "file")) { #endif textWarning->setText(tr("URL error!")); warningWidget_->setVisible(true); return; } QSqlQuery q; int duplicateFoundId = -1; q.prepare("SELECT id FROM feeds WHERE xmlUrl LIKE :xmlUrl"); q.bindValue(":xmlUrl", feedUrlString_); q.exec(); if (q.first()) duplicateFoundId = q.value(0).toInt(); if (0 <= duplicateFoundId) { textWarning->setText(tr("Duplicate feed!")); warningWidget_->setVisible(true); } else { button(QWizard::NextButton)->setEnabled(false); button(QWizard::CancelButton)->setEnabled(false); button(QWizard::FinishButton)->setEnabled(false); page(0)->setEnabled(false); showProgressBar(); // Calculate row's number to insert new feed int rowToParent = 0; q.exec("SELECT count(id) FROM feeds WHERE parentId=0"); if (q.next()) rowToParent = q.value(0).toInt(); int auth = 0; QString userInfo; if (authentication_->isChecked()) { auth = 1; userInfo = QString("%1:%2").arg(user_->text()).arg(pass_->text()); } // Insert feed q.prepare("INSERT INTO feeds(xmlUrl, created, rowToParent, authentication) " "VALUES (:feedUrl, :feedCreateTime, :rowToParent, :authentication)"); q.bindValue(":feedUrl", feedUrlString_); q.bindValue(":feedCreateTime", QLocale::c().toString(QDateTime::currentDateTimeUtc(), "yyyy-MM-ddTHH:mm:ss")); q.bindValue(":rowToParent", rowToParent); q.bindValue(":authentication", auth); q.exec(); feedId_ = q.lastInsertId().toInt(); q.finish(); if (feedUrlString_.contains(":COOKIE:", Qt::CaseInsensitive)) { int index = feedUrlString_.lastIndexOf(":COOKIE:", -1, Qt::CaseInsensitive); QString cookieStr = feedUrlString_.right(feedUrlString_.length() - index - 8); QStringList cookieStrList = cookieStr.split(";"); QList<QNetworkCookie> loadedCookies; foreach (QString cookieStr, cookieStrList) { const QList<QNetworkCookie> &cookieList = QNetworkCookie::parseCookies(cookieStr.toUtf8()); if (cookieList.isEmpty()) { continue; } QNetworkCookie cookie = cookieList.at(0); QDateTime date = QDateTime::currentDateTime(); date = date.addYears(35); cookie.setExpirationDate(date); loadedCookies.append(cookie); } mainApp->cookieJar()->setCookiesFromUrl(loadedCookies, feedUrlString_); } emit signalRequestUrl(feedId_, feedUrlString_, QDateTime(), userInfo); } }
void TwitterClient::post(QSharedPointer<QVector<QPair<QSharedPointer<Media>,QStringList> > > medias, QString text, QString user, QString pass, QString shortlink, bool showProgressbar, QPoint pos) { if (showProgressbar) showProgressBar(pos); gallery.create(medias, text, user, pass); }
void CLCD::setMode(const MODES m, const char * const title) { mode = m; menutitle = title; setlcdparameter(); switch (m) { case MODE_TVRADIO: case MODE_MOVIE: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case STATUSLINE_PLAYTIME: display.load_screen(&(background[BACKGROUND_LCD2])); showPercentOver(percentOver, false, mode); break; case STATUSLINE_VOLUME: display.load_screen(&(background[BACKGROUND_LCD])); showVolume(volume, false); break; case STATUSLINE_BOTH: display.load_screen(&(background[BACKGROUND_LCD3])); showVolume(volume, false); showPercentOver(percentOver, false, mode); break; case STATUSLINE_BOTH_AUDIO: display.load_screen(&(background[BACKGROUND_LCD4])); showVolume(volume, false); showPercentOver(percentOver, false, mode); break; default: break; } if (mode == MODE_TVRADIO) showServicename(servicename); else { setMoviePlaymode(movie_playmode); setMovieInfo(movie_big, movie_small); setMovieAudio(movie_is_ac3); } showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_AUDIO: { display.load_screen(&(background[BACKGROUND_LCD])); display.draw_fill_rect(0, 14, LCD_COLS, 48, CLCDDisplay::PIXEL_OFF); showAudioPlayMode(PLAYMODE_STOP); showVolume(volume, false); showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: display.load_screen(&(background[BACKGROUND_LCD])); showVolume(volume, false); showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); fonts.menutitle->RenderString(0, 28, LCD_COLS + 20, title, CLCDDisplay::PIXEL_ON, 0, true); // UTF-8 displayUpdate(); break; case MODE_SHUTDOWN: showclock = false; display.load_screen(&(background[BACKGROUND_POWER])); displayUpdate(); break; case MODE_STANDBY: showclock = true; showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef LCD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, LCD_COLS, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // LCD_UPDATE } wake_up(); }
/** @brief Process update feed action *---------------------------------------------------------------------------*/ void UpdateObject::slotGetFeed(int feedId, QString feedUrl, QDateTime date, int auth) { addFeedInQueue(feedId, feedUrl, date, auth); emit showProgressBar(updateFeedsCount_); }
void CVFD::setMode(const MODES m, const char * const title) { if(!has_lcd) return; if(mode == MODE_AUDIO) ShowIcon(VFD_ICON_MP3, false); #if 0 else if(mode == MODE_STANDBY) { ShowIcon(VFD_ICON_COL1, false); ShowIcon(VFD_ICON_COL2, false); } #endif if(strlen(title)) ShowText((char *) title); mode = m; setlcdparameter(); switch (m) { case MODE_TVRADIO: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case 0: showPercentOver(percentOver, false); break; case 1: showVolume(volume, false); break; #if 0 case 2: showVolume(volume, false); showPercentOver(percentOver, false); break; #endif } showServicename(servicename); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_AUDIO: { ShowIcon(VFD_ICON_MP3, true); showAudioPlayMode(AUDIO_MODE_STOP); showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; //fonts.menutitle->RenderString(0,28, 140, title, CLCDDisplay::PIXEL_ON, 0, true); // UTF-8 break; case MODE_SHUTDOWN: showclock = false; break; case MODE_STANDBY: #if 0 ShowIcon(VFD_ICON_COL1, true); ShowIcon(VFD_ICON_COL2, true); #endif showclock = true; showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef VFD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, 120, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // VFD_UPDATE } wake_up(); }
void CVFD::setMode(const MODES m, const char * const title) { if(fd < 0) return; // Clear colon in display if it is still there #ifdef BOXMODEL_APOLLO if (support_numbers && has_led_segment) ioctl(fd, IOC_FP_SET_COLON, 0x00); #endif if(mode == MODE_AUDIO) ShowIcon(FP_ICON_MP3, false); #if 0 else if(mode == MODE_STANDBY) { ShowIcon(FP_ICON_COL1, false); ShowIcon(FP_ICON_COL2, false); } #endif if(strlen(title)) ShowText(title); mode = m; setlcdparameter(); switch (m) { case MODE_TVRADIO: switch (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) { case 0: showPercentOver(percentOver, false); break; case 1: showVolume(volume, false); break; #if 0 case 2: showVolume(volume, false); showPercentOver(percentOver, false); break; #endif } showServicename(servicename); showclock = true; if(g_settings.lcd_info_line) switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10; break; case MODE_AUDIO: { ShowIcon(FP_ICON_MP3, true); showAudioPlayMode(AUDIO_MODE_STOP); showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; } case MODE_SCART: showVolume(volume, false); showclock = true; //showTime(); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ break; case MODE_MENU_UTF8: showclock = false; //fonts.menutitle->RenderString(0,28, 140, title, CLCDDisplay::PIXEL_ON); break; case MODE_SHUTDOWN: showclock = false; Clear(); break; case MODE_STANDBY: #if 0 ShowIcon(FP_ICON_COL1, true); ShowIcon(FP_ICON_COL2, true); #endif ClearIcons(); ShowIcon(FP_ICON_USB, false); ShowIcon(FP_ICON_HDD, false); showclock = true; showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */ /* "showTime()" clears the whole lcd in MODE_STANDBY */ break; #ifdef VFD_UPDATE case MODE_FILEBROWSER: showclock = true; display.draw_fill_rect(-1, -1, 120, 64, CLCDDisplay::PIXEL_OFF); // clear lcd showFilelist(); break; case MODE_PROGRESSBAR: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar(); break; case MODE_PROGRESSBAR2: showclock = false; display.load_screen(&(background[BACKGROUND_SETUP])); showProgressBar2(); break; case MODE_INFOBOX: showclock = false; showInfoBox(); break; #endif // VFD_UPDATE } wake_up(); #if !HAVE_DUCKBOX_HARDWARE setled(); #endif }