summaryrefslogtreecommitdiffstats
path: root/tdeio/tests/previewtest.cpp
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2013-03-02 15:57:34 -0600
committerDarrell Anderson <humanreadable@yahoo.com>2013-03-02 15:57:34 -0600
commit7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f (patch)
treec76702a7f6310fbe9d437e347535422e836e94e9 /tdeio/tests/previewtest.cpp
parenta2a38be7600e2a2c2b49c66902d912ca036a2c0f (diff)
parent27bbee9a5f9dcda53d8eb23863ee670ad1360e41 (diff)
downloadtdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.tar.gz
tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdeio/tests/previewtest.cpp')
-rw-r--r--tdeio/tests/previewtest.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/tdeio/tests/previewtest.cpp b/tdeio/tests/previewtest.cpp
new file mode 100644
index 000000000..6d0cd78b2
--- /dev/null
+++ b/tdeio/tests/previewtest.cpp
@@ -0,0 +1,64 @@
+
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+
+#include <tdeapplication.h>
+#include <kdebug.h>
+#include <klineedit.h>
+
+#include <tdeio/previewjob.h>
+
+#include "previewtest.moc"
+
+PreviewTest::PreviewTest()
+ :TQWidget()
+{
+ TQGridLayout *layout = new TQGridLayout(this, 2, 2);
+ m_url = new KLineEdit(this);
+ m_url->setText("/home/malte/gore_bush.jpg");
+ layout->addWidget(m_url, 0, 0);
+ TQPushButton *btn = new TQPushButton("Generate", this);
+ connect(btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotGenerate()));
+ layout->addWidget(btn, 0, 1);
+ m_preview = new TQLabel(this);
+ m_preview->setMinimumSize(400, 300);
+ layout->addMultiCellWidget(m_preview, 1, 1, 0, 1);
+}
+
+void PreviewTest::slotGenerate()
+{
+ KURL::List urls;
+ urls.append(m_url->text());
+ TDEIO::PreviewJob *job = TDEIO::filePreview(urls, m_preview->width(), m_preview->height(), true, 48);
+ connect(job, TQT_SIGNAL(result(TDEIO::Job*)), TQT_SLOT(slotResult(TDEIO::Job*)));
+ connect(job, TQT_SIGNAL(gotPreview(const KFileItem *, const TQPixmap &)), TQT_SLOT(slotPreview(const KFileItem *, const TQPixmap &)));
+ connect(job, TQT_SIGNAL(failed(const KFileItem *)), TQT_SLOT(slotFailed()));
+}
+
+void PreviewTest::slotResult(TDEIO::Job*)
+{
+ kdDebug() << "PreviewTest::slotResult(...)" << endl;
+}
+
+void PreviewTest::slotPreview(const KFileItem *, const TQPixmap &pix)
+{
+ kdDebug() << "PreviewTest::slotPreview()" << endl;
+ m_preview->setPixmap(pix);
+}
+
+void PreviewTest::slotFailed()
+{
+ kdDebug() << "PreviewTest::slotFailed()" << endl;
+ m_preview->setText("failed");
+}
+
+int main(int argc, char **argv)
+{
+ TDEApplication app(argc, argv, "previewtest");
+ PreviewTest *w = new PreviewTest;
+ w->show();
+ app.setMainWidget(w);
+ return app.exec();
+}
+