From 004b73ed7ef33cb407897f7eccbec5f3861f99d7 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Fri, 7 Jul 2023 12:37:21 +0200 Subject: Squashed 'qhexedit2/' content from commit 7f22526 git-subtree-dir: qhexedit2 git-subtree-split: 7f22526a86685aec1c5722154b8a7422d5037b77 --- example/images/find.png | Bin 0 -> 1944 bytes example/images/open.png | Bin 0 -> 2073 bytes example/images/qhexedit.ico | Bin 0 -> 22382 bytes example/images/qhexedit.svg | 157 ++++++++++++ example/images/qhexedit16.png | Bin 0 -> 760 bytes example/images/qhexedit32.png | Bin 0 -> 2020 bytes example/images/qhexedit64.png | Bin 0 -> 4830 bytes example/images/redo.png | Bin 0 -> 985 bytes example/images/save.png | Bin 0 -> 1187 bytes example/images/undo.png | Bin 0 -> 962 bytes example/main.cpp | 30 +++ example/mainwindow.cpp | 433 +++++++++++++++++++++++++++++++++ example/mainwindow.h | 98 ++++++++ example/optionsdialog.cpp | 147 +++++++++++ example/optionsdialog.h | 40 +++ example/optionsdialog.ui | 449 ++++++++++++++++++++++++++++++++++ example/qhexedit.pro | 45 ++++ example/qhexedit.qrc | 10 + example/searchdialog.cpp | 115 +++++++++ example/searchdialog.h | 34 +++ example/searchdialog.ui | 200 +++++++++++++++ example/translations/qhexedit_cs.qm | Bin 0 -> 4257 bytes example/translations/qhexedit_cs.ts | 460 +++++++++++++++++++++++++++++++++++ example/translations/qhexedit_de.qm | Bin 0 -> 7319 bytes example/translations/qhexedit_de.ts | 468 ++++++++++++++++++++++++++++++++++++ example/translations/qhexedit_ru.qm | Bin 0 -> 7256 bytes example/translations/qhexedit_ru.ts | 432 +++++++++++++++++++++++++++++++++ 27 files changed, 3118 insertions(+) create mode 100644 example/images/find.png create mode 100644 example/images/open.png create mode 100644 example/images/qhexedit.ico create mode 100644 example/images/qhexedit.svg create mode 100644 example/images/qhexedit16.png create mode 100644 example/images/qhexedit32.png create mode 100644 example/images/qhexedit64.png create mode 100644 example/images/redo.png create mode 100644 example/images/save.png create mode 100644 example/images/undo.png create mode 100644 example/main.cpp create mode 100644 example/mainwindow.cpp create mode 100644 example/mainwindow.h create mode 100644 example/optionsdialog.cpp create mode 100644 example/optionsdialog.h create mode 100644 example/optionsdialog.ui create mode 100644 example/qhexedit.pro create mode 100644 example/qhexedit.qrc create mode 100644 example/searchdialog.cpp create mode 100644 example/searchdialog.h create mode 100644 example/searchdialog.ui create mode 100644 example/translations/qhexedit_cs.qm create mode 100644 example/translations/qhexedit_cs.ts create mode 100644 example/translations/qhexedit_de.qm create mode 100644 example/translations/qhexedit_de.ts create mode 100644 example/translations/qhexedit_ru.qm create mode 100644 example/translations/qhexedit_ru.ts (limited to 'example') diff --git a/example/images/find.png b/example/images/find.png new file mode 100644 index 0000000..6ea35e9 Binary files /dev/null and b/example/images/find.png differ diff --git a/example/images/open.png b/example/images/open.png new file mode 100644 index 0000000..45fa288 Binary files /dev/null and b/example/images/open.png differ diff --git a/example/images/qhexedit.ico b/example/images/qhexedit.ico new file mode 100644 index 0000000..940808e Binary files /dev/null and b/example/images/qhexedit.ico 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 @@ + + + + + + + + + + + + + + + + 01000010 + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/example/images/qhexedit16.png b/example/images/qhexedit16.png new file mode 100644 index 0000000..8136b90 Binary files /dev/null and b/example/images/qhexedit16.png differ diff --git a/example/images/qhexedit32.png b/example/images/qhexedit32.png new file mode 100644 index 0000000..04466fc Binary files /dev/null and b/example/images/qhexedit32.png differ diff --git a/example/images/qhexedit64.png b/example/images/qhexedit64.png new file mode 100644 index 0000000..f75aa4d Binary files /dev/null and b/example/images/qhexedit64.png differ diff --git a/example/images/redo.png b/example/images/redo.png new file mode 100644 index 0000000..5591517 Binary files /dev/null and b/example/images/redo.png differ diff --git a/example/images/save.png b/example/images/save.png new file mode 100644 index 0000000..daba865 Binary files /dev/null and b/example/images/save.png differ diff --git a/example/images/undo.png b/example/images/undo.png new file mode 100644 index 0000000..8cf63a8 Binary files /dev/null and b/example/images/undo.png 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 +#include + +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 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()); + hexEdit->setAddressAreaColor(settings.value("AddressAreaColor").value()); + hexEdit->setSelectionColor(settings.value("SelectionColor").value()); + hexEdit->setFont(settings.value("WidgetFont").value()); + hexEdit->setAddressFontColor(settings.value("AddressFontColor").value()); + hexEdit->setAsciiAreaColor(settings.value("AsciiAreaColor").value()); + hexEdit->setAsciiFontColor(settings.value("AsciiFontColor").value()); + hexEdit->setHexFontColor(settings.value("HexFontColor").value()); + + 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 + +#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 +#include + +#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()); + setColor(ui->lbAddressAreaColor, settings.value("AddressAreaColor", this->palette().alternateBase().color()).value()); + setColor(ui->lbSelectionColor, settings.value("SelectionColor", this->palette().highlight().color()).value()); + setColor(ui->lbAddressFontColor, settings.value("AddressFontColor", QPalette::WindowText).value()); + setColor(ui->lbAsciiAreaColor, settings.value("AsciiAreaColor", this->palette().alternateBase().color()).value()); + setColor(ui->lbAsciiFontColor, settings.value("AsciiFontColor", QPalette::WindowText).value()); + setColor(ui->lbHexFontColor, settings.value("HexFontColor", QPalette::WindowText).value()); +#ifdef Q_OS_WIN32 + ui->leWidgetFont->setFont(settings.value("WidgetFont", QFont("Courier", 10)).value()); +#else + ui->leWidgetFont->setFont(settings.value("WidgetFont", QFont("Monospace", 10)).value()); +#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 +#include + +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 @@ + + + OptionsDialog + + + + 0 + 0 + 374 + 754 + + + + QHexEdit - Options + + + + + + Flags + + + + + + Address Area + + + + + + + Overwrite Mode + + + + + + + Higlighting + + + + + + + Ascii Area + + + + + + + ReadOnly + + + + + + + + + + + 0 + 0 + + + + Colors and Fonts + + + + + + Highlighting Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + Selection Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + Address Area Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + Address Font Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + ASCII Area Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + ASCII Font Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + Hex Font Color + + + + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + + + + Widget Font + + + + + + + + 0 + 0 + + + + + Courier New + 10 + + + + 01 23 45 67 89 ab cd ef + + + + + + + + + + Address Area + + + + + + Address Area Width + + + + + + + 1 + + + 6 + + + 4 + + + + + + + + + + Hex Area + + + + + + Bytes per Line + + + + + + + 1 + + + 32 + + + 16 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + pbHighlightingColor + pbAddressAreaColor + buttonBox + + + + + buttonBox + accepted() + OptionsDialog + accept() + + + 222 + 154 + + + 157 + 168 + + + + + buttonBox + rejected() + OptionsDialog + reject() + + + 290 + 160 + + + 286 + 168 + + + + + 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 @@ + + + images/open.png + images/save.png + images/undo.png + images/redo.png + images/find.png + images/qhexedit.ico + + 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 + +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 +#include +#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 @@ + + + SearchDialog + + + + 0 + 0 + 436 + 223 + + + + QHexEdit - Find/Replace + + + + + + + + Find + + + + + + + Hex + + + + + UTF-8 + + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + Replace + + + + + + + Hex + + + + + UTF-8 + + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + Options + + + + + + &Backwards + + + + + + + &Prompt on replace + + + + + + + + + + + + + + &Find + + + F3 + + + true + + + + + + + &Replace + + + + + + + Replace &All + + + + + + + &Close + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + cbFind + cbReplace + cbFindFormat + cbReplaceFormat + cbBackwards + cbPrompt + pbFind + pbReplace + pbReplaceAll + pbCancel + + + + + pbCancel + clicked() + SearchDialog + hide() + + + 360 + 134 + + + 364 + 162 + + + + + diff --git a/example/translations/qhexedit_cs.qm b/example/translations/qhexedit_cs.qm new file mode 100644 index 0000000..26a3d4f Binary files /dev/null and b/example/translations/qhexedit_cs.qm 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 @@ + + + + + MainWindow + + About HexEdit + O HexEdit + + + The HexEdit example is a short Demo of the QHexEdit Widget. + Příklad HexEdit je krátká ukázka doplňku QHexEdit. + + + + Save As + Uložit jako + + + + + Save To Readable File + Uložit do čitelného souboru + + + HexEdit + HexEdit + + + + About QHexEdit + + + + + The QHexEdit example is a short Demo of the QHexEdit Widget. + + + + + + + + QHexEdit + + + + + + Cannot write file %1: +%2. + Nelze zapsat soubor %1: +%2. + + + + + + File saved + Soubor uložen + + + + Overwrite + Přepsat + + + + Insert + Vložit + + + + &Open... + &Otevřít... + + + + Open an existing file + Otevřít stávající soubor + + + + &Save + &Uložit + + + + Save the document to disk + Uložit dokument na disk + + + + Save &As... + Uložit &jako... + + + + Save the document under a new name + Uložit dokument pod novým názvem + + + + Save &Readable... + Uložit Č&itelné... + + + + Save document in readable form + Uložit dokument v čitelné podobě + + + + E&xit + &Ukončit + + + + Exit the application + Ukončit program + + + + &Undo + &Zpět + + + + &Redo + &Znovu + + + + &Save Selection Readable... + &Uložit výběr čitelný... + + + + Save selection in readable form + Uložit výběr v čitelné podobě + + + + &About + &O programu + + + + Show the application's About box + Ukázat informace o programu + + + + About &Qt + O &Qt + + + + Show the Qt library's About box + Ukázat informace oknihovně Qt + + + + Find next occurrence of the searched pattern + + + + + &Options + &Volby + + + + Show the Dialog to select applications options + Ukázat dialog pro výběr voleb programu + + + + Edit + + + + + Cannot write file %1. + + + + + &Find/Replace + + + + + Drop File: + + + + + Show the Dialog for finding and replacing + + + + + Find &next + + + + + &File + &Soubor + + + + &Edit + Ú&pravy + + + + &Help + &Nápověda + + + + Address: + Adresa: + + + + Size: + Velikost: + + + + Mode: + Režim: + + + + Ready + Připraven + + + + File + Soubor + + + SDI + SDI + + + + Cannot read file %1: +%2. + Nelze číst soubor %1: +%2. + + + + File loaded + Soubor nahrán + + + + OptionsDialog + + Dialog + Dialog + + + + QHexEdit - Options + + + + + Flags + Příznaky + + + + ReadOnly + PouzeProČtení + + + + Higlighting + Zvýraznění + + + + Overwrite Mode + Režim přepisu + + + + + Address Area + Oblast s adresou + + + + Ascii Area + Oblast ASCII + + + + Colors and Fonts + Barvy a písma + + + + Highlighting Color + Barva pro zvýraznění + + + + Address Area Color + Barva pro oblast s adresou + + + + Selection Color + Barva výběru + + + + Widget Font + Písmo doplňku + + + + 01 23 45 67 89 ab cd ef + 01 23 45 67 89 ab cd ef + + + + Address Area Width + Šířka oblasti s adresou + + + + Hex Area + + + + + Bytes per Line + + + + + SearchDialog + + Dialog + Dialog + + + + QHexEdit - Find/Replace + + + + + Find + + + + + + Hex + + + + + + UTF-8 + + + + + Replace + + + + + Options + + + + + &Backwards + + + + + &Prompt on replace + + + + + &Find + + + + + F3 + + + + + &Replace + + + + + Replace &All + + + + + &Close + + + + + + QHexEdit + + + + + %1 occurrences replaced. + + + + + Replace occurrence? + + + + + UndoStack + + + Inserting %1 bytes + + + + + Delete %1 chars + + + + + Overwrite %1 chars + + + + diff --git a/example/translations/qhexedit_de.qm b/example/translations/qhexedit_de.qm new file mode 100644 index 0000000..3346266 Binary files /dev/null and b/example/translations/qhexedit_de.qm 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 @@ + + + + + MainWindow + + About HexEdit + Über HexEdit + + + The HexEdit example is a short Demo of the QHexEdit Widget. + Das HexEdit Beispiel ist eine einfache Demo Anwendung für das QHexEdit Widget. + + + + Save As + Speichern unter + + + + + Save To Readable File + Als lesbare Datei speichern + + + HexEdit + HexEdit + + + + About QHexEdit + Über QHexEdit + + + + The QHexEdit example is a short Demo of the QHexEdit Widget. + Das QHexEdit Beispiel ist eine einfache Demo Anwendung für das QHexEdit Widget. + + + + + + + QHexEdit + QHexEdit + + + + + Cannot write file %1: +%2. + Kann Detei %1 nicht schreiben: +%2. + + + + + + File saved + Datei gespeichert + + + + Overwrite + Überschreiben + + + + Insert + Einfügen + + + + &Open... + Öf&fnen... + + + + Open an existing file + Existierende Datei öffnen + + + + &Save + &Speichern + + + + Save the document to disk + Dokument auf Platte speichern + + + + Save &As... + Speichern &unter... + + + + Save the document under a new name + Dokument unter neuem Namen speichern + + + + Save &Readable... + Als &lesbare Datei speichern... + + + + Save document in readable form + Das Dokument in lesbarer From speichern + + + + E&xit + &Beenden + + + + Exit the application + Applikation beenden + + + + &Undo + &Wiederherstellen + + + + &Redo + &Rückgängig + + + + &Save Selection Readable... + &Auswahl in lesbarer Form speichern... + + + + Save selection in readable form + Speichere die Auswahl in lesbarer Form + + + + &About + Ü&ber + + + + Show the application's About box + Zeige Informationen zur Anwendungj + + + + About &Qt + Über &Qt + + + + Show the Qt library's About box + Zeige Informationen über Qt + + + + Find next occurrence of the searched pattern + Zeige die nächste Fundstelle mit dem gleichen Suchmuster + + + + &Options + &Optionen + + + + Show the Dialog to select applications options + Zeige den Dialog, um Optionen der Anwendunge einzustellen + + + + Edit + Bearbeiten + + + + Cannot write file %1. + Kann Datei %1 nicht schreiben. + + + + &Find/Replace + &Suchen/Ersetzen + + + + Drop File: + Datei erhalten: + + + + Show the Dialog for finding and replacing + Zeige den Suchen/Ersetzen Dialog + + + + Find &next + &Weitersuchen + + + Find next occurance of the sarched pattern + Zeige die nächste Fundstelle mit dem gleichen Suchmuster + + + + &File + &Datei + + + + &Edit + &Beearbeiten + + + + &Help + &Hilfe + + + + Address: + Adresse: + + + + Size: + Größe: + + + + Mode: + Mode: + + + + Ready + Fertig + + + + File + Datei + + + SDI + SDI + + + + Cannot read file %1: +%2. + Kann Datei %1 nicht lesen: +%2. + + + + File loaded + Datei geladen + + + + OptionsDialog + + Dialog + Optionen + + + + QHexEdit - Options + QHexEdit - Optionen + + + + Flags + Eigenschaften + + + + ReadOnly + Nur lesen + + + + Higlighting + Hervorheben + + + + Overwrite Mode + Überschreibe Modus + + + + + Address Area + Adressfeld + + + + Ascii Area + Ascii-Feld + + + + Colors and Fonts + Farben und Schriftarten + + + + Highlighting Color + Farbe Hervorhebung + + + + Address Area Color + Farbe Adressfeld + + + + Selection Color + Farbe Markierung + + + + Widget Font + Font-Auswahl + + + + 01 23 45 67 89 ab cd ef + + + + + Address Area Width + + + + + Hex Area + Hexadezimalfeld + + + + Bytes per Line + Bytes pro Zeile + + + + SearchDialog + + Dialog + Optionen + + + + QHexEdit - Find/Replace + QHexEdit - Suchen/Ersetzen + + + + Find + Suchen + + + + + Hex + Hex + + + + + UTF-8 + UTF-8 + + + + Replace + Ersetzen + + + + Options + Optionen + + + + &Backwards + &Rückwärts + + + + &Prompt on replace + Vor dem Ersetzen &nachfragen + + + + &Find + &Suchen + + + + F3 + + + + + &Replace + &Ersetzen + + + + Replace &All + &Alle ersetzen + + + + &Close + &Schließen + + + + + QHexEdit + QHexEdit + + + + %1 occurrences replaced. + %1 Vorkommnisse ersetzt. + + + + Replace occurrence? + Vorkommnis ersetzen? + + + Replace occurrance? + Vorkommnis ersetzen? + + + + UndoStack + + + Inserting %1 bytes + %1 Bytes eingefügt + + + + Delete %1 chars + %1 Zeiche(n) gelöscht + + + + Overwrite %1 chars + %1 Zeichen überschrieben + + + diff --git a/example/translations/qhexedit_ru.qm b/example/translations/qhexedit_ru.qm new file mode 100644 index 0000000..936e9df Binary files /dev/null and b/example/translations/qhexedit_ru.qm 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 @@ + + + + + MainWindow + + + About QHexEdit + Про QHexEdit + + + + The QHexEdit example is a short Demo of the QHexEdit Widget. + QHexEdit пример это короткая демонстрация работы QHexEdit компоненты. + + + + Save As + Сохранить как + + + + + Save To Readable File + i hope it is text file with hex dump + Сохранить как читаемый файл + + + + + + + QHexEdit + QHexEdit + + + + + Cannot write file %1: +%2. + Не могу записать файл %1: +%2. + + + + + + File saved + Файл сохранен + + + + Overwrite + Замена + + + + Insert + Вставка + + + + &Open... + &Открыть... + + + + Open an existing file + Открыть существующий файл + + + + &Save + &Сохранить + + + + Save the document to disk + Сохранить документ на диск + + + + Save &As... + Сохранить &как... + + + + Save the document under a new name + Сохранить документ под новым именем + + + + Save &Readable... + Сохранить как &читаемый... + + + + Save document in readable form + Сохранить документ в читабельной форме + + + + E&xit + В&ыход + + + + Exit the application + Выход из приложения + + + + &Undo + &Отмена + + + + &Redo + &Повторение + + + + &Save Selection Readable... + &Сохранить выделеное читабельно... + + + + Save selection in readable form + Сохранить выделеное в читабельной форме + + + + &About + &О программе + + + + Show the application's About box + Показать сообщение рассказывающее о программе + + + + About &Qt + Про &QT + + + + Show the Qt library's About box + Показать сообщение о библиотеке QT + + + + &Find/Replace + &Поиск/Замена + + + + Show the Dialog for finding and replacing + Показать диалоговое окно для поиска и замены + + + + Find &next + Найти &следующий + + + + Find next occurrence of the searched pattern + Найти следующие вхождение поискового шаблона + + + + &Options + &Настройки + + + + Show the Dialog to select applications options + Показать диалоговое окно для установок приложения + + + + &File + &Файл + + + + &Edit + &Редактирование + + + + &Help + &Помощь + + + + Address: + Адрес: + + + + Size: + Размер: + + + + Mode: + Режим: + + + + Ready + Готово + + + + File + Файл + + + + Edit + Редактирование + + + + Cannot read file %1: +%2. + Не могу прочитать файл %1: +%2. + + + + File loaded + Файл загружен + + + + Cannot write file %1. + Не могу записать файл %1. + + + + OptionsDialog + + + QHexEdit - Options + QHexEdit - Настройки + + + + Flags + Флаги + + + + ReadOnly + Только чтение + + + + Higlighting + Подсвечивание + + + + Overwrite Mode + Режим замены + + + + + Address Area + Адресная область + + + + Ascii Area + Область ASCII + + + + Colors and Fonts + Цвета и Шрифты + + + + Highlighting Color + Цвет подсвечивания + + + + Address Area Color + Цвет адресной области + + + + Selection Color + Цвет для выбраной области + + + + Widget Font + Шрифт для компоненты + + + + 01 23 45 67 89 ab cd ef + 01 23 45 67 89 ab cd ef + + + + Address Area Width + Ширина адресной области + + + + Hex Area + Шестнадцатиричная область + + + + Bytes per Line + Байт в строке + + + + SearchDialog + + + QHexEdit - Find/Replace + QHExEdit - Поиск/Замена + + + + Find + Найти + + + + + Hex + Hex + + + + + UTF-8 + UTF-8 + + + + Replace + Замена + + + + Options + Настройки + + + + &Backwards + &Обратный поиск + + + + &Prompt on replace + &Предупреждать перед заменой + + + + &Find + &Найти + + + + F3 + F3 + + + + &Replace + За&менить + + + + Replace &All + Заменить &всё + + + + &Close + &Закрыть + + + + + QHexEdit + QHexEdit + + + + %1 occurrences replaced. + %1 найденых фрагментов заменено. + + + + Replace occurrence? + заменить найденое? + + + + UndoStack + + + Inserting %1 bytes + Вставить %1 байт + + + + Delete %1 chars + Удалить %1 символов + + + + Overwrite %1 chars + Заменить %1 символов + + + -- cgit v1.2.3