MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), mDialog(0), mWebView(0), mCurrentNoteIndex(0) { loadSettings(); checkExistenceTempImgDir(); setWindowTitle(tr("Zoth Reader")); setWindowIcon(QIcon(":/images/green_book_zoth.png")); createCentralWidget(); //showFullScreen(); showMaximized(); setContextMenuPolicy(Qt::NoContextMenu); mDialog = new SettingsDialog(); connect(&mEnExport, SIGNAL(exported()), SLOT(notesReloaded())); connect(&mEnExport, SIGNAL(exported()), SLOT(displayNotes())); connect(&mEnExport, SIGNAL(exported()), SLOT(refreshNavigationLabel())); connect(mDialog, SIGNAL(accepted()), SLOT(saveDialogSettings())); if(isFirstRun){ HelloDialog* helloDialog = new HelloDialog(this); QPalette palette; palette.setColor(QPalette::Window, QColor(mBgColor)); helloDialog->setPalette(palette); helloDialog->setBackgroundRole(QPalette::Window); helloDialog->activateWindow(); helloDialog->show(); connect(helloDialog, SIGNAL(tagAccepted(QString)), SLOT(setTagAndReload(QString))); }else{ reloadNotes(); } }
int main(void) { int x = 3; exported(x); not_exported(x); return 0; }
bool Object::exportIm( int frameStart, int frameEnd, QTransform view, QSize exportSize, QString filePath, bool antialiasing ) { Q_UNUSED( frameEnd ); QImage exported( exportSize, QImage::Format_ARGB32_Premultiplied ); QPainter painter( &exported ); painter.fillRect( exported.rect(), Qt::white ); painter.setWorldTransform( view ); paintImage( painter, frameStart, false, antialiasing ); return exported.save( filePath ); }
bool Object::exportIm(int frameStart, int frameEnd, QMatrix view, QSize exportSize, QString filePath, bool antialiasing, int gradients) { Q_UNUSED(frameEnd); QSettings settings("Pencil","Pencil"); qreal curveOpacity = (100-settings.value("curveOpacity").toInt())/100.0; // default value is 1.0 QImage exported(exportSize, QImage::Format_ARGB32_Premultiplied); QPainter painter(&exported); painter.fillRect(exported.rect(), Qt::white); painter.setWorldMatrix(view); paintImage(painter, frameStart, false, curveOpacity, antialiasing, gradients); return exported.save(filePath); }
ThumbnailWidget::ThumbnailWidget(Page * page) : page_(page), pixmap_(NULL), label_(NULL), indicator_(NULL), drag_progress_(false), hightlighted_(false) { setFlag(QGraphicsItem::ItemClipsToShape); setFlag(QGraphicsItem::ItemClipsChildrenToShape); setAcceptDrops(true); setupPixmap(); setupLabel(); setupToolTip(); setupIndicator(); connect(page, SIGNAL(rotated(int)), SLOT(handlePageRotate())); connect(page, SIGNAL(changed()), SLOT(updatePageIndicators())); connect(page, SIGNAL(exported()), SLOT(updatePageIndicators())); connect(page, SIGNAL(thumbChanged()), SLOT(setupPixmap())); updatePageIndicators(); }
void LevelEdit::ExportingReady() //slot { if(!sceneCreated) return; if(!scene) return; long x, y, h, w, th, tw; bool proportion; bool forceTiled=false; QString inifile = AppPathManager::settingsFile(); QSettings settings(inifile, QSettings::IniFormat); settings.beginGroup("Main"); latest_export_path = settings.value("export-path", AppPathManager::userAppDir()).toString(); proportion = settings.value("export-proportions", true).toBool(); settings.endGroup(); if(scene->isFullSection) { x=LvlData.sections[LvlData.CurSection].size_left; y=LvlData.sections[LvlData.CurSection].size_top; w=LvlData.sections[LvlData.CurSection].size_right; h=LvlData.sections[LvlData.CurSection].size_bottom; w=(long)fabs(x-w); h=(long)fabs(y-h); } else { x=qRound(scene->captutedSize.x()); y=qRound(scene->captutedSize.y()); w=qRound(scene->captutedSize.width()); h=qRound(scene->captutedSize.height()); } tw=w; th=h; QVector<long> imgSize; imgSize.push_back(th); imgSize.push_back(tw); imgSize.push_back((int)proportion); ExportToImage ExportImage(imgSize); ExportImage.setWindowFlags (Qt::Window | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); ExportImage.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, ExportImage.size(), qApp->desktop()->availableGeometry())); if(ExportImage.exec()!=QDialog::Rejected) imgSize = ExportImage.imageSize; else return; if(imgSize.size()>=3) if((imgSize[0]<0)||(imgSize[1]<0)) return; QString fileName = QFileDialog::getSaveFileName(this, tr("Export current section to image"), latest_export_path + "/" + QString("%1_Section_%2%3.png").arg( QFileInfo(curFile).baseName() ) .arg(LvlData.CurSection+1) .arg(scene->isFullSection?"":("_"+QString::number(qrand()))), tr("PNG Image (*.png)")); if (fileName.isEmpty()) return; forceTiled = ExportImage.TiledBackground(); QFileInfo exported(fileName); QProgressDialog progress(tr("Saving section image..."), tr("Abort"), 0, 100, this); progress.setWindowTitle(tr("Please wait...")); progress.setWindowModality(Qt::WindowModal); progress.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); progress.setFixedSize(progress.size()); progress.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, progress.size(), qApp->desktop()->availableGeometry())); progress.setCancelButton(0); progress.setMinimumDuration(0); //progress.show(); if(!progress.wasCanceled()) progress.setValue(0); qApp->processEvents(); scene->stopAnimation(); //Reset animation to 0 frame if(ExportImage.HideWatersAndDoors()) scene->hideWarpsAndDoors(false); if(forceTiled) scene->setTiledBackground(true); if(!progress.wasCanceled()) progress.setValue(10); qApp->processEvents(); scene->clearSelection(); // Clear selection on export latest_export_path = exported.absoluteDir().path(); proportion = imgSize[2]; th=imgSize[0]; tw=imgSize[1]; qApp->processEvents(); QImage img(tw,th,QImage::Format_ARGB32_Premultiplied); if(!progress.wasCanceled()) progress.setValue(20); qApp->processEvents(); QPainter p(&img); if(!progress.wasCanceled()) progress.setValue(30); qApp->processEvents(); scene->render(&p, QRectF(0,0,tw,th),QRectF(x,y,w,h)); qApp->processEvents(); p.end(); if(!progress.wasCanceled()) progress.setValue(40); qApp->processEvents(); img.save(fileName); qApp->processEvents(); if(!progress.wasCanceled()) progress.setValue(90); qApp->processEvents(); if(scene->opts.animationEnabled) scene->startAnimation(); // Restart animation if(ExportImage.HideWatersAndDoors()) scene->hideWarpsAndDoors(true); if(forceTiled) scene->setTiledBackground(false); if(!progress.wasCanceled()) progress.setValue(100); if(!progress.wasCanceled()) progress.close(); settings.beginGroup("Main"); settings.setValue("export-path", latest_export_path); settings.setValue("export-proportions", proportion); settings.endGroup(); }
int main() try { adobe::forest<char> forest; adobe::forest<char>::iterator a(forest.insert(forest.begin(), 'a')); a = adobe::trailing_of(a); adobe::forest<char>::iterator b(forest.insert(a, 'b')); adobe::forest<char>::iterator c(forest.insert(a, 'c')); b = adobe::trailing_of(b); forest.insert(b, 'd'); forest.insert(b, 'e'); forest.insert(b, 'f'); forest.insert(adobe::trailing_of(forest.insert(adobe::trailing_of(c), 'g')), 'h'); output(depth_range(forest)); forest_map<char>::type index_map; { adobe::forest<char>::const_preorder_iterator iter(forest.begin()); adobe::forest<char>::const_preorder_iterator last(forest.end()); for (; iter != last; ++iter) { std::cout << *iter << " has_next_sibling : " << std::boolalpha << has_next_sibling(iter.base()) << std::endl; } } build_index_map<char>(index_map, adobe::bitpath_t(), forest.begin()); { forest_map<char>::type::const_iterator iter(index_map.begin()); forest_map<char>::type::const_iterator last(index_map.end()); for (; iter != last; ++iter) { std::cout << *iter->second << " has index : " << iter->first << std::endl; } } { forest_map<char>::type::const_iterator iter(index_map.begin()); forest_map<char>::type::const_iterator last(index_map.end()); for (; iter != last; ++iter) { adobe::forest<char>::iterator parent(find_index_parent<char>(index_map, iter->first)); if (parent == adobe::forest<char>::iterator()) { std::cout << *iter->second << " has no parent." << std::endl; } else { std::cout << *iter->second << " has parent : " << *parent << std::endl; } } } { adobe::forest<char>::preorder_iterator iter(forest.begin()); adobe::forest<char>::preorder_iterator last(forest.end()); for (; iter != last; ++iter) { std::cout << *iter << " has index : " << iterator_to_index(forest, iter.base()) << std::endl; } } { forest_map<char>::type::const_iterator iter(index_map.begin()); forest_map<char>::type::const_iterator last(index_map.end()); for (; iter != last; ++iter) { std::cout << "index " << iter->first << " has value " << *index_to_iterator(forest, iter->first) << std::endl; } } { forest_map<char>::type::const_iterator iter(index_map.begin()); forest_map<char>::type::const_iterator last(index_map.end()); for (; iter != last; ++iter) { adobe::bitpath_t path(iter->first); adobe::vector<unsigned char> exported(path.portable()); adobe::bitpath_t imported(exported); std::cout << "path: " << path << ", round-trip: " << imported << std::endl; } } { adobe::bitpath_t small_path; small_path.push(1); small_path.push(0); small_path.push(1); small_path.push(1); small_path.push(0); adobe::bitpath_t med_path(small_path); med_path.push(0); med_path.push(1); med_path.push(1); med_path.push(0); med_path.push(1); adobe::bitpath_t long_path(med_path); long_path.push(1); long_path.push(0); long_path.push(0); long_path.push(1); long_path.push(1); std::cout << "small_path: " << small_path << std::endl; std::cout << " med_path: " << med_path << std::endl; std::cout << " long_path: " << long_path << std::endl; std::cout << "pass_through(invalid, invalid): " << std::boolalpha << passes_through(adobe::nbitpath(), adobe::nbitpath()) << std::endl; std::cout << "pass_through(invalid, small): " << std::boolalpha << passes_through(adobe::nbitpath(), small_path) << std::endl; std::cout << "pass_through(invalid, med): " << std::boolalpha << passes_through(adobe::nbitpath(), med_path) << std::endl; std::cout << "pass_through(invalid, long): " << std::boolalpha << passes_through(adobe::nbitpath(), long_path) << std::endl; std::cout << "pass_through(small, invalid): " << std::boolalpha << passes_through(small_path, adobe::nbitpath()) << std::endl; std::cout << "pass_through(small, small): " << std::boolalpha << passes_through(small_path, small_path) << std::endl; std::cout << "pass_through(small, med): " << std::boolalpha << passes_through(small_path, med_path) << std::endl; std::cout << "pass_through(small, long): " << std::boolalpha << passes_through(small_path, long_path) << std::endl; std::cout << "pass_through(med, invalid): " << std::boolalpha << passes_through(med_path, adobe::nbitpath()) << std::endl; std::cout << "pass_through(med, small): " << std::boolalpha << passes_through(med_path, small_path) << std::endl; std::cout << "pass_through(med, med): " << std::boolalpha << passes_through(med_path, med_path) << std::endl; std::cout << "pass_through(med, long): " << std::boolalpha << passes_through(med_path, long_path) << std::endl; std::cout << "pass_through(long, invalid): " << std::boolalpha << passes_through(long_path, adobe::nbitpath()) << std::endl; std::cout << "pass_through(long, small): " << std::boolalpha << passes_through(long_path, small_path) << std::endl; std::cout << "pass_through(long, med): " << std::boolalpha << passes_through(long_path, med_path) << std::endl; std::cout << "pass_through(long, long): " << std::boolalpha << passes_through(long_path, long_path) << std::endl; } return 0; } catch(const std::exception& error) { std::cerr << "Exception: " << error.what() << std::endl; return 1; } catch(...) { std::cerr << "Exception: unknown" << std::endl; return 1; }