void PGC::shootScreen()
{
originalPixmap
= QPixmap();
// clear image for low memory situations
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!");
}
connection->close( );
}
void PGC::shootScreen()
{
originalPixmap = QPixmap(); // clear image for low memory situations
originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
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!");
}
connection->close( );
}
To copy to clipboard, switch view to plain text mode
Bookmarks