int main(int argc, char *argv[]) { QApplication app(argc, argv); Screenshot screenshot; screenshot.show(); return app.exec(); }
void ScreenshotManager::finished() { Screenshot *screenshot = qobject_cast<Screenshot *>(sender()); mScreenshots.removeOne(screenshot); emit activeCountChange(); screenshot->deleteLater(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); Screenshot screenshot; screenshot.show(); screenshot.shootScreen(); screenshot.saveScreenshot("test.png"); //return app.exec(); }
/** * Puush capture area screenshot. * @brief Systray::selectAreaScreenshot */ void Systray::selectAreaScreenshot() { if (!isLoggedIn()) return; QString fileName = getTempPath(); Screenshot *ss = new Screenshot(fileName); connect(ss, SIGNAL(finished(int, QString, QString)), this, SLOT(screenshotDone(int, QString, QString))); ss->selectArea(); }
void ScreenshotManager::take(Screenshot::Options &options) { Screenshot *newScreenshot = new Screenshot(this, options); mScreenshots.append(newScreenshot); connect(newScreenshot, SIGNAL(askConfirmation()), this, SLOT(askConfirmation())); connect(newScreenshot, SIGNAL(cleanup()) , this, SLOT(cleanup())); connect(newScreenshot, SIGNAL(finished()) , this, SLOT(finished())); newScreenshot->take(); }
int main(int argc, const char * argv[]) { if (argc < 2) { fprintf(stderr, "Error - Usage: screenshooter [-c compression] <filename.[jpg, jp2, png, tiff, gif, bmp]>\n"); return 1; } const char* filename = ""; float compression = 1.0; CFStringRef format; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-c") == 0) { compression = ::atof(argv[++i]); } else { filename = argv[i]; } } if (strcasestr(filename, ".jpg")) { format = kUTTypeJPEG; } else if (strcasestr(filename, ".jp2")) { format = kUTTypeJPEG2000; } else if (strcasestr(filename, ".png")) { format = kUTTypePNG; } else if (strcasestr(filename, ".tiff")) { format = kUTTypeTIFF; } else if (strcasestr(filename, ".gif")) { format = kUTTypeGIF; } else if (strcasestr(filename, ".bmp")) { format = kUTTypeBMP; } else { fprintf(stderr, "Error filetype for %s is not supported: Try one of [jpg, jp2, png, tiff, gif, bmp]\n", filename); return 1; } ScreenShooter shooter; Screenshot* screenshot = shooter.take_screenshot(format, compression); screenshot->write_png(filename); delete screenshot; return 0; }
int main (int argc, char* argv[]) { if (argc != 2) { fprintf(stderr,"Error: screenshot takes one parameter\nUsage: screenshot <filename>"); return 1; } ScreenShooter screen_shooter; Screenshot* screenshot = screen_shooter.take_screenshot(); screenshot->write_png(argv[1]); delete screenshot; return 0; }
void MainWindow::initSnap(int snapType) { static Screenshot *dockWidget0 = NULL; Screenshot *dockWidget = new Screenshot(dockCtrlNames[snapType], this); addDockWidget(static_cast<Qt::DockWidgetArea>(Qt::RightDockWidgetArea), dockWidget); // create tabbed history widgets if (dockWidget0) tabifyDockWidget(dockWidget0, dockWidget); else dockWidget0 = dockWidget; menuPictures->addAction(dockWidget->toggleViewAction()); dockCtrls[snapType] = dockWidget; }
void ScreenshotManager::cleanup() { Screenshot *screenshot = qobject_cast<Screenshot *>(sender()); emit windowCleanup(screenshot->options()); }
int main (int argc, char *argv[]) { QApplication::setApplicationName("massws"); QApplication::setApplicationVersion("1.0"); QCommandLineParser parser; parser.setApplicationDescription("MassWebShotter v1.0. Copyright (C) Kost. Distributed under GPL."); parser.addHelpOption(); parser.addVersionOption(); QCommandLineOption optionHelp(QStringList() << "h" << "help", QCoreApplication::translate("main", "Show help.")); parser.addOption(optionHelp); QCommandLineOption optionIgnoreSSL(QStringList() << "s" << "ignoressl", QCoreApplication::translate("main", "Ignore SSL verification errors")); parser.addOption(optionIgnoreSSL); QCommandLineOption optionOutputFN(QStringList() << "o" << "output", QCoreApplication::translate("main", "Save output to <filename>."), QCoreApplication::translate("main", "filename")); parser.addOption(optionOutputFN); QCommandLineOption optionWidth(QStringList() << "x" << "width", QCoreApplication::translate("main", "Make screenshot with <width>."), QCoreApplication::translate("main", "width")); parser.addOption(optionWidth); QCommandLineOption optionHeight(QStringList() << "y" << "height", QCoreApplication::translate("main", "Make screenshot with <height>."), QCoreApplication::translate("main", "heigth")); parser.addOption(optionHeight); parser.addPositionalArgument("url", "URL to take screenshot"); qDebug() << "Starting...\n"; QApplication app(argc,argv); parser.process(app); if (parser.isSet(optionHelp)) { parser.showHelp(); exit(0); } const QStringList positionalArguments = parser.positionalArguments(); if (positionalArguments.isEmpty()) { qWarning() << "You have to specify at least one URL"; exit(1); } qDebug() << "Taking ss..\n"; Screenshot ss; if (parser.isSet(optionIgnoreSSL)) { ss.ignoreSSL=1; } if (parser.isSet(optionWidth)) { ss.sizex=parser.value(optionWidth).toInt(); } if (parser.isSet(optionHeight)) { ss.sizey=parser.value(optionHeight).toInt(); } QString urltoss=positionalArguments.first(); if (parser.isSet(optionOutputFN)) { ss.filename=parser.value(optionOutputFN); } else { QString genfilename=urltoss; escapeFN(genfilename); ss.filename=genfilename + ".png"; } qWarning() << "Taking screenshot of: " << urltoss << " to " << ss.filename; ss.takeshot(QUrl(urltoss)); ss.myapp = &app; qDebug() << "Pre-exec...\n"; app.exec(); qDebug() << "End...\n"; }