diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2012-11-27 14:18:41 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-28 00:56:34 +0100 |
commit | cb961007c534b260b779ed513d33843a9dce01f4 (patch) | |
tree | d780db451451d51ab10aa114a6e01f813e32c852 /examples/tools/codecs | |
parent | 3d66b86cb7407201f091d16130b3da73e613cc5f (diff) |
Examples: move widgets specific "tools" examples to the correct place
examples/tools -> examples/widgets/tools
Change-Id: I8b9e23c45e07ce5cd9da8f24a9a9f7ae10b2b107
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples/tools/codecs')
-rw-r--r-- | examples/tools/codecs/codecs.desktop | 11 | ||||
-rw-r--r-- | examples/tools/codecs/codecs.pro | 15 | ||||
-rw-r--r-- | examples/tools/codecs/encodedfiles/iso-8859-1.txt | 6 | ||||
-rw-r--r-- | examples/tools/codecs/encodedfiles/iso-8859-15.txt | 8 | ||||
-rw-r--r-- | examples/tools/codecs/encodedfiles/utf-16.txt | bin | 162 -> 0 bytes | |||
-rw-r--r-- | examples/tools/codecs/encodedfiles/utf-16be.txt | bin | 160 -> 0 bytes | |||
-rw-r--r-- | examples/tools/codecs/encodedfiles/utf-16le.txt | bin | 160 -> 0 bytes | |||
-rw-r--r-- | examples/tools/codecs/encodedfiles/utf-8.txt | 6 | ||||
-rw-r--r-- | examples/tools/codecs/main.cpp | 51 | ||||
-rw-r--r-- | examples/tools/codecs/mainwindow.cpp | 202 | ||||
-rw-r--r-- | examples/tools/codecs/mainwindow.h | 87 | ||||
-rw-r--r-- | examples/tools/codecs/previewform.cpp | 101 | ||||
-rw-r--r-- | examples/tools/codecs/previewform.h | 79 |
13 files changed, 0 insertions, 566 deletions
diff --git a/examples/tools/codecs/codecs.desktop b/examples/tools/codecs/codecs.desktop deleted file mode 100644 index bba62207f8..0000000000 --- a/examples/tools/codecs/codecs.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=Codecs -Exec=/opt/usr/bin/codecs -Icon=codecs -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tools/codecs/codecs.pro b/examples/tools/codecs/codecs.pro deleted file mode 100644 index 377dfaa8c9..0000000000 --- a/examples/tools/codecs/codecs.pro +++ /dev/null @@ -1,15 +0,0 @@ -HEADERS += mainwindow.h \ - previewform.h -SOURCES += main.cpp \ - mainwindow.cpp \ - previewform.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/codecs -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS encodedfiles codecs.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/tools/codecs -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tools/codecs/encodedfiles/iso-8859-1.txt b/examples/tools/codecs/encodedfiles/iso-8859-1.txt deleted file mode 100644 index d7fcacae66..0000000000 --- a/examples/tools/codecs/encodedfiles/iso-8859-1.txt +++ /dev/null @@ -1,6 +0,0 @@ -Paulo Coelho: O Gênio e as Rosas -Anna Hallström, Urban Östberg: Svår svenska -Darrell Huff: How to Lie with Statistics -Franz Kafka: Das Schloß -Walter Moers: Die 13½ Leben des Käpt'n Blaubär -Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige diff --git a/examples/tools/codecs/encodedfiles/iso-8859-15.txt b/examples/tools/codecs/encodedfiles/iso-8859-15.txt deleted file mode 100644 index be2d83c98d..0000000000 --- a/examples/tools/codecs/encodedfiles/iso-8859-15.txt +++ /dev/null @@ -1,8 +0,0 @@ -Paulo Coelho: O Gênio e as Rosas -Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour -Anna Hallström, Urban Östberg: Svår svenska -Darrell Huff: How to Lie with Statistics -Franz Kafka: Das Schloß -Helena Lehecková: T¨ekkiä suomalaisille -Arthur Rimbaud: ¼uvres complètes -Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige diff --git a/examples/tools/codecs/encodedfiles/utf-16.txt b/examples/tools/codecs/encodedfiles/utf-16.txt Binary files differdeleted file mode 100644 index 371f06f7fa..0000000000 --- a/examples/tools/codecs/encodedfiles/utf-16.txt +++ /dev/null diff --git a/examples/tools/codecs/encodedfiles/utf-16be.txt b/examples/tools/codecs/encodedfiles/utf-16be.txt Binary files differdeleted file mode 100644 index d8ae6428bc..0000000000 --- a/examples/tools/codecs/encodedfiles/utf-16be.txt +++ /dev/null diff --git a/examples/tools/codecs/encodedfiles/utf-16le.txt b/examples/tools/codecs/encodedfiles/utf-16le.txt Binary files differdeleted file mode 100644 index 3779264c7c..0000000000 --- a/examples/tools/codecs/encodedfiles/utf-16le.txt +++ /dev/null diff --git a/examples/tools/codecs/encodedfiles/utf-8.txt b/examples/tools/codecs/encodedfiles/utf-8.txt deleted file mode 100644 index a5e4ae6fa7..0000000000 --- a/examples/tools/codecs/encodedfiles/utf-8.txt +++ /dev/null @@ -1,6 +0,0 @@ -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : í•œêµì–´ -言語: 日本語 -Langage : Français diff --git a/examples/tools/codecs/main.cpp b/examples/tools/codecs/main.cpp deleted file mode 100644 index f03543e449..0000000000 --- a/examples/tools/codecs/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QApplication> - -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWindow mainWin; - mainWin.show(); - return app.exec(); -} diff --git a/examples/tools/codecs/mainwindow.cpp b/examples/tools/codecs/mainwindow.cpp deleted file mode 100644 index 4009e30720..0000000000 --- a/examples/tools/codecs/mainwindow.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtWidgets> - -#include "mainwindow.h" -#include "previewform.h" - -MainWindow::MainWindow() -{ - textEdit = new QTextEdit; - textEdit->setLineWrapMode(QTextEdit::NoWrap); - setCentralWidget(textEdit); - - findCodecs(); - - previewForm = new PreviewForm(this); - previewForm->setCodecList(codecs); - - createActions(); - createMenus(); - - setWindowTitle(tr("Codecs")); - resize(500, 400); -} - -void MainWindow::open() -{ - QString fileName = QFileDialog::getOpenFileName(this); - if (!fileName.isEmpty()) { - QFile file(fileName); - if (!file.open(QFile::ReadOnly)) { - QMessageBox::warning(this, tr("Codecs"), - tr("Cannot read file %1:\n%2") - .arg(fileName) - .arg(file.errorString())); - return; - } - - QByteArray data = file.readAll(); - - previewForm->setEncodedData(data); - if (previewForm->exec()) - textEdit->setPlainText(previewForm->decodedString()); - } -} - -void MainWindow::save() -{ - QString fileName = QFileDialog::getSaveFileName(this); - if (!fileName.isEmpty()) { - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) { - QMessageBox::warning(this, tr("Codecs"), - tr("Cannot write file %1:\n%2") - .arg(fileName) - .arg(file.errorString())); - return; - } - - QAction *action = qobject_cast<QAction *>(sender()); - QByteArray codecName = action->data().toByteArray(); - - QTextStream out(&file); - out.setCodec(codecName.constData()); - out << textEdit->toPlainText(); - } -} - -void MainWindow::about() -{ - QMessageBox::about(this, tr("About Codecs"), - tr("The <b>Codecs</b> example demonstrates how to read and write " - "files using various encodings.")); -} - -void MainWindow::aboutToShowSaveAsMenu() -{ - QString currentText = textEdit->toPlainText(); - - foreach (QAction *action, saveAsActs) { - QByteArray codecName = action->data().toByteArray(); - QTextCodec *codec = QTextCodec::codecForName(codecName); - action->setVisible(codec && codec->canEncode(currentText)); - } -} - -void MainWindow::findCodecs() -{ - QMap<QString, QTextCodec *> codecMap; - QRegExp iso8859RegExp("ISO[- ]8859-([0-9]+).*"); - - foreach (int mib, QTextCodec::availableMibs()) { - QTextCodec *codec = QTextCodec::codecForMib(mib); - - QString sortKey = codec->name().toUpper(); - int rank; - - if (sortKey.startsWith("UTF-8")) { - rank = 1; - } else if (sortKey.startsWith("UTF-16")) { - rank = 2; - } else if (iso8859RegExp.exactMatch(sortKey)) { - if (iso8859RegExp.cap(1).size() == 1) - rank = 3; - else - rank = 4; - } else { - rank = 5; - } - sortKey.prepend(QChar('0' + rank)); - - codecMap.insert(sortKey, codec); - } - codecs = codecMap.values(); -} - -void MainWindow::createActions() -{ - openAct = new QAction(tr("&Open..."), this); - openAct->setShortcuts(QKeySequence::Open); - connect(openAct, SIGNAL(triggered()), this, SLOT(open())); - - foreach (QTextCodec *codec, codecs) { - QString text = tr("%1...").arg(QString(codec->name())); - - QAction *action = new QAction(text, this); - action->setData(codec->name()); - connect(action, SIGNAL(triggered()), this, SLOT(save())); - saveAsActs.append(action); - } - - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - - aboutAct = new QAction(tr("&About"), this); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - - aboutQtAct = new QAction(tr("About &Qt"), this); - connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); -} - -void MainWindow::createMenus() -{ - saveAsMenu = new QMenu(tr("&Save As"), this); - foreach (QAction *action, saveAsActs) - saveAsMenu->addAction(action); - connect(saveAsMenu, SIGNAL(aboutToShow()), - this, SLOT(aboutToShowSaveAsMenu())); - - fileMenu = new QMenu(tr("&File"), this); - fileMenu->addAction(openAct); - fileMenu->addMenu(saveAsMenu); - fileMenu->addSeparator(); - fileMenu->addAction(exitAct); - - helpMenu = new QMenu(tr("&Help"), this); - helpMenu->addAction(aboutAct); - helpMenu->addAction(aboutQtAct); - - menuBar()->addMenu(fileMenu); - menuBar()->addSeparator(); - menuBar()->addMenu(helpMenu); -} diff --git a/examples/tools/codecs/mainwindow.h b/examples/tools/codecs/mainwindow.h deleted file mode 100644 index 1e04c3bf65..0000000000 --- a/examples/tools/codecs/mainwindow.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QList> -#include <QMainWindow> - -QT_BEGIN_NAMESPACE -class QAction; -class QMenu; -class QTextCodec; -class QTextEdit; -QT_END_NAMESPACE -class PreviewForm; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -private slots: - void open(); - void save(); - void about(); - void aboutToShowSaveAsMenu(); - -private: - void findCodecs(); - void createActions(); - void createMenus(); - - QTextEdit *textEdit; - PreviewForm *previewForm; - QList<QTextCodec *> codecs; - - QMenu *fileMenu; - QMenu *helpMenu; - QMenu *saveAsMenu; - QAction *openAct; - QList<QAction *> saveAsActs; - QAction *exitAct; - QAction *aboutAct; - QAction *aboutQtAct; -}; - -#endif diff --git a/examples/tools/codecs/previewform.cpp b/examples/tools/codecs/previewform.cpp deleted file mode 100644 index dc518555d2..0000000000 --- a/examples/tools/codecs/previewform.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtWidgets> - -#include "previewform.h" - -PreviewForm::PreviewForm(QWidget *parent) - : QDialog(parent) -{ - encodingComboBox = new QComboBox; - - encodingLabel = new QLabel(tr("&Encoding:")); - encodingLabel->setBuddy(encodingComboBox); - - textEdit = new QTextEdit; - textEdit->setLineWrapMode(QTextEdit::NoWrap); - textEdit->setReadOnly(true); - - buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok - | QDialogButtonBox::Cancel); - - connect(encodingComboBox, SIGNAL(activated(int)), - this, SLOT(updateTextEdit())); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(encodingLabel, 0, 0); - mainLayout->addWidget(encodingComboBox, 0, 1); - mainLayout->addWidget(textEdit, 1, 0, 1, 2); - mainLayout->addWidget(buttonBox, 2, 0, 1, 2); - setLayout(mainLayout); - - setWindowTitle(tr("Choose Encoding")); - resize(400, 300); -} - -void PreviewForm::setCodecList(const QList<QTextCodec *> &list) -{ - encodingComboBox->clear(); - foreach (QTextCodec *codec, list) - encodingComboBox->addItem(codec->name(), codec->mibEnum()); -} - -void PreviewForm::setEncodedData(const QByteArray &data) -{ - encodedData = data; - updateTextEdit(); -} - -void PreviewForm::updateTextEdit() -{ - int mib = encodingComboBox->itemData( - encodingComboBox->currentIndex()).toInt(); - QTextCodec *codec = QTextCodec::codecForMib(mib); - - QTextStream in(&encodedData); - in.setAutoDetectUnicode(false); - in.setCodec(codec); - decodedStr = in.readAll(); - - textEdit->setPlainText(decodedStr); -} diff --git a/examples/tools/codecs/previewform.h b/examples/tools/codecs/previewform.h deleted file mode 100644 index d8e2838e8e..0000000000 --- a/examples/tools/codecs/previewform.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PREVIEWFORM_H -#define PREVIEWFORM_H - -#include <QDialog> -#include <QList> - -QT_BEGIN_NAMESPACE -class QComboBox; -class QDialogButtonBox; -class QLabel; -class QTextCodec; -class QTextEdit; -QT_END_NAMESPACE - -class PreviewForm : public QDialog -{ - Q_OBJECT - -public: - PreviewForm(QWidget *parent = 0); - - void setCodecList(const QList<QTextCodec *> &list); - void setEncodedData(const QByteArray &data); - QString decodedString() const { return decodedStr; } - -private slots: - void updateTextEdit(); - -private: - QByteArray encodedData; - QString decodedStr; - - QComboBox *encodingComboBox; - QLabel *encodingLabel; - QTextEdit *textEdit; - QDialogButtonBox *buttonBox; -}; - -#endif |