blob: 44e59a6ccdf4cd1441cc1242cbc999018791dafe [file] [log] [blame] [raw]
/* PC GO Screen Shooter
Copyright 2007-2014 PC GO Ld.
Original are from Qt Demos
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
#include "screenshot.h"
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <QtGui/QApplication>
#include <QtGui/QSpinBox>
int main(int argc, char *argv[]) {
if(argc > 1 && (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)) {
fprintf(stderr, "Usage: %s [--style <QStyle name>] [--delay <number>]\n", argv[0]);
return -1;
}
for(int i=1; i<argc; i++) if(strcmp(argv[i], "--style") == 0) {
QApplication::setStyle(argv[i+1]);
for(int j=i; j<argc-1; j++) argv[j] = argv[j+2];
argc -= 2;
}
QApplication a(argc, argv);
ScreenShot screenshot;
for(int i=1; i<argc; i++) if(strcmp(argv[i], "--delay") == 0) {
int s = atoi(argv[i+1]);
screenshot.delaySpinBox->setValue(s);
//screenshot.NewScreenShot();
sleep(s);
for(int j=i; j<argc-1; j++) argv[j] = argv[j+2];
argc -= 2;
}
screenshot.show();
screenshot.move(screenshot.center());
return a.exec();
}