summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/images/find.pngbin0 -> 1944 bytes
-rw-r--r--example/images/open.pngbin0 -> 2073 bytes
-rw-r--r--example/images/qhexedit.icobin0 -> 22382 bytes
-rw-r--r--example/images/qhexedit.svg157
-rw-r--r--example/images/qhexedit16.pngbin0 -> 760 bytes
-rw-r--r--example/images/qhexedit32.pngbin0 -> 2020 bytes
-rw-r--r--example/images/qhexedit64.pngbin0 -> 4830 bytes
-rw-r--r--example/images/redo.pngbin0 -> 985 bytes
-rw-r--r--example/images/save.pngbin0 -> 1187 bytes
-rw-r--r--example/images/undo.pngbin0 -> 962 bytes
-rw-r--r--example/main.cpp30
-rw-r--r--example/mainwindow.cpp433
-rw-r--r--example/mainwindow.h98
-rw-r--r--example/optionsdialog.cpp147
-rw-r--r--example/optionsdialog.h40
-rw-r--r--example/optionsdialog.ui449
-rw-r--r--example/qhexedit.pro45
-rw-r--r--example/qhexedit.qrc10
-rw-r--r--example/searchdialog.cpp115
-rw-r--r--example/searchdialog.h34
-rw-r--r--example/searchdialog.ui200
-rw-r--r--example/translations/qhexedit_cs.qmbin0 -> 4257 bytes
-rw-r--r--example/translations/qhexedit_cs.ts460
-rw-r--r--example/translations/qhexedit_de.qmbin0 -> 7319 bytes
-rw-r--r--example/translations/qhexedit_de.ts468
-rw-r--r--example/translations/qhexedit_ru.qmbin0 -> 7256 bytes
-rw-r--r--example/translations/qhexedit_ru.ts432
27 files changed, 3118 insertions, 0 deletions
diff --git a/example/images/find.png b/example/images/find.png
new file mode 100644
index 0000000..6ea35e9
--- /dev/null
+++ b/example/images/find.png
Binary files differ
diff --git a/example/images/open.png b/example/images/open.png
new file mode 100644
index 0000000..45fa288
--- /dev/null
+++ b/example/images/open.png
Binary files differ
diff --git a/example/images/qhexedit.ico b/example/images/qhexedit.ico
new file mode 100644
index 0000000..940808e
--- /dev/null
+++ b/example/images/qhexedit.ico
Binary files differ
diff --git a/example/images/qhexedit.svg b/example/images/qhexedit.svg
new file mode 100644
index 0000000..9064a4c
--- /dev/null
+++ b/example/images/qhexedit.svg
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="39.881805mm"
+ height="39.744019mm"
+ viewBox="0 0 39.881805 39.744019"
+ version="1.1"
+ id="svg8"
+ inkscape:export-filename="/home/winni/Downloads/qhexedit16.png"
+ inkscape:export-xdpi="10.238628"
+ inkscape:export-ydpi="10.238628"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
+ sodipodi:docname="qhexedit.svg">
+ <defs
+ id="defs2">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient835">
+ <stop
+ style="stop-color:#c700c9;stop-opacity:1"
+ offset="0"
+ id="stop831" />
+ <stop
+ id="stop4549"
+ offset="0.27781248"
+ style="stop-color:#fe0000;stop-opacity:1" />
+ <stop
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="0.48380953"
+ id="stop4551" />
+ <stop
+ id="stop4553"
+ offset="0.64066964"
+ style="stop-color:#017f01;stop-opacity:1" />
+ <stop
+ style="stop-color:#010090;stop-opacity:1"
+ offset="0.86556548"
+ id="stop4593" />
+ <stop
+ style="stop-color:#010000;stop-opacity:1"
+ offset="1"
+ id="stop833" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient835"
+ id="linearGradient837"
+ x1="14.741072"
+ y1="12.572916"
+ x2="64.741074"
+ y2="62.572914"
+ gradientUnits="userSpaceOnUse" />
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4611">
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.75555611px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+ x="16.252977"
+ y="32.227669"
+ id="text4619"><tspan
+ sodipodi:role="line"
+ id="tspan4613"
+ x="16.252977"
+ y="32.227669"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.75555611px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">0100</tspan><tspan
+ sodipodi:role="line"
+ x="16.252977"
+ y="56.922115"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.75555611px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
+ id="tspan4615">0010</tspan><tspan
+ sodipodi:role="line"
+ x="16.252977"
+ y="81.616562"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.75555611px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
+ id="tspan4617" /></text>
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="143.59901"
+ inkscape:cy="57.090638"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1323"
+ inkscape:window-height="1047"
+ inkscape:window-x="-4"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Ebene 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-17.439468,-17.443269)">
+ <rect
+ style="opacity:0.831;fill:url(#linearGradient837);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.26499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect829"
+ width="50"
+ height="50"
+ x="14.741072"
+ y="12.572916"
+ clip-path="url(#clipPath4611)"
+ inkscape:export-xdpi="40.901733"
+ inkscape:export-ydpi="40.901733"
+ transform="matrix(0.88285898,0,0,1.0027123,2.0428771,-0.16971566)" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+ x="20.599701"
+ y="75.883926"
+ id="text4557"><tspan
+ sodipodi:role="line"
+ id="tspan4555"
+ x="20.599701"
+ y="85.247696"
+ style="stroke-width:0.26458332" /></text>
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4567"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
+ transform="scale(0.26458333)"><flowRegion
+ id="flowRegion4569"><rect
+ id="rect4571"
+ width="225.71428"
+ height="151.42857"
+ x="65"
+ y="268.94824" /></flowRegion><flowPara
+ id="flowPara4573"></flowPara></flowRoot> </g>
+</svg>
diff --git a/example/images/qhexedit16.png b/example/images/qhexedit16.png
new file mode 100644
index 0000000..8136b90
--- /dev/null
+++ b/example/images/qhexedit16.png
Binary files differ
diff --git a/example/images/qhexedit32.png b/example/images/qhexedit32.png
new file mode 100644
index 0000000..04466fc
--- /dev/null
+++ b/example/images/qhexedit32.png
Binary files differ
diff --git a/example/images/qhexedit64.png b/example/images/qhexedit64.png
new file mode 100644
index 0000000..f75aa4d
--- /dev/null
+++ b/example/images/qhexedit64.png
Binary files differ
diff --git a/example/images/redo.png b/example/images/redo.png
new file mode 100644
index 0000000..5591517
--- /dev/null
+++ b/example/images/redo.png
Binary files differ
diff --git a/example/images/save.png b/example/images/save.png
new file mode 100644
index 0000000..daba865
--- /dev/null
+++ b/example/images/save.png
Binary files differ
diff --git a/example/images/undo.png b/example/images/undo.png
new file mode 100644
index 0000000..8cf63a8
--- /dev/null
+++ b/example/images/undo.png
Binary files differ
diff --git a/example/main.cpp b/example/main.cpp
new file mode 100644
index 0000000..c742e45
--- /dev/null
+++ b/example/main.cpp
@@ -0,0 +1,30 @@
+#include <QApplication>
+#include <QIcon>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(qhexedit);
+ QApplication app(argc, argv);
+ app.setApplicationName("QHexEdit");
+ app.setOrganizationName("QHexEdit");
+ app.setWindowIcon(QIcon(":images/qhexedit.ico"));
+
+ // Identify locale and load translation if available
+ QString locale = QLocale::system().name();
+ QTranslator translator;
+ translator.load(QString("qhexedit_") + locale);
+ app.installTranslator(&translator);
+
+ QCommandLineParser parser;
+ parser.addPositionalArgument("file", "File to open");
+ parser.addHelpOption();
+ parser.process(app);
+ MainWindow *mainWin = new MainWindow;
+ if(!parser.positionalArguments().isEmpty())
+ mainWin->loadFile(parser.positionalArguments().at(0));
+ mainWin->show();
+
+ return app.exec();
+}
diff --git a/example/mainwindow.cpp b/example/mainwindow.cpp
new file mode 100644
index 0000000..fcfce71
--- /dev/null
+++ b/example/mainwindow.cpp
@@ -0,0 +1,433 @@
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QApplication>
+#include <QStatusBar>
+#include <QLabel>
+#include <QAction>
+#include <QMenuBar>
+#include <QToolBar>
+#include <QColorDialog>
+#include <QFontDialog>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+
+#include "mainwindow.h"
+
+/*****************************************************************************/
+/* Public methods */
+/*****************************************************************************/
+MainWindow::MainWindow()
+{
+ setAcceptDrops( true );
+ init();
+ setCurrentFile("");
+}
+
+/*****************************************************************************/
+/* Protected methods */
+/*****************************************************************************/
+void MainWindow::closeEvent(QCloseEvent *)
+{
+ writeSettings();
+}
+
+
+void MainWindow::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasUrls())
+ event->accept();
+}
+
+
+void MainWindow::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasUrls())
+ {
+ QList<QUrl> urls = event->mimeData()->urls();
+ QString filePath = urls.at(0).toLocalFile();
+ loadFile(filePath);
+ event->accept();
+ }
+}
+
+/*****************************************************************************/
+/* Private Slots */
+/*****************************************************************************/
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About QHexEdit"),
+ tr("The QHexEdit example is a short Demo of the QHexEdit Widget."));
+}
+
+void MainWindow::dataChanged()
+{
+ setWindowModified(hexEdit->isModified());
+}
+
+void MainWindow::open()
+{
+ QString fileName = QFileDialog::getOpenFileName(this);
+ if (!fileName.isEmpty()) {
+ loadFile(fileName);
+ }
+}
+
+void MainWindow::optionsAccepted()
+{
+ writeSettings();
+ readSettings();
+}
+
+void MainWindow::findNext()
+{
+ searchDialog->findNext();
+}
+
+bool MainWindow::save()
+{
+ if (isUntitled) {
+ return saveAs();
+ } else {
+ return saveFile(curFile);
+ }
+}
+
+bool MainWindow::saveAs()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
+ curFile);
+ if (fileName.isEmpty())
+ return false;
+
+ return saveFile(fileName);
+}
+
+void MainWindow::saveSelectionToReadableFile()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save To Readable File"));
+ if (!fileName.isEmpty())
+ {
+ QFile file(fileName);
+ if (!file.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, tr("QHexEdit"),
+ tr("Cannot write file %1:\n%2.")
+ .arg(fileName)
+ .arg(file.errorString()));
+ return;
+ }
+
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ file.write(hexEdit->selectionToReadableString().toLatin1());
+ QApplication::restoreOverrideCursor();
+
+ statusBar()->showMessage(tr("File saved"), 2000);
+ }
+}
+
+void MainWindow::saveToReadableFile()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save To Readable File"));
+ if (!fileName.isEmpty())
+ {
+ QFile file(fileName);
+ if (!file.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, tr("QHexEdit"),
+ tr("Cannot write file %1:\n%2.")
+ .arg(fileName)
+ .arg(file.errorString()));
+ return;
+ }
+
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ file.write(hexEdit->toReadableString().toLatin1());
+ QApplication::restoreOverrideCursor();
+
+ statusBar()->showMessage(tr("File saved"), 2000);
+ }
+}
+
+void MainWindow::setAddress(qint64 address)
+{
+ lbAddress->setText(QString("%1").arg(address, 1, 16));
+}
+
+void MainWindow::setOverwriteMode(bool mode)
+{
+ QSettings settings;
+ settings.setValue("OverwriteMode", mode);
+ if (mode)
+ lbOverwriteMode->setText(tr("Overwrite"));
+ else
+ lbOverwriteMode->setText(tr("Insert"));
+}
+
+void MainWindow::setSize(qint64 size)
+{
+ lbSize->setText(QString("%1").arg(size));
+}
+
+void MainWindow::showOptionsDialog()
+{
+ optionsDialog->show();
+}
+
+void MainWindow::showSearchDialog()
+{
+ searchDialog->show();
+}
+
+/*****************************************************************************/
+/* Private Methods */
+/*****************************************************************************/
+void MainWindow::init()
+{
+ setAttribute(Qt::WA_DeleteOnClose);
+ optionsDialog = new OptionsDialog(this);
+ connect(optionsDialog, SIGNAL(accepted()), this, SLOT(optionsAccepted()));
+ isUntitled = true;
+
+ hexEdit = new QHexEdit;
+ setCentralWidget(hexEdit);
+ connect(hexEdit, SIGNAL(overwriteModeChanged(bool)), this, SLOT(setOverwriteMode(bool)));
+ connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(dataChanged()));
+ searchDialog = new SearchDialog(hexEdit, this);
+
+ createActions();
+ createMenus();
+ createToolBars();
+ createStatusBar();
+
+ readSettings();
+
+ setUnifiedTitleAndToolBarOnMac(true);
+}
+
+void MainWindow::createActions()
+{
+ openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
+ openAct->setShortcuts(QKeySequence::Open);
+ openAct->setStatusTip(tr("Open an existing file"));
+ connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
+
+ saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
+ saveAct->setShortcuts(QKeySequence::Save);
+ saveAct->setStatusTip(tr("Save the document to disk"));
+ connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
+
+ saveAsAct = new QAction(tr("Save &As..."), this);
+ saveAsAct->setShortcuts(QKeySequence::SaveAs);
+ saveAsAct->setStatusTip(tr("Save the document under a new name"));
+ connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
+
+ saveReadable = new QAction(tr("Save &Readable..."), this);
+ saveReadable->setStatusTip(tr("Save document in readable form"));
+ connect(saveReadable, SIGNAL(triggered()), this, SLOT(saveToReadableFile()));
+
+ exitAct = new QAction(tr("E&xit"), this);
+ exitAct->setShortcuts(QKeySequence::Quit);
+ exitAct->setStatusTip(tr("Exit the application"));
+ connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
+
+ undoAct = new QAction(QIcon(":/images/undo.png"), tr("&Undo"), this);
+ undoAct->setShortcuts(QKeySequence::Undo);
+ connect(undoAct, SIGNAL(triggered()), hexEdit, SLOT(undo()));
+
+ redoAct = new QAction(QIcon(":/images/redo.png"), tr("&Redo"), this);
+ redoAct->setShortcuts(QKeySequence::Redo);
+ connect(redoAct, SIGNAL(triggered()), hexEdit, SLOT(redo()));
+
+ saveSelectionReadable = new QAction(tr("&Save Selection Readable..."), this);
+ saveSelectionReadable->setStatusTip(tr("Save selection in readable form"));
+ connect(saveSelectionReadable, SIGNAL(triggered()), this, SLOT(saveSelectionToReadableFile()));
+
+ aboutAct = new QAction(tr("&About"), this);
+ aboutAct->setStatusTip(tr("Show the application's About box"));
+ connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+
+ aboutQtAct = new QAction(tr("About &Qt"), this);
+ aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
+ connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+
+ findAct = new QAction(QIcon(":/images/find.png"), tr("&Find/Replace"), this);
+ findAct->setShortcuts(QKeySequence::Find);
+ findAct->setStatusTip(tr("Show the Dialog for finding and replacing"));
+ connect(findAct, SIGNAL(triggered()), this, SLOT(showSearchDialog()));
+
+ findNextAct = new QAction(tr("Find &next"), this);
+ findNextAct->setShortcuts(QKeySequence::FindNext);
+ findNextAct->setStatusTip(tr("Find next occurrence of the searched pattern"));
+ connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext()));
+
+ optionsAct = new QAction(tr("&Options"), this);
+ optionsAct->setStatusTip(tr("Show the Dialog to select applications options"));
+ connect(optionsAct, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
+}
+
+void MainWindow::createMenus()
+{
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(openAct);
+ fileMenu->addAction(saveAct);
+ fileMenu->addAction(saveAsAct);
+ fileMenu->addAction(saveReadable);
+ fileMenu->addSeparator();
+ fileMenu->addAction(exitAct);
+
+ editMenu = menuBar()->addMenu(tr("&Edit"));
+ editMenu->addAction(undoAct);
+ editMenu->addAction(redoAct);
+ editMenu->addAction(saveSelectionReadable);
+ editMenu->addSeparator();
+ editMenu->addAction(findAct);
+ editMenu->addAction(findNextAct);
+ editMenu->addSeparator();
+ editMenu->addAction(optionsAct);
+
+ helpMenu = menuBar()->addMenu(tr("&Help"));
+ helpMenu->addAction(aboutAct);
+ helpMenu->addAction(aboutQtAct);
+}
+
+void MainWindow::createStatusBar()
+{
+ // Address Label
+ lbAddressName = new QLabel();
+ lbAddressName->setText(tr("Address:"));
+ statusBar()->addPermanentWidget(lbAddressName);
+ lbAddress = new QLabel();
+ lbAddress->setFrameShape(QFrame::Panel);
+ lbAddress->setFrameShadow(QFrame::Sunken);
+ lbAddress->setMinimumWidth(70);
+ statusBar()->addPermanentWidget(lbAddress);
+ connect(hexEdit, SIGNAL(currentAddressChanged(qint64)), this, SLOT(setAddress(qint64)));
+
+ // Size Label
+ lbSizeName = new QLabel();
+ lbSizeName->setText(tr("Size:"));
+ statusBar()->addPermanentWidget(lbSizeName);
+ lbSize = new QLabel();
+ lbSize->setFrameShape(QFrame::Panel);
+ lbSize->setFrameShadow(QFrame::Sunken);
+ lbSize->setMinimumWidth(70);
+ statusBar()->addPermanentWidget(lbSize);
+ connect(hexEdit, SIGNAL(currentSizeChanged(qint64)), this, SLOT(setSize(qint64)));
+
+ // Overwrite Mode Label
+ lbOverwriteModeName = new QLabel();
+ lbOverwriteModeName->setText(tr("Mode:"));
+ statusBar()->addPermanentWidget(lbOverwriteModeName);
+ lbOverwriteMode = new QLabel();
+ lbOverwriteMode->setFrameShape(QFrame::Panel);
+ lbOverwriteMode->setFrameShadow(QFrame::Sunken);
+ lbOverwriteMode->setMinimumWidth(70);
+ statusBar()->addPermanentWidget(lbOverwriteMode);
+ setOverwriteMode(hexEdit->overwriteMode());
+
+ statusBar()->showMessage(tr("Ready"), 2000);
+}
+
+void MainWindow::createToolBars()
+{
+ fileToolBar = addToolBar(tr("File"));
+ fileToolBar->addAction(openAct);
+ fileToolBar->addAction(saveAct);
+ editToolBar = addToolBar(tr("Edit"));
+ editToolBar->addAction(undoAct);
+ editToolBar->addAction(redoAct);
+ editToolBar->addAction(findAct);
+}
+
+void MainWindow::loadFile(const QString &fileName)
+{
+ file.setFileName(fileName);
+ if (!hexEdit->setData(file)) {
+ QMessageBox::warning(this, tr("QHexEdit"),
+ tr("Cannot read file %1:\n%2.")
+ .arg(fileName)
+ .arg(file.errorString()));
+ return;
+ }
+ setCurrentFile(fileName);
+ statusBar()->showMessage(tr("File loaded"), 2000);
+}
+
+void MainWindow::readSettings()
+{
+ QSettings settings;
+ QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
+ QSize size = settings.value("size", QSize(610, 460)).toSize();
+ move(pos);
+ resize(size);
+
+ hexEdit->setAddressArea(settings.value("AddressArea").toBool());
+ hexEdit->setAsciiArea(settings.value("AsciiArea").toBool());
+ hexEdit->setHighlighting(settings.value("Highlighting").toBool());
+ hexEdit->setOverwriteMode(settings.value("OverwriteMode").toBool());
+ hexEdit->setReadOnly(settings.value("ReadOnly").toBool());
+
+ hexEdit->setHighlightingColor(settings.value("HighlightingColor").value<QColor>());
+ hexEdit->setAddressAreaColor(settings.value("AddressAreaColor").value<QColor>());
+ hexEdit->setSelectionColor(settings.value("SelectionColor").value<QColor>());
+ hexEdit->setFont(settings.value("WidgetFont").value<QFont>());
+ hexEdit->setAddressFontColor(settings.value("AddressFontColor").value<QColor>());
+ hexEdit->setAsciiAreaColor(settings.value("AsciiAreaColor").value<QColor>());
+ hexEdit->setAsciiFontColor(settings.value("AsciiFontColor").value<QColor>());
+ hexEdit->setHexFontColor(settings.value("HexFontColor").value<QColor>());
+
+ hexEdit->setAddressWidth(settings.value("AddressAreaWidth").toInt());
+ hexEdit->setBytesPerLine(settings.value("BytesPerLine").toInt());
+ hexEdit->setHexCaps(settings.value("HexCaps", true).toBool());
+}
+
+bool MainWindow::saveFile(const QString &fileName)
+{
+ QString tmpFileName = fileName + ".~tmp";
+
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ QFile file(tmpFileName);
+ bool ok = hexEdit->write(file);
+ if (QFile::exists(fileName))
+ ok = QFile::remove(fileName);
+ if (ok)
+ {
+ file.setFileName(tmpFileName);
+ ok = file.copy(fileName);
+ if (ok)
+ ok = QFile::remove(tmpFileName);
+ }
+ QApplication::restoreOverrideCursor();
+
+ if (!ok) {
+ QMessageBox::warning(this, tr("QHexEdit"),
+ tr("Cannot write file %1.")
+ .arg(fileName));
+ return false;
+ }
+
+ setCurrentFile(fileName);
+ statusBar()->showMessage(tr("File saved"), 2000);
+ return true;
+}
+
+void MainWindow::setCurrentFile(const QString &fileName)
+{
+ curFile = QFileInfo(fileName).canonicalFilePath();
+ isUntitled = fileName.isEmpty();
+ setWindowModified(false);
+ if (fileName.isEmpty())
+ setWindowFilePath("QHexEdit");
+ else
+ setWindowFilePath(curFile + " - QHexEdit");
+}
+
+QString MainWindow::strippedName(const QString &fullFileName)
+{
+ return QFileInfo(fullFileName).fileName();
+}
+
+void MainWindow::writeSettings()
+{
+ QSettings settings;
+ settings.setValue("pos", pos());
+ settings.setValue("size", size());
+}
diff --git a/example/mainwindow.h b/example/mainwindow.h
new file mode 100644
index 0000000..751beec
--- /dev/null
+++ b/example/mainwindow.h
@@ -0,0 +1,98 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "../src/qhexedit.h"
+#include "optionsdialog.h"
+#include "searchdialog.h"
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QMenu;
+class QUndoStack;
+class QLabel;
+class QDragEnterEvent;
+class QDropEvent;
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+protected:
+ void closeEvent(QCloseEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dropEvent(QDropEvent *event);
+
+private slots:
+ void about();
+ void dataChanged();
+ void open();
+ void optionsAccepted();
+ void findNext();
+ bool save();
+ bool saveAs();
+ void saveSelectionToReadableFile();
+ void saveToReadableFile();
+ void setAddress(qint64 address);
+ void setOverwriteMode(bool mode);
+ void setSize(qint64 size);
+ void showOptionsDialog();
+ void showSearchDialog();
+
+public:
+ void loadFile(const QString &fileName);
+
+private:
+ void init();
+ void createActions();
+ void createMenus();
+ void createStatusBar();
+ void createToolBars();
+ void readSettings();
+ bool saveFile(const QString &fileName);
+ void setCurrentFile(const QString &fileName);
+ QString strippedName(const QString &fullFileName);
+ void writeSettings();
+
+ QString curFile;
+ QFile file;
+ bool isUntitled;
+
+ QMenu *fileMenu;
+ QMenu *editMenu;
+ QMenu *helpMenu;
+
+ QToolBar *fileToolBar;
+ QToolBar *editToolBar;
+
+ QAction *openAct;
+ QAction *saveAct;
+ QAction *saveAsAct;
+ QAction *saveReadable;
+ QAction *closeAct;
+ QAction *exitAct;
+
+ QAction *undoAct;
+ QAction *redoAct;
+ QAction *saveSelectionReadable;
+
+ QAction *aboutAct;
+ QAction *aboutQtAct;
+ QAction *optionsAct;
+ QAction *findAct;
+ QAction *findNextAct;
+
+ QHexEdit *hexEdit;
+ OptionsDialog *optionsDialog;
+ SearchDialog *searchDialog;
+ QLabel *lbAddress, *lbAddressName;
+ QLabel *lbOverwriteMode, *lbOverwriteModeName;
+ QLabel *lbSize, *lbSizeName;
+};
+
+#endif
diff --git a/example/optionsdialog.cpp b/example/optionsdialog.cpp
new file mode 100644
index 0000000..eda9408
--- /dev/null
+++ b/example/optionsdialog.cpp
@@ -0,0 +1,147 @@
+
+#include <QColorDialog>
+#include <QFontDialog>
+
+#include "optionsdialog.h"
+#include "ui_optionsdialog.h"
+
+OptionsDialog::OptionsDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::OptionsDialog)
+{
+ ui->setupUi(this);
+ readSettings();
+ writeSettings();
+}
+
+OptionsDialog::~OptionsDialog()
+{
+ delete ui;
+}
+
+void OptionsDialog::show()
+{
+ readSettings();
+ QWidget::show();
+}
+
+void OptionsDialog::accept()
+{
+ writeSettings();
+ emit accepted();
+ QDialog::hide();
+}
+
+void OptionsDialog::readSettings()
+{
+ QSettings settings;
+
+ ui->cbAddressArea->setChecked(settings.value("AddressArea", true).toBool());
+ ui->cbAsciiArea->setChecked(settings.value("AsciiArea", true).toBool());
+ ui->cbHighlighting->setChecked(settings.value("Highlighting", true).toBool());
+ ui->cbOverwriteMode->setChecked(settings.value("OverwriteMode", true).toBool());
+ ui->cbReadOnly->setChecked(settings.value("ReadOnly").toBool());
+
+ setColor(ui->lbHighlightingColor, settings.value("HighlightingColor", QColor(0xff, 0xff, 0x99, 0xff)).value<QColor>());
+ setColor(ui->lbAddressAreaColor, settings.value("AddressAreaColor", this->palette().alternateBase().color()).value<QColor>());
+ setColor(ui->lbSelectionColor, settings.value("SelectionColor", this->palette().highlight().color()).value<QColor>());
+ setColor(ui->lbAddressFontColor, settings.value("AddressFontColor", QPalette::WindowText).value<QColor>());
+ setColor(ui->lbAsciiAreaColor, settings.value("AsciiAreaColor", this->palette().alternateBase().color()).value<QColor>());
+ setColor(ui->lbAsciiFontColor, settings.value("AsciiFontColor", QPalette::WindowText).value<QColor>());
+ setColor(ui->lbHexFontColor, settings.value("HexFontColor", QPalette::WindowText).value<QColor>());
+#ifdef Q_OS_WIN32
+ ui->leWidgetFont->setFont(settings.value("WidgetFont", QFont("Courier", 10)).value<QFont>());
+#else
+ ui->leWidgetFont->setFont(settings.value("WidgetFont", QFont("Monospace", 10)).value<QFont>());
+#endif
+
+ ui->sbAddressAreaWidth->setValue(settings.value("AddressAreaWidth", 4).toInt());
+ ui->sbBytesPerLine->setValue(settings.value("BytesPerLine", 16).toInt());
+}
+
+void OptionsDialog::writeSettings()
+{
+ QSettings settings;
+ settings.setValue("AddressArea", ui->cbAddressArea->isChecked());
+ settings.setValue("AsciiArea", ui->cbAsciiArea->isChecked());
+ settings.setValue("Highlighting", ui->cbHighlighting->isChecked());
+ settings.setValue("OverwriteMode", ui->cbOverwriteMode->isChecked());
+ settings.setValue("ReadOnly", ui->cbReadOnly->isChecked());
+
+ settings.setValue("HighlightingColor", ui->lbHighlightingColor->palette().color(QPalette::Background));
+ settings.setValue("AddressAreaColor", ui->lbAddressAreaColor->palette().color(QPalette::Background));
+ settings.setValue("SelectionColor", ui->lbSelectionColor->palette().color(QPalette::Background));
+ settings.setValue("AddressFontColor", ui->lbAddressFontColor->palette().color(QPalette::Background));
+ settings.setValue("AsciiAreaColor", ui->lbAsciiAreaColor->palette().color(QPalette::Background));
+ settings.setValue("AsciiFontColor", ui->lbAsciiFontColor->palette().color(QPalette::Background));
+ settings.setValue("HexFontColor", ui->lbHexFontColor->palette().color(QPalette::Background));
+ settings.setValue("WidgetFont",ui->leWidgetFont->font());
+
+ settings.setValue("AddressAreaWidth", ui->sbAddressAreaWidth->value());
+ settings.setValue("BytesPerLine", ui->sbBytesPerLine->value());
+}
+
+void OptionsDialog::setColor(QWidget *widget, QColor color)
+{
+ QPalette palette = widget->palette();
+ palette.setColor(QPalette::Background, color);
+ widget->setPalette(palette);
+ widget->setAutoFillBackground(true);
+}
+
+void OptionsDialog::on_pbHighlightingColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbHighlightingColor->palette().color(QPalette::Background), this);
+ if (color.isValid())
+ setColor(ui->lbHighlightingColor, color);
+}
+
+void OptionsDialog::on_pbAddressAreaColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbAddressAreaColor->palette().color(QPalette::Background), this);
+ if (color.isValid())
+ setColor(ui->lbAddressAreaColor, color);
+}
+
+void OptionsDialog::on_pbAddressFontColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbAddressFontColor->palette().color(QPalette::WindowText), this);
+ if (color.isValid())
+ setColor(ui->lbAddressFontColor, color);
+}
+
+void OptionsDialog::on_pbAsciiAreaColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbAsciiAreaColor->palette().color(QPalette::Background), this);
+ if (color.isValid())
+ setColor(ui->lbAsciiAreaColor, color);
+}
+
+void OptionsDialog::on_pbAsciiFontColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbAsciiFontColor->palette().color(QPalette::WindowText), this);
+ if (color.isValid())
+ setColor(ui->lbAsciiFontColor, color);
+}
+
+void OptionsDialog::on_pbHexFontColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbHexFontColor->palette().color(QPalette::WindowText), this);
+ if (color.isValid())
+ setColor(ui->lbHexFontColor, color);
+}
+
+void OptionsDialog::on_pbSelectionColor_clicked()
+{
+ QColor color = QColorDialog::getColor(ui->lbSelectionColor->palette().color(QPalette::Background), this);
+ if (color.isValid())
+ setColor(ui->lbSelectionColor, color);
+}
+
+void OptionsDialog::on_pbWidgetFont_clicked()
+{
+ bool ok;
+ QFont font = QFontDialog::getFont(&ok, ui->leWidgetFont->font(), this);
+ if (ok)
+ ui->leWidgetFont->setFont(font);
+}
diff --git a/example/optionsdialog.h b/example/optionsdialog.h
new file mode 100644
index 0000000..6075917
--- /dev/null
+++ b/example/optionsdialog.h
@@ -0,0 +1,40 @@
+#ifndef OPTIONSDIALOG_H
+#define OPTIONSDIALOG_H
+
+#include <QtCore>
+#include <QDialog>
+
+namespace Ui {
+ class OptionsDialog;
+}
+
+class OptionsDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit OptionsDialog(QWidget *parent = 0);
+ ~OptionsDialog();
+ Ui::OptionsDialog *ui;
+ void show();
+
+public slots:
+ virtual void accept();
+
+private slots:
+ void on_pbHighlightingColor_clicked();
+ void on_pbAddressAreaColor_clicked();
+ void on_pbAddressFontColor_clicked();
+ void on_pbAsciiAreaColor_clicked();
+ void on_pbAsciiFontColor_clicked();
+ void on_pbHexFontColor_clicked();
+ void on_pbSelectionColor_clicked();
+ void on_pbWidgetFont_clicked();
+
+private:
+ void readSettings();
+ void writeSettings();
+ void setColor(QWidget *widget, QColor color);
+};
+
+#endif // OPTIONSDIALOG_H
diff --git a/example/optionsdialog.ui b/example/optionsdialog.ui
new file mode 100644
index 0000000..dcf542e
--- /dev/null
+++ b/example/optionsdialog.ui
@@ -0,0 +1,449 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OptionsDialog</class>
+ <widget class="QDialog" name="OptionsDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>374</width>
+ <height>754</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>QHexEdit - Options</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="gbFlags">
+ <property name="title">
+ <string>Flags</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="cbAddressArea">
+ <property name="text">
+ <string>Address Area</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="cbOverwriteMode">
+ <property name="text">
+ <string>Overwrite Mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="cbHighlighting">
+ <property name="text">
+ <string>Higlighting</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="cbAsciiArea">
+ <property name="text">
+ <string>Ascii Area</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="cbReadOnly">
+ <property name="text">
+ <string>ReadOnly</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbColors">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Colors and Fonts</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pbHighlightingColor">
+ <property name="text">
+ <string>Highlighting Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="lbHighlightingColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="pbSelectionColor">
+ <property name="text">
+ <string>Selection Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="lbSelectionColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QPushButton" name="pbAddressAreaColor">
+ <property name="text">
+ <string>Address Area Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="lbAddressAreaColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QPushButton" name="pbAddressFontColor">
+ <property name="text">
+ <string>Address Font Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="lbAddressFontColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QPushButton" name="pbAsciiAreaColor">
+ <property name="text">
+ <string>ASCII Area Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="lbAsciiAreaColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QPushButton" name="pbAsciiFontColor">
+ <property name="text">
+ <string>ASCII Font Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="lbAsciiFontColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QPushButton" name="pbHexFontColor">
+ <property name="text">
+ <string>Hex Font Color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="lbHexFontColor">
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QPushButton" name="pbWidgetFont">
+ <property name="text">
+ <string>Widget Font</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLineEdit" name="leWidgetFont">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>Courier New</family>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>01 23 45 67 89 ab cd ef</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbAddressAreaWidth">
+ <property name="title">
+ <string>Address Area</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lbAddressAreaWidth">
+ <property name="text">
+ <string>Address Area Width</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="sbAddressAreaWidth">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>6</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbHexArea">
+ <property name="title">
+ <string>Hex Area</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lbBytesPerLine">
+ <property name="text">
+ <string>Bytes per Line</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="sbBytesPerLine">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>32</number>
+ </property>
+ <property name="value">
+ <number>16</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>pbHighlightingColor</tabstop>
+ <tabstop>pbAddressAreaColor</tabstop>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>OptionsDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>222</x>
+ <y>154</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>168</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>OptionsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>290</x>
+ <y>160</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>168</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/example/qhexedit.pro b/example/qhexedit.pro
new file mode 100644
index 0000000..893cdb2
--- /dev/null
+++ b/example/qhexedit.pro
@@ -0,0 +1,45 @@
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+HEADERS = \
+ mainwindow.h \
+ optionsdialog.h \
+ ../src/qhexedit.h \
+ ../src/chunks.h \
+ ../src/commands.h \
+ searchdialog.h
+
+
+SOURCES = \
+ main.cpp \
+ mainwindow.cpp \
+ optionsdialog.cpp \
+ ../src/qhexedit.cpp \
+ ../src/chunks.cpp \
+ ../src/commands.cpp \
+ searchdialog.cpp
+
+RESOURCES = \
+ qhexedit.qrc
+
+FORMS += \
+ optionsdialog.ui \
+ searchdialog.ui
+
+OTHER_FILES += \
+ ../build-example.bat \
+ ../build-python-bindings.bat \
+ ../build-example.sh \
+ ../build-python-bindings.sh \
+ ../deploy.nsi \
+ ../doc/release.txt \
+ ../doc/howtorelease.txt \
+ ../appveyor.yml \
+ ../readme.md \
+ ../setup.py \
+ ../src/qhexedit.sip
+
+TRANSLATIONS += \
+ translations/qhexedit_cs.ts \
+ translations/qhexedit_de.ts
+
+DEFINES += QHEXEDIT_EXPORTS
diff --git a/example/qhexedit.qrc b/example/qhexedit.qrc
new file mode 100644
index 0000000..428c536
--- /dev/null
+++ b/example/qhexedit.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/open.png</file>
+ <file>images/save.png</file>
+ <file>images/undo.png</file>
+ <file>images/redo.png</file>
+ <file>images/find.png</file>
+ <file>images/qhexedit.ico</file>
+ </qresource>
+</RCC>
diff --git a/example/searchdialog.cpp b/example/searchdialog.cpp
new file mode 100644
index 0000000..7b9d9e7
--- /dev/null
+++ b/example/searchdialog.cpp
@@ -0,0 +1,115 @@
+#include "searchdialog.h"
+#include "ui_searchdialog.h"
+
+#include <QMessageBox>
+
+SearchDialog::SearchDialog(QHexEdit *hexEdit, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::SearchDialog)
+{
+ ui->setupUi(this);
+ _hexEdit = hexEdit;
+}
+
+SearchDialog::~SearchDialog()
+{
+ delete ui;
+}
+
+qint64 SearchDialog::findNext()
+{
+ qint64 from = _hexEdit->cursorPosition() / 2;
+ _findBa = getContent(ui->cbFindFormat->currentIndex(), ui->cbFind->currentText());
+ qint64 idx = -1;
+
+ if (_findBa.length() > 0)
+ {
+ if (ui->cbBackwards->isChecked())
+ idx = _hexEdit->lastIndexOf(_findBa, from);
+ else
+ idx = _hexEdit->indexOf(_findBa, from);
+ }
+ return idx;
+}
+
+void SearchDialog::on_pbFind_clicked()
+{
+ findNext();
+}
+
+void SearchDialog::on_pbReplace_clicked()
+{
+ int idx = findNext();
+ if (idx >= 0)
+ {
+ QByteArray replaceBa = getContent(ui->cbReplaceFormat->currentIndex(), ui->cbReplace->currentText());
+ replaceOccurrence(idx, replaceBa);
+ }
+}
+
+void SearchDialog::on_pbReplaceAll_clicked()
+{
+ int replaceCounter = 0;
+ int idx = 0;
+ int goOn = QMessageBox::Yes;
+
+ while ((idx >= 0) && (goOn == QMessageBox::Yes))
+ {
+ idx = findNext();
+ if (idx >= 0)
+ {
+ QByteArray replaceBa = getContent(ui->cbReplaceFormat->currentIndex(), ui->cbReplace->currentText());
+ int result = replaceOccurrence(idx, replaceBa);
+
+ if (result == QMessageBox::Yes)
+ replaceCounter += 1;
+
+ if (result == QMessageBox::Cancel)
+ goOn = result;
+ }
+ }
+
+ if (replaceCounter > 0)
+ QMessageBox::information(this, tr("QHexEdit"), QString(tr("%1 occurrences replaced.")).arg(replaceCounter));
+}
+
+
+QByteArray SearchDialog::getContent(int comboIndex, const QString &input)
+{
+ QByteArray findBa;
+ switch (comboIndex)
+ {
+ case 0: // hex
+ findBa = QByteArray::fromHex(input.toLatin1());
+ break;
+ case 1: // text
+ findBa = input.toUtf8();
+ break;
+ }
+ return findBa;
+}
+
+qint64 SearchDialog::replaceOccurrence(qint64 idx, const QByteArray &replaceBa)
+{
+ int result = QMessageBox::Yes;
+ if (replaceBa.length() >= 0)
+ {
+ if (ui->cbPrompt->isChecked())
+ {
+ result = QMessageBox::question(this, tr("QHexEdit"),
+ tr("Replace occurrence?"),
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+
+ if (result == QMessageBox::Yes)
+ {
+ _hexEdit->replace(idx, replaceBa.length(), replaceBa);
+ _hexEdit->update();
+ }
+ }
+ else
+ {
+ _hexEdit->replace(idx, _findBa.length(), replaceBa);
+ }
+ }
+ return result;
+}
diff --git a/example/searchdialog.h b/example/searchdialog.h
new file mode 100644
index 0000000..74ab867
--- /dev/null
+++ b/example/searchdialog.h
@@ -0,0 +1,34 @@
+#ifndef SEARCHDIALOG_H
+#define SEARCHDIALOG_H
+
+#include <QDialog>
+#include <QtCore>
+#include "../src/qhexedit.h"
+
+namespace Ui {
+ class SearchDialog;
+}
+
+class SearchDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit SearchDialog(QHexEdit *hexEdit, QWidget *parent = 0);
+ ~SearchDialog();
+ qint64 findNext();
+ Ui::SearchDialog *ui;
+
+private slots:
+ void on_pbFind_clicked();
+ void on_pbReplace_clicked();
+ void on_pbReplaceAll_clicked();
+
+private:
+ QByteArray getContent(int comboIndex, const QString &input);
+ qint64 replaceOccurrence(qint64 idx, const QByteArray &replaceBa);
+
+ QHexEdit *_hexEdit;
+ QByteArray _findBa;
+};
+
+#endif // SEARCHDIALOG_H
diff --git a/example/searchdialog.ui b/example/searchdialog.ui
new file mode 100644
index 0000000..d98560f
--- /dev/null
+++ b/example/searchdialog.ui
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SearchDialog</class>
+ <widget class="QDialog" name="SearchDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>436</width>
+ <height>223</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>QHexEdit - Find/Replace</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="gbFind">
+ <property name="title">
+ <string>Find</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QComboBox" name="cbFindFormat">
+ <item>
+ <property name="text">
+ <string>Hex</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>UTF-8</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cbFind">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbReplace">
+ <property name="title">
+ <string>Replace</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="cbReplaceFormat">
+ <item>
+ <property name="text">
+ <string>Hex</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>UTF-8</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cbReplace">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbOptions">
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="cbBackwards">
+ <property name="text">
+ <string>&amp;Backwards</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbPrompt">
+ <property name="text">
+ <string>&amp;Prompt on replace</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="pbFind">
+ <property name="text">
+ <string>&amp;Find</string>
+ </property>
+ <property name="shortcut">
+ <string>F3</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pbReplace">
+ <property name="text">
+ <string>&amp;Replace</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pbReplaceAll">
+ <property name="text">
+ <string>Replace &amp;All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pbCancel">
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>cbFind</tabstop>
+ <tabstop>cbReplace</tabstop>
+ <tabstop>cbFindFormat</tabstop>
+ <tabstop>cbReplaceFormat</tabstop>
+ <tabstop>cbBackwards</tabstop>
+ <tabstop>cbPrompt</tabstop>
+ <tabstop>pbFind</tabstop>
+ <tabstop>pbReplace</tabstop>
+ <tabstop>pbReplaceAll</tabstop>
+ <tabstop>pbCancel</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SearchDialog</receiver>
+ <slot>hide()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>360</x>
+ <y>134</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>364</x>
+ <y>162</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/example/translations/qhexedit_cs.qm b/example/translations/qhexedit_cs.qm
new file mode 100644
index 0000000..26a3d4f
--- /dev/null
+++ b/example/translations/qhexedit_cs.qm
Binary files differ
diff --git a/example/translations/qhexedit_cs.ts b/example/translations/qhexedit_cs.ts
new file mode 100644
index 0000000..43f4b38
--- /dev/null
+++ b/example/translations/qhexedit_cs.ts
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="cs_CZ">
+<context>
+ <name>MainWindow</name>
+ <message>
+ <source>About HexEdit</source>
+ <translation type="obsolete">O HexEdit</translation>
+ </message>
+ <message>
+ <source>The HexEdit example is a short Demo of the QHexEdit Widget.</source>
+ <translation type="obsolete">Příklad HexEdit je krátká ukázka doplňku QHexEdit.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="100"/>
+ <source>Save As</source>
+ <translation>Uložit jako</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="110"/>
+ <location filename="../mainwindow.cpp" line="132"/>
+ <source>Save To Readable File</source>
+ <translation>Uložit do čitelného souboru</translation>
+ </message>
+ <message>
+ <source>HexEdit</source>
+ <translation type="obsolete">HexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="61"/>
+ <source>About QHexEdit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="62"/>
+ <source>The QHexEdit example is a short Demo of the QHexEdit Widget.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="115"/>
+ <location filename="../mainwindow.cpp" line="137"/>
+ <location filename="../mainwindow.cpp" line="347"/>
+ <location filename="../mainwindow.cpp" line="399"/>
+ <source>QHexEdit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="116"/>
+ <location filename="../mainwindow.cpp" line="138"/>
+ <source>Cannot write file %1:
+%2.</source>
+ <translation>Nelze zapsat soubor %1:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="126"/>
+ <location filename="../mainwindow.cpp" line="148"/>
+ <location filename="../mainwindow.cpp" line="406"/>
+ <source>File saved</source>
+ <translation>Soubor uložen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="162"/>
+ <source>Overwrite</source>
+ <translation>Přepsat</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="164"/>
+ <source>Insert</source>
+ <translation>Vložit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="210"/>
+ <source>&amp;Open...</source>
+ <translation>&amp;Otevřít...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="212"/>
+ <source>Open an existing file</source>
+ <translation>Otevřít stávající soubor</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="215"/>
+ <source>&amp;Save</source>
+ <translation>&amp;Uložit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="217"/>
+ <source>Save the document to disk</source>
+ <translation>Uložit dokument na disk</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="220"/>
+ <source>Save &amp;As...</source>
+ <translation>Uložit &amp;jako...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="222"/>
+ <source>Save the document under a new name</source>
+ <translation>Uložit dokument pod novým názvem</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="225"/>
+ <source>Save &amp;Readable...</source>
+ <translation>Uložit Č&amp;itelné...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="226"/>
+ <source>Save document in readable form</source>
+ <translation>Uložit dokument v čitelné podobě</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="229"/>
+ <source>E&amp;xit</source>
+ <translation>&amp;Ukončit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="231"/>
+ <source>Exit the application</source>
+ <translation>Ukončit program</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="234"/>
+ <source>&amp;Undo</source>
+ <translation>&amp;Zpět</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="238"/>
+ <source>&amp;Redo</source>
+ <translation>&amp;Znovu</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="242"/>
+ <source>&amp;Save Selection Readable...</source>
+ <translation>&amp;Uložit výběr čitelný...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="243"/>
+ <source>Save selection in readable form</source>
+ <translation>Uložit výběr v čitelné podobě</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="246"/>
+ <source>&amp;About</source>
+ <translation>&amp;O programu</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="247"/>
+ <source>Show the application&apos;s About box</source>
+ <translation>Ukázat informace o programu</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="250"/>
+ <source>About &amp;Qt</source>
+ <translation>O &amp;Qt</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="251"/>
+ <source>Show the Qt library&apos;s About box</source>
+ <translation>Ukázat informace oknihovně Qt</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="261"/>
+ <source>Find next occurrence of the searched pattern</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="264"/>
+ <source>&amp;Options</source>
+ <translation>&amp;Volby</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="265"/>
+ <source>Show the Dialog to select applications options</source>
+ <translation>Ukázat dialog pro výběr voleb programu</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="337"/>
+ <source>Edit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="400"/>
+ <source>Cannot write file %1.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="254"/>
+ <source>&amp;Find/Replace</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="41"/>
+ <source>Drop File: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="256"/>
+ <source>Show the Dialog for finding and replacing</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="259"/>
+ <source>Find &amp;next</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="271"/>
+ <source>&amp;File</source>
+ <translation>&amp;Soubor</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="279"/>
+ <source>&amp;Edit</source>
+ <translation>Ú&amp;pravy</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="289"/>
+ <source>&amp;Help</source>
+ <translation>&amp;Nápověda</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="298"/>
+ <source>Address:</source>
+ <translation>Adresa:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="309"/>
+ <source>Size:</source>
+ <translation>Velikost:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="320"/>
+ <source>Mode:</source>
+ <translation>Režim:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="329"/>
+ <source>Ready</source>
+ <translation>Připraven</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="334"/>
+ <source>File</source>
+ <translation>Soubor</translation>
+ </message>
+ <message>
+ <source>SDI</source>
+ <translation type="vanished">SDI</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="348"/>
+ <source>Cannot read file %1:
+%2.</source>
+ <translation>Nelze číst soubor %1:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="354"/>
+ <source>File loaded</source>
+ <translation>Soubor nahrán</translation>
+ </message>
+</context>
+<context>
+ <name>OptionsDialog</name>
+ <message>
+ <source>Dialog</source>
+ <translation type="obsolete">Dialog</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="14"/>
+ <source>QHexEdit - Options</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="20"/>
+ <source>Flags</source>
+ <translation>Příznaky</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="26"/>
+ <source>ReadOnly</source>
+ <translation>PouzeProČtení</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="33"/>
+ <source>Higlighting</source>
+ <translation>Zvýraznění</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="40"/>
+ <source>Overwrite Mode</source>
+ <translation>Režim přepisu</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="47"/>
+ <location filename="../optionsdialog.ui" line="195"/>
+ <source>Address Area</source>
+ <translation>Oblast s adresou</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="54"/>
+ <source>Ascii Area</source>
+ <translation>Oblast ASCII</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="64"/>
+ <source>Colors and Fonts</source>
+ <translation>Barvy a písma</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="70"/>
+ <source>Highlighting Color</source>
+ <translation>Barva pro zvýraznění</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="102"/>
+ <source>Address Area Color</source>
+ <translation>Barva pro oblast s adresou</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="159"/>
+ <source>Selection Color</source>
+ <translation>Barva výběru</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="166"/>
+ <source>Widget Font</source>
+ <translation>Písmo doplňku</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="185"/>
+ <source>01 23 45 67 89 ab cd ef</source>
+ <translation>01 23 45 67 89 ab cd ef</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="201"/>
+ <source>Address Area Width</source>
+ <translation>Šířka oblasti s adresou</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="224"/>
+ <source>Hex Area</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="230"/>
+ <source>Bytes per Line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SearchDialog</name>
+ <message>
+ <source>Dialog</source>
+ <translation type="obsolete">Dialog</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="14"/>
+ <source>QHexEdit - Find/Replace</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="22"/>
+ <source>Find</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="29"/>
+ <location filename="../searchdialog.ui" line="65"/>
+ <source>Hex</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="34"/>
+ <location filename="../searchdialog.ui" line="70"/>
+ <source>UTF-8</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="58"/>
+ <source>Replace</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="94"/>
+ <source>Options</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="100"/>
+ <source>&amp;Backwards</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="107"/>
+ <source>&amp;Prompt on replace</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="121"/>
+ <source>&amp;Find</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="124"/>
+ <source>F3</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="134"/>
+ <source>&amp;Replace</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="141"/>
+ <source>Replace &amp;All</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="148"/>
+ <source>&amp;Close</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <location filename="../searchdialog.cpp" line="99"/>
+ <source>QHexEdit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <source>%1 occurrences replaced.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="100"/>
+ <source>Replace occurrence?</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>UndoStack</name>
+ <message>
+ <location filename="../../src/commands.cpp" line="112"/>
+ <source>Inserting %1 bytes</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="134"/>
+ <source>Delete %1 chars</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="159"/>
+ <source>Overwrite %1 chars</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/example/translations/qhexedit_de.qm b/example/translations/qhexedit_de.qm
new file mode 100644
index 0000000..3346266
--- /dev/null
+++ b/example/translations/qhexedit_de.qm
Binary files differ
diff --git a/example/translations/qhexedit_de.ts b/example/translations/qhexedit_de.ts
new file mode 100644
index 0000000..3c9cbef
--- /dev/null
+++ b/example/translations/qhexedit_de.ts
@@ -0,0 +1,468 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de_DE">
+<context>
+ <name>MainWindow</name>
+ <message>
+ <source>About HexEdit</source>
+ <translation type="obsolete">Über HexEdit</translation>
+ </message>
+ <message>
+ <source>The HexEdit example is a short Demo of the QHexEdit Widget.</source>
+ <translation type="obsolete">Das HexEdit Beispiel ist eine einfache Demo Anwendung für das QHexEdit Widget.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="100"/>
+ <source>Save As</source>
+ <translation>Speichern unter</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="110"/>
+ <location filename="../mainwindow.cpp" line="132"/>
+ <source>Save To Readable File</source>
+ <translation>Als lesbare Datei speichern</translation>
+ </message>
+ <message>
+ <source>HexEdit</source>
+ <translation type="obsolete">HexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="61"/>
+ <source>About QHexEdit</source>
+ <translation>Über QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="62"/>
+ <source>The QHexEdit example is a short Demo of the QHexEdit Widget.</source>
+ <translation>Das QHexEdit Beispiel ist eine einfache Demo Anwendung für das QHexEdit Widget.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="115"/>
+ <location filename="../mainwindow.cpp" line="137"/>
+ <location filename="../mainwindow.cpp" line="347"/>
+ <location filename="../mainwindow.cpp" line="399"/>
+ <source>QHexEdit</source>
+ <translation>QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="116"/>
+ <location filename="../mainwindow.cpp" line="138"/>
+ <source>Cannot write file %1:
+%2.</source>
+ <translation>Kann Detei %1 nicht schreiben:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="126"/>
+ <location filename="../mainwindow.cpp" line="148"/>
+ <location filename="../mainwindow.cpp" line="406"/>
+ <source>File saved</source>
+ <translation>Datei gespeichert</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="162"/>
+ <source>Overwrite</source>
+ <translation>Überschreiben</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="164"/>
+ <source>Insert</source>
+ <translation>Einfügen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="210"/>
+ <source>&amp;Open...</source>
+ <translation>Öf&amp;fnen...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="212"/>
+ <source>Open an existing file</source>
+ <translation>Existierende Datei öffnen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="215"/>
+ <source>&amp;Save</source>
+ <translation>&amp;Speichern</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="217"/>
+ <source>Save the document to disk</source>
+ <translation>Dokument auf Platte speichern</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="220"/>
+ <source>Save &amp;As...</source>
+ <translation>Speichern &amp;unter...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="222"/>
+ <source>Save the document under a new name</source>
+ <translation>Dokument unter neuem Namen speichern</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="225"/>
+ <source>Save &amp;Readable...</source>
+ <translation>Als &amp;lesbare Datei speichern...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="226"/>
+ <source>Save document in readable form</source>
+ <translation>Das Dokument in lesbarer From speichern</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="229"/>
+ <source>E&amp;xit</source>
+ <translation>&amp;Beenden</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="231"/>
+ <source>Exit the application</source>
+ <translation>Applikation beenden</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="234"/>
+ <source>&amp;Undo</source>
+ <translation>&amp;Wiederherstellen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="238"/>
+ <source>&amp;Redo</source>
+ <translation>&amp;Rückgängig</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="242"/>
+ <source>&amp;Save Selection Readable...</source>
+ <translation>&amp;Auswahl in lesbarer Form speichern...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="243"/>
+ <source>Save selection in readable form</source>
+ <translation>Speichere die Auswahl in lesbarer Form</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="246"/>
+ <source>&amp;About</source>
+ <translation>Ü&amp;ber</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="247"/>
+ <source>Show the application&apos;s About box</source>
+ <translation>Zeige Informationen zur Anwendungj</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="250"/>
+ <source>About &amp;Qt</source>
+ <translation>Über &amp;Qt</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="251"/>
+ <source>Show the Qt library&apos;s About box</source>
+ <translation>Zeige Informationen über Qt</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="261"/>
+ <source>Find next occurrence of the searched pattern</source>
+ <translation>Zeige die nächste Fundstelle mit dem gleichen Suchmuster</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="264"/>
+ <source>&amp;Options</source>
+ <translation>&amp;Optionen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="265"/>
+ <source>Show the Dialog to select applications options</source>
+ <translation>Zeige den Dialog, um Optionen der Anwendunge einzustellen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="337"/>
+ <source>Edit</source>
+ <translation type="unfinished">Bearbeiten</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="400"/>
+ <source>Cannot write file %1.</source>
+ <translation type="unfinished">Kann Datei %1 nicht schreiben.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="254"/>
+ <source>&amp;Find/Replace</source>
+ <translation>&amp;Suchen/Ersetzen</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="41"/>
+ <source>Drop File: </source>
+ <translation type="unfinished">Datei erhalten:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="256"/>
+ <source>Show the Dialog for finding and replacing</source>
+ <translation>Zeige den Suchen/Ersetzen Dialog</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="259"/>
+ <source>Find &amp;next</source>
+ <translation>&amp;Weitersuchen</translation>
+ </message>
+ <message>
+ <source>Find next occurance of the sarched pattern</source>
+ <translation type="obsolete">Zeige die nächste Fundstelle mit dem gleichen Suchmuster</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="271"/>
+ <source>&amp;File</source>
+ <translation>&amp;Datei</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="279"/>
+ <source>&amp;Edit</source>
+ <translation>&amp;Beearbeiten</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="289"/>
+ <source>&amp;Help</source>
+ <translation>&amp;Hilfe</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="298"/>
+ <source>Address:</source>
+ <translation>Adresse:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="309"/>
+ <source>Size:</source>
+ <translation>Größe:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="320"/>
+ <source>Mode:</source>
+ <translation>Mode:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="329"/>
+ <source>Ready</source>
+ <translation>Fertig</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="334"/>
+ <source>File</source>
+ <translation>Datei</translation>
+ </message>
+ <message>
+ <source>SDI</source>
+ <translation type="vanished">SDI</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="348"/>
+ <source>Cannot read file %1:
+%2.</source>
+ <translation>Kann Datei %1 nicht lesen:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="354"/>
+ <source>File loaded</source>
+ <translation>Datei geladen</translation>
+ </message>
+</context>
+<context>
+ <name>OptionsDialog</name>
+ <message>
+ <source>Dialog</source>
+ <translation type="obsolete">Optionen</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="14"/>
+ <source>QHexEdit - Options</source>
+ <translation>QHexEdit - Optionen</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="20"/>
+ <source>Flags</source>
+ <translation>Eigenschaften</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="26"/>
+ <source>ReadOnly</source>
+ <translation>Nur lesen</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="33"/>
+ <source>Higlighting</source>
+ <translation>Hervorheben</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="40"/>
+ <source>Overwrite Mode</source>
+ <translation>Überschreibe Modus</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="47"/>
+ <location filename="../optionsdialog.ui" line="195"/>
+ <source>Address Area</source>
+ <translation>Adressfeld</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="54"/>
+ <source>Ascii Area</source>
+ <translation>Ascii-Feld</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="64"/>
+ <source>Colors and Fonts</source>
+ <translation>Farben und Schriftarten</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="70"/>
+ <source>Highlighting Color</source>
+ <translation>Farbe Hervorhebung</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="102"/>
+ <source>Address Area Color</source>
+ <translation>Farbe Adressfeld</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="159"/>
+ <source>Selection Color</source>
+ <translation>Farbe Markierung</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="166"/>
+ <source>Widget Font</source>
+ <translation>Font-Auswahl</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="185"/>
+ <source>01 23 45 67 89 ab cd ef</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="201"/>
+ <source>Address Area Width</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="224"/>
+ <source>Hex Area</source>
+ <translation type="unfinished">Hexadezimalfeld</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="230"/>
+ <source>Bytes per Line</source>
+ <translation type="unfinished">Bytes pro Zeile</translation>
+ </message>
+</context>
+<context>
+ <name>SearchDialog</name>
+ <message>
+ <source>Dialog</source>
+ <translation type="obsolete">Optionen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="14"/>
+ <source>QHexEdit - Find/Replace</source>
+ <translation>QHexEdit - Suchen/Ersetzen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="22"/>
+ <source>Find</source>
+ <translation>Suchen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="29"/>
+ <location filename="../searchdialog.ui" line="65"/>
+ <source>Hex</source>
+ <translation>Hex</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="34"/>
+ <location filename="../searchdialog.ui" line="70"/>
+ <source>UTF-8</source>
+ <translation>UTF-8</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="58"/>
+ <source>Replace</source>
+ <translation>Ersetzen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="94"/>
+ <source>Options</source>
+ <translation>Optionen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="100"/>
+ <source>&amp;Backwards</source>
+ <translation>&amp;Rückwärts</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="107"/>
+ <source>&amp;Prompt on replace</source>
+ <translation>Vor dem Ersetzen &amp;nachfragen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="121"/>
+ <source>&amp;Find</source>
+ <translation>&amp;Suchen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="124"/>
+ <source>F3</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="134"/>
+ <source>&amp;Replace</source>
+ <translation>&amp;Ersetzen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="141"/>
+ <source>Replace &amp;All</source>
+ <translation>&amp;Alle ersetzen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="148"/>
+ <source>&amp;Close</source>
+ <translation>&amp;Schließen</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <location filename="../searchdialog.cpp" line="99"/>
+ <source>QHexEdit</source>
+ <translation>QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <source>%1 occurrences replaced.</source>
+ <translation>%1 Vorkommnisse ersetzt.</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="100"/>
+ <source>Replace occurrence?</source>
+ <translation>Vorkommnis ersetzen?</translation>
+ </message>
+ <message>
+ <source>Replace occurrance?</source>
+ <translation type="obsolete">Vorkommnis ersetzen?</translation>
+ </message>
+</context>
+<context>
+ <name>UndoStack</name>
+ <message>
+ <location filename="../../src/commands.cpp" line="112"/>
+ <source>Inserting %1 bytes</source>
+ <translation type="unfinished">%1 Bytes eingefügt</translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="134"/>
+ <source>Delete %1 chars</source>
+ <translation type="unfinished">%1 Zeiche(n) gelöscht</translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="159"/>
+ <source>Overwrite %1 chars</source>
+ <translation type="unfinished">%1 Zeichen überschrieben</translation>
+ </message>
+</context>
+</TS>
diff --git a/example/translations/qhexedit_ru.qm b/example/translations/qhexedit_ru.qm
new file mode 100644
index 0000000..936e9df
--- /dev/null
+++ b/example/translations/qhexedit_ru.qm
Binary files differ
diff --git a/example/translations/qhexedit_ru.ts b/example/translations/qhexedit_ru.ts
new file mode 100644
index 0000000..0beb03e
--- /dev/null
+++ b/example/translations/qhexedit_ru.ts
@@ -0,0 +1,432 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="ru_RU">
+<context>
+ <name>MainWindow</name>
+ <message>
+ <location filename="../mainwindow.cpp" line="58"/>
+ <source>About QHexEdit</source>
+ <translation>Про QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="59"/>
+ <source>The QHexEdit example is a short Demo of the QHexEdit Widget.</source>
+ <translation>QHexEdit пример это короткая демонстрация работы QHexEdit компоненты.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="97"/>
+ <source>Save As</source>
+ <translation>Сохранить как</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="107"/>
+ <location filename="../mainwindow.cpp" line="129"/>
+ <source>Save To Readable File</source>
+ <translatorcomment>i hope it is text file with hex dump</translatorcomment>
+ <translation>Сохранить как читаемый файл</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="112"/>
+ <location filename="../mainwindow.cpp" line="134"/>
+ <location filename="../mainwindow.cpp" line="344"/>
+ <location filename="../mainwindow.cpp" line="396"/>
+ <source>QHexEdit</source>
+ <translation>QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="113"/>
+ <location filename="../mainwindow.cpp" line="135"/>
+ <source>Cannot write file %1:
+%2.</source>
+ <translation>Не могу записать файл %1:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="123"/>
+ <location filename="../mainwindow.cpp" line="145"/>
+ <location filename="../mainwindow.cpp" line="403"/>
+ <source>File saved</source>
+ <translation>Файл сохранен</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="159"/>
+ <source>Overwrite</source>
+ <translation>Замена</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="161"/>
+ <source>Insert</source>
+ <translation>Вставка</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="207"/>
+ <source>&amp;Open...</source>
+ <translation>&amp;Открыть...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="209"/>
+ <source>Open an existing file</source>
+ <translation>Открыть существующий файл</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="212"/>
+ <source>&amp;Save</source>
+ <translation>&amp;Сохранить</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="214"/>
+ <source>Save the document to disk</source>
+ <translation>Сохранить документ на диск</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="217"/>
+ <source>Save &amp;As...</source>
+ <translation>Сохранить &amp;как...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="219"/>
+ <source>Save the document under a new name</source>
+ <translation>Сохранить документ под новым именем</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="222"/>
+ <source>Save &amp;Readable...</source>
+ <translation>Сохранить как &amp;читаемый...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="223"/>
+ <source>Save document in readable form</source>
+ <translation>Сохранить документ в читабельной форме</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="226"/>
+ <source>E&amp;xit</source>
+ <translation>В&amp;ыход</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="228"/>
+ <source>Exit the application</source>
+ <translation>Выход из приложения</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="231"/>
+ <source>&amp;Undo</source>
+ <translation>&amp;Отмена</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="235"/>
+ <source>&amp;Redo</source>
+ <translation>&amp;Повторение</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="239"/>
+ <source>&amp;Save Selection Readable...</source>
+ <translation>&amp;Сохранить выделеное читабельно...</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="240"/>
+ <source>Save selection in readable form</source>
+ <translation>Сохранить выделеное в читабельной форме</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="243"/>
+ <source>&amp;About</source>
+ <translation>&amp;О программе</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="244"/>
+ <source>Show the application&apos;s About box</source>
+ <translation>Показать сообщение рассказывающее о программе</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="247"/>
+ <source>About &amp;Qt</source>
+ <translation>Про &amp;QT</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="248"/>
+ <source>Show the Qt library&apos;s About box</source>
+ <translation>Показать сообщение о библиотеке QT</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="251"/>
+ <source>&amp;Find/Replace</source>
+ <translation>&amp;Поиск/Замена</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="253"/>
+ <source>Show the Dialog for finding and replacing</source>
+ <translation>Показать диалоговое окно для поиска и замены</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="256"/>
+ <source>Find &amp;next</source>
+ <translation>Найти &amp;следующий</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="258"/>
+ <source>Find next occurrence of the searched pattern</source>
+ <translation>Найти следующие вхождение поискового шаблона</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="261"/>
+ <source>&amp;Options</source>
+ <translation>&amp;Настройки</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="262"/>
+ <source>Show the Dialog to select applications options</source>
+ <translation>Показать диалоговое окно для установок приложения</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="268"/>
+ <source>&amp;File</source>
+ <translation>&amp;Файл</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="276"/>
+ <source>&amp;Edit</source>
+ <translation>&amp;Редактирование</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="286"/>
+ <source>&amp;Help</source>
+ <translation>&amp;Помощь</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="295"/>
+ <source>Address:</source>
+ <translation>Адрес:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="306"/>
+ <source>Size:</source>
+ <translation>Размер:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="317"/>
+ <source>Mode:</source>
+ <translation>Режим:</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="326"/>
+ <source>Ready</source>
+ <translation>Готово</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="331"/>
+ <source>File</source>
+ <translation>Файл</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="334"/>
+ <source>Edit</source>
+ <translation>Редактирование</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="345"/>
+ <source>Cannot read file %1:
+%2.</source>
+ <translation>Не могу прочитать файл %1:
+%2.</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="351"/>
+ <source>File loaded</source>
+ <translation>Файл загружен</translation>
+ </message>
+ <message>
+ <location filename="../mainwindow.cpp" line="397"/>
+ <source>Cannot write file %1.</source>
+ <translation>Не могу записать файл %1.</translation>
+ </message>
+</context>
+<context>
+ <name>OptionsDialog</name>
+ <message>
+ <location filename="../optionsdialog.ui" line="14"/>
+ <source>QHexEdit - Options</source>
+ <translation>QHexEdit - Настройки</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="20"/>
+ <source>Flags</source>
+ <translation>Флаги</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="26"/>
+ <source>ReadOnly</source>
+ <translation>Только чтение</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="33"/>
+ <source>Higlighting</source>
+ <translation>Подсвечивание</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="40"/>
+ <source>Overwrite Mode</source>
+ <translation>Режим замены</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="47"/>
+ <location filename="../optionsdialog.ui" line="195"/>
+ <source>Address Area</source>
+ <translation>Адресная область</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="54"/>
+ <source>Ascii Area</source>
+ <translation>Область ASCII</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="64"/>
+ <source>Colors and Fonts</source>
+ <translation>Цвета и Шрифты</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="70"/>
+ <source>Highlighting Color</source>
+ <translation>Цвет подсвечивания</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="102"/>
+ <source>Address Area Color</source>
+ <translation>Цвет адресной области</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="159"/>
+ <source>Selection Color</source>
+ <translation>Цвет для выбраной области</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="166"/>
+ <source>Widget Font</source>
+ <translation>Шрифт для компоненты</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="185"/>
+ <source>01 23 45 67 89 ab cd ef</source>
+ <translation>01 23 45 67 89 ab cd ef</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="201"/>
+ <source>Address Area Width</source>
+ <translation>Ширина адресной области</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="224"/>
+ <source>Hex Area</source>
+ <translation>Шестнадцатиричная область</translation>
+ </message>
+ <message>
+ <location filename="../optionsdialog.ui" line="230"/>
+ <source>Bytes per Line</source>
+ <translation>Байт в строке</translation>
+ </message>
+</context>
+<context>
+ <name>SearchDialog</name>
+ <message>
+ <location filename="../searchdialog.ui" line="14"/>
+ <source>QHexEdit - Find/Replace</source>
+ <translation>QHExEdit - Поиск/Замена</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="22"/>
+ <source>Find</source>
+ <translation>Найти</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="29"/>
+ <location filename="../searchdialog.ui" line="65"/>
+ <source>Hex</source>
+ <translation>Hex</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="34"/>
+ <location filename="../searchdialog.ui" line="70"/>
+ <source>UTF-8</source>
+ <translation>UTF-8</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="58"/>
+ <source>Replace</source>
+ <translation>Замена</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="94"/>
+ <source>Options</source>
+ <translation>Настройки</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="100"/>
+ <source>&amp;Backwards</source>
+ <translation>&amp;Обратный поиск</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="107"/>
+ <source>&amp;Prompt on replace</source>
+ <translation>&amp;Предупреждать перед заменой</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="121"/>
+ <source>&amp;Find</source>
+ <translation>&amp;Найти</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="124"/>
+ <source>F3</source>
+ <translation>F3</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="134"/>
+ <source>&amp;Replace</source>
+ <translation>За&amp;менить</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="141"/>
+ <source>Replace &amp;All</source>
+ <translation>Заменить &amp;всё</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.ui" line="148"/>
+ <source>&amp;Close</source>
+ <translation>&amp;Закрыть</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <location filename="../searchdialog.cpp" line="99"/>
+ <source>QHexEdit</source>
+ <translation>QHexEdit</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="73"/>
+ <source>%1 occurrences replaced.</source>
+ <translation>%1 найденых фрагментов заменено.</translation>
+ </message>
+ <message>
+ <location filename="../searchdialog.cpp" line="100"/>
+ <source>Replace occurrence?</source>
+ <translation>заменить найденое?</translation>
+ </message>
+</context>
+<context>
+ <name>UndoStack</name>
+ <message>
+ <location filename="../../src/commands.cpp" line="112"/>
+ <source>Inserting %1 bytes</source>
+ <translation>Вставить %1 байт</translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="134"/>
+ <source>Delete %1 chars</source>
+ <translation>Удалить %1 символов</translation>
+ </message>
+ <message>
+ <location filename="../../src/commands.cpp" line="159"/>
+ <source>Overwrite %1 chars</source>
+ <translation>Заменить %1 символов</translation>
+ </message>
+</context>
+</TS>