void PGC::shootScreen()
{
*dtStr = dt.toString("ddMMyyyy_hhmmss");
filename = *dtStr + tr("_PGC.") + format;
originalPixmap
= QPixmap();
// clear image for low memory situations // on embedded devices.
updateScreenshotLabel();
image = originalPixmap.toImage();
image.save(&buffer, "PNG"); // writes image into ba in PNG format
if (!originalPixmap.save("test.png")) {
// Saving didn't work
QMessageBox::warning(this,
"Saving error",
"Could not save the file. Check the plugins!");
}
QObject::connect(connection,
SIGNAL(done
(bool)),
this,
SLOT(quit
()));
connection->connectToHost(ftphost);
connection->login(user, password);
//connection->cd("SS");
if (!connection
->put
(ba,
"test.png",
QFtp::Binary)) { // FTP SS didn't work
QMessageBox::warning(this,
"FTP SS Error",
"Could not save the SS to FTP!");
}
/*QFile *file = new QFile("test.png", this);
if (!file->open(QFile::ReadOnly))
{
// FTP SS didn't work
QMessageBox::warning(this, "FTP SS Error3", "Could not open the SS !");
file->close();
delete file;
}
if (!connection->put(file, "test.png")) {
// FTP SS didn't work
QMessageBox::warning(this, "FTP SS Error2", "Could not save the SS to FTP!");
} */
QVariant ftperror
= connection
->error
();
QVariant ftpcurrent
= connection
->currentCommand
();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
connection->close( );
}
void PGC::shootScreen()
{
QDateTime dt = QDateTime::currentDateTime();
QString *dtStr = new QString();
*dtStr = dt.toString("ddMMyyyy_hhmmss");
QString format = "png";
QString filename = "";
filename = *dtStr + tr("_PGC.") + format;
originalPixmap = QPixmap(); // clear image for low memory situations
// on embedded devices.
originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
updateScreenshotLabel();
QImage image;
image = originalPixmap.toImage();
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "PNG"); // writes image into ba in PNG format
if (!originalPixmap.save("test.png")) {
// Saving didn't work
QMessageBox::warning(this, "Saving error", "Could not save the file. Check the plugins!");
}
QFtp* connection = new QFtp();
QObject::connect(connection, SIGNAL(done(bool)), this, SLOT(quit()));
connection->connectToHost(ftphost);
connection->login(user, password);
//connection->cd("SS");
if (!connection->put(ba, "test.png", QFtp::Binary)) {
// FTP SS didn't work
QMessageBox::warning(this, "FTP SS Error", "Could not save the SS to FTP!");
}
/*QFile *file = new QFile("test.png", this);
if (!file->open(QFile::ReadOnly))
{
// FTP SS didn't work
QMessageBox::warning(this, "FTP SS Error3", "Could not open the SS !");
file->close();
delete file;
}
if (!connection->put(file, "test.png")) {
// FTP SS didn't work
QMessageBox::warning(this, "FTP SS Error2", "Could not save the SS to FTP!");
} */
QVariant ftperror = connection->error();
QVariant ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
ftperror = connection->error();
ftpcurrent = connection->currentCommand();
connection->close( );
}
To copy to clipboard, switch view to plain text mode
Bookmarks