From: hama Date: Thu, 14 Jan 2016 23:16:06 +0000 (+0100) Subject: dayly work X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=72ef9a2053344ba15bade708c05b45f9833be50e;p=reqt dayly work --- diff --git a/appl/recform/CFormatter.cpp b/appl/recform/CFormatter.cpp index 96f2158..b495074 100644 --- a/appl/recform/CFormatter.cpp +++ b/appl/recform/CFormatter.cpp @@ -36,17 +36,16 @@ CFormatter::CFormatter(ReProgramArgs& args, ReLogger* logger) : m_useTab(true), m_lexer(NULL), m_parser(NULL), - m_countIsTypeList(256), - m_isInTypeList(new bool[m_countIsTypeList]), + m_isInTypeList(), m_countTokenLengths(256), m_tokenLengths(new int[m_countTokenLengths]) { + m_isInTypeList.fill(' ', 256); } /** * Destructor. */ CFormatter::~CFormatter(){ - delete[] m_isInTypeList; delete[] m_tokenLengths; } @@ -68,6 +67,15 @@ void CFormatter::addToken(ReToken* token) m_logicalLine.push_back(FormatToken(token, m_parenthLevel)); } +/** + * Sets the value of m_isInTypeList at a given index to true. + * @param ix index to set + */ +void CFormatter::setIsInTypeList(int ix){ + char cc = '0' + ix % 10; + m_isInTypeList.replace(ix, 1, &cc, 1); +} + /** * Find tokens belonging to a type list: cast expressions. * @@ -111,7 +119,7 @@ void CFormatter::findTypeLists() break; } } else { - m_isInTypeList[ix] = true; + m_isInTypeList[ix] = '0' + ix % 10; } } if (endOfTypelist < 0) @@ -127,7 +135,7 @@ void CFormatter::findTypeLists() && m_logicalLine.constData()[ix - 2].isOperator(OP_LBRACKET))){ // mark all tokens until the previous '(' as "in typelist": while(ix > 0 && ! m_logicalLine.constData()[ix].isOperator(OP_LPARENTH)) - m_isInTypeList[ix--] = true; + setIsInTypeList(ix--); } } } @@ -139,7 +147,7 @@ void CFormatter::findTypeLists() while(++ix < count && ((item2 = &m_logicalLine.constData()[ix]) ->isOperator(OP_LBRACKET, OP_LPARENTH) || item2->isOperator(OP_SEMICOLON, OP_COMMA))) - m_isInTypeList[ix] = true; + setIsInTypeList(ix); } } // search for template expressions: '<' types '>': @@ -158,7 +166,7 @@ void CFormatter::findTypeLists() } if (found){ while(++ix < ix2) - m_isInTypeList[ix] = true; + setIsInTypeList(ix); ix++; } } @@ -199,7 +207,7 @@ void CFormatter::flushLine(int maxIndex, int rawLength) for (int ix = 1; ix < maxIx; ix++){ FormatToken* item = &m_logicalLine.data()[ix]; if (m_outputBuffer.length() > 0 - && needsBlank(lastItem, item, m_isInTypeList[ix])) + && needsBlank(lastItem, item, m_isInTypeList[ix] != ' ')) m_outputBuffer.append(' '); flushToken(item); lastItem = item; @@ -208,8 +216,7 @@ void CFormatter::flushLine(int maxIndex, int rawLength) flushBuffer(); } m_logicalLine.remove(0, maxIx + 1); - memmove(m_isInTypeList, m_isInTypeList + maxIx, - (maxIndex - maxIx + 1) * sizeof m_isInTypeList[0]); + m_isInTypeList.remove(0, maxIx + 1); memmove(m_tokenLengths, m_tokenLengths + maxIx, (maxIndex - maxIx + 1) * sizeof m_tokenLengths[0]); maxIndex -= maxIx; @@ -244,7 +251,7 @@ int CFormatter::calcLength(int& maxIx){ m_tokenLengths[0] = length; for (int ix = 1; ix < maxIx; ix++){ FormatToken* item = &m_logicalLine.data()[ix]; - if (needsBlank(lastItem, item, m_isInTypeList[ix])) + if (needsBlank(lastItem, item, m_isInTypeList[ix] != ' ')) length += 1; length += item->string().length(); if (item->comment().length() > 0){ @@ -266,7 +273,7 @@ int CFormatter::calcLength(int& maxIx){ */ void CFormatter::flush(bool isPart) { - resetIsTypeList(); + resetIsInTypeList(); findTypeLists(); FormatToken* token; if (m_logicalLine.size() > 0 && (token = &m_logicalLine.data()[0]) @@ -496,14 +503,9 @@ bool CFormatter::needsBlank(ReToken* first, ReToken* second, bool isDeclaration) * * @return */ -void CFormatter::resetIsTypeList() +void CFormatter::resetIsInTypeList() { - if (m_countIsTypeList < m_logicalLine.size()){ - delete[] m_isInTypeList; - m_countIsTypeList = max(m_logicalLine.size() + 1, m_countIsTypeList + 256); - m_isInTypeList = new bool[m_countIsTypeList]; - } - memset(m_isInTypeList, false, sizeof *m_isInTypeList * m_countIsTypeList); + m_isInTypeList.fill(' ', m_logicalLine.size()); } /** @@ -647,9 +649,9 @@ void CFormatter::setBlockLevel(int blockLevel) */ void CFormatter::setLastDeclToken(int lastDeclToken) { - int count = min(lastDeclToken, m_countIsTypeList); - if (count > 0) - memset(m_isInTypeList, ~false, count * sizeof *m_isInTypeList); + int maxIx = min(lastDeclToken, m_isInTypeList.length() - 1); + for (int ix = 0; ix <= maxIx; ix++) + setIsInTypeList(ix); } /** diff --git a/appl/recform/CFormatter.hpp b/appl/recform/CFormatter.hpp index a227ce9..70385a6 100644 --- a/appl/recform/CFormatter.hpp +++ b/appl/recform/CFormatter.hpp @@ -66,6 +66,7 @@ public: void restoreParenthLevel(); void saveAndResetParenthLevel(); void setBlockLevel(int blockLevel); + void setIsInTypeList(int ix); void setLastDeclToken(int lastDeclToken); void setLexer(CppLexer* lexer); void setParenthLevel(int parenthLevel); @@ -83,7 +84,7 @@ protected: bool needsPrecedingBlank(CppOperator op); bool needsTrailingBlank(CppOperator op); bool needsBlank(ReToken* first, ReToken* second, bool isTypeList); - void resetIsTypeList(); + void resetIsInTypeList(); private: ReProgramArgs& m_args; int m_blockLevel; @@ -101,8 +102,9 @@ private: CppLexer* m_lexer; CppParser* m_parser; int m_countIsTypeList; + // a string as boolean list: ' ' is false, ('0' + ix%10) is true // index: position of a token in m_logicalLine. Value: token is in type list. - bool* m_isInTypeList; + QByteArray m_isInTypeList; QByteArray m_indentBuffer; QByteArray m_outputBuffer; int m_countTokenLengths; diff --git a/appl/reimgconvert/converter.cpp b/appl/reimgconvert/converter.cpp index f4f511a..6e1b4d1 100644 --- a/appl/reimgconvert/converter.cpp +++ b/appl/reimgconvert/converter.cpp @@ -379,7 +379,7 @@ void Converter::run(){ no++; QString path = m_dir.absoluteFilePath(node); qint64 length = it.fileInfo().size(); - QString nodeTarget = ReQStringUtil::replaceExtension(node, + QString nodeTarget = ReFileUtils::replaceExtension(node, "." + m_targetType); QString target = m_targetDir.absoluteFilePath(nodeTarget); convertOneFile(path, target, length); @@ -393,7 +393,6 @@ void Converter::run(){ } msg = QObject::tr("%1 file(s) converted").arg(no); changeState(Converter::STATE_READY, msg); - m_mainWindows->switchRun(true); } /** diff --git a/appl/reimgconvert/mainwindow.cpp b/appl/reimgconvert/mainwindow.cpp index 78c123b..3ba3947 100644 --- a/appl/reimgconvert/mainwindow.cpp +++ b/appl/reimgconvert/mainwindow.cpp @@ -32,31 +32,36 @@ const QString VERSION("2015.05.31"); * @param parent NULL or the parent (who destroys the objects at the end) */ MainWindow::MainWindow(const QString& homeDir, QWidget *parent) : - QMainWindow(parent), - m_homeDir(homeDir), - m_storageFile(), - ui(new Ui::MainWindow), - m_converter(NULL){ + QMainWindow(parent), + m_homeDir(homeDir), + m_storageFile(), + ui(new Ui::MainWindow), + m_converter(NULL), + m_logger(), + m_guiQueue(), + m_guiTimer(new QTimer(this)){ ui->setupUi(this); initializeHome(); - switchRun(true); + startStop(true); m_statusMessage = new QLabel(tr("Welcome at reimgconvert")); statusBar()->addWidget(m_statusMessage); connect(ui->actionSelectDestination, SIGNAL(triggered()), this, - SLOT(selectDestination())); + SLOT(selectDestination())); connect(ui->pushButtonSelectDest, SIGNAL(clicked()), this, - SLOT(selectDestination())); + SLOT(selectDestination())); connect(ui->actionSelectSource, SIGNAL(triggered()), this, - SLOT(selectSource())); + SLOT(selectSource())); connect(ui->pushButtonSelectDest, SIGNAL(clicked()), this, - SLOT(selectDestination())); + SLOT(selectDestination())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); restoreState(); connect(ui->comboBoxTemplate, SIGNAL(currentIndexChanged(const QString&)), - this, SLOT(on_templateChangeIndex(const QString&))); + this, SLOT(on_templateChangeIndex(const QString&))); connect(ui->pushButtonActivate, SIGNAL(clicked()), this, SLOT(activate())); + connect(m_guiTimer, SIGNAL(timeout()), this, SLOT(guiTimerUpdate())); restoreState(); + m_guiTimer->start(100); } /** @@ -84,17 +89,17 @@ void MainWindow::activate(){ */ void MainWindow::setMaxDimensions(int maxWidth, int maxHeight){ if (maxWidth > maxHeight){ - ui->comboBoxLandscapeX->setCurrentText(QString::number(maxWidth)); - ui->comboBoxLandscapeY->setCurrentText("*"); - ui->comboBoxPortraitX->setCurrentText("*"); - ui->comboBoxPortraitY->setCurrentText(QString::number(maxHeight)); - ui->comboBoxSquareX->setCurrentText(QString::number(maxHeight)); + ui->comboBoxLandscapeX->setCurrentText(QString::number(maxWidth)); + ui->comboBoxLandscapeY->setCurrentText("*"); + ui->comboBoxPortraitX->setCurrentText("*"); + ui->comboBoxPortraitY->setCurrentText(QString::number(maxHeight)); + ui->comboBoxSquareX->setCurrentText(QString::number(maxHeight)); }else{ - ui->comboBoxLandscapeY->setCurrentText(QString::number(maxHeight)); - ui->comboBoxLandscapeX->setCurrentText("*"); - ui->comboBoxPortraitY->setCurrentText("*"); - ui->comboBoxPortraitX->setCurrentText(QString::number(maxWidth)); - ui->comboBoxSquareX->setCurrentText(QString::number(maxWidth)); + ui->comboBoxLandscapeY->setCurrentText(QString::number(maxHeight)); + ui->comboBoxLandscapeX->setCurrentText("*"); + ui->comboBoxPortraitY->setCurrentText("*"); + ui->comboBoxPortraitX->setCurrentText(QString::number(maxWidth)); + ui->comboBoxSquareX->setCurrentText(QString::number(maxWidth)); } } @@ -103,10 +108,10 @@ void MainWindow::setMaxDimensions(int maxWidth, int maxHeight){ */ void MainWindow::selectDestination(){ QString dir = QFileDialog::getExistingDirectory(this, - tr("Select Destination Directory"), ui->comboBoxTarget->currentText(), - QFileDialog::ShowDirsOnly); + tr("Select Destination Directory"), ui->comboBoxTarget->currentText(), + QFileDialog::ShowDirsOnly); if (!dir.isEmpty()) - ui->comboBoxTarget->setCurrentText(dir); + ui->comboBoxTarget->setCurrentText(dir); } /** @@ -114,10 +119,10 @@ void MainWindow::selectDestination(){ */ void MainWindow::selectSource(){ QString dir = QFileDialog::getExistingDirectory(this, - tr("Select Source Directory"), ui->comboBoxSourceDir->currentText(), - QFileDialog::ShowDirsOnly); + tr("Select Source Directory"), ui->comboBoxSourceDir->currentText(), + QFileDialog::ShowDirsOnly); if (!dir.isEmpty()) - ui->comboBoxSourceDir->setCurrentText(dir); + ui->comboBoxSourceDir->setCurrentText(dir); } /** @@ -128,23 +133,54 @@ void MainWindow::about(){ dialog.exec(); } +/** + * Callback method of the GUI timer. + */ +void MainWindow::guiTimerUpdate() +{ + int count = m_guiQueue.count(); + while(count-- > 0){ + ReGuiQueueItem item = m_guiQueue.popFront(); + if (item.m_type == ReGuiQueueItem::Undef) + break; + if (! item.apply()){ + switch (item.m_type){ + case ReGuiQueueItem::ListEnd: + ui->listWidget->addItem(item.m_value); + break; + case ReGuiQueueItem::ReadyMessage: + say(LOG_INFO, item.m_value); + startStop(false); + break; + case ReGuiQueueItem::LogMessage: + say(LOG_INFO, item.m_value); + break; + default: + say(LOG_ERROR, "unknown item type: " + QString::number(item.m_type) + + " " + item.m_value); + break; + } + + } + } +} /** * initializeHomeializes the program home directory. */ void MainWindow::initializeHome(){ if (m_homeDir.isEmpty()){ - m_homeDir = QDir::home().absoluteFilePath(".reimgconvert"); + m_homeDir = QDir::home().absoluteFilePath(".reimgconvert"); } QDir home(m_homeDir); if (!home.exists()){ - if (!home.mkpath(m_homeDir)){ - m_homeDir = home.tempPath() + "/.reimgconvert"; - home.mkpath(m_homeDir); - } + if (!home.mkpath(m_homeDir)){ + m_homeDir = home.tempPath() + "/.reimgconvert"; + home.mkpath(m_homeDir); + } } if (!m_homeDir.endsWith("/")) - m_homeDir += "/"; + m_homeDir += "/"; m_storageFile = m_homeDir + "state.conf"; restoreState(); } @@ -169,9 +205,9 @@ void MainWindow::on_pushButtonFileSelect_clicked(){ selection.setFileMode(QFileDialog::DirectoryOnly); QString dir = ui->comboBoxSourceDir->currentText(); if (!dir.isEmpty()) - selection.setDirectory(dir); + selection.setDirectory(dir); if (selection.exec()) - ui->comboBoxSourceDir->setCurrentText(selection.selectedFiles().at(0)); + ui->comboBoxSourceDir->setCurrentText(selection.selectedFiles().at(0)); } /** @@ -191,7 +227,7 @@ void MainWindow::on_templateChangeIndex(const QString & text){ * @brief Handles the button click on "convert". */ void MainWindow::on_pushButtonConvert_clicked(){ - switchRun(false); + startStop(true); delete m_converter; m_errors = 0; int landscapeX = comboInt(ui->comboBoxLandscapeX, 0, "*", 0); @@ -201,13 +237,13 @@ void MainWindow::on_pushButtonConvert_clicked(){ int squareX = comboInt(ui->comboBoxSquareX, 0); int quality = comboInt(ui->comboBoxQuality, 70); if (m_errors == 0){ - m_converter = new Converter(ui->comboBoxSourceDir->currentText(), - ui->comboBoxLandscapeX->currentText(), - ui->comboBoxSourcePattern->currentText(), - ui->comboBoxDestType->currentText(), landscapeX, landscapeY, portraitX, - portraitY, squareX, quality, this); - // start the thread: - m_converter->start(); + m_converter = new Converter(ui->comboBoxSourceDir->currentText(), + ui->comboBoxLandscapeX->currentText(), + ui->comboBoxSourcePattern->currentText(), + ui->comboBoxDestType->currentText(), landscapeX, landscapeY, portraitX, + portraitY, squareX, quality, this); + // start the thread: + m_converter->start(); } } @@ -215,22 +251,24 @@ void MainWindow::on_pushButtonConvert_clicked(){ /** * @brief Handles the event "thread changed". * + * Note: this method is called from a non main thread + * * @param state the new state of the thread * @param info info about the new state. Not used */ -void MainWindow::on_threadStateChanged(Converter::State state, const QString&){ +void MainWindow::on_threadStateChanged(Converter::State state, const QString& info){ switch (state) { case Converter::STATE_READY: - ui->pushButtonConvert->show(); - ui->pushButtonStop->hide(); - //ui->statusBar->showMessage(info); - break; + m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ReadyMessage, NULL, info)); + ui->pushButtonStop->hide(); + //ui->statusBar->showMessage(info); + break; case Converter::STATE_SUB_TASK_STOPPED: - //ui->statusBar->showMessage(info); - break; + //ui->statusBar->showMessage(info); + break; case Converter::STATE_STARTING: default: - break; + break; } } @@ -248,10 +286,13 @@ bool MainWindow::log(const QString& message){ /** * @brief Logs a message * + * Note: used by non main threads + * * @param message the message to log * @return true */ bool MainWindow::logAppendLast(const QString& message){ + m_guiQueue.pushBack(ReGuiQueueItem(ReGuiQueueItem::ListEnd, ui->listWidget, message)); QListWidgetItem* item = ui->listWidget->item(0); item->setText(item->text() + " " + message); return true; @@ -261,7 +302,7 @@ bool MainWindow::logAppendLast(const QString& message){ * Reads the history of the widget values and other parameters and set it. */ void MainWindow::restoreState(){ - ReStateStorage storage(m_storageFile); + ReStateStorage storage(m_storageFile, &m_logger); storage.setForm("main"); storage.restore(ui->comboBoxMaxHeight, "comboBoxMaxHeight", true); storage.restore(ui->comboBoxMaxWidth, "comboBoxMaxWidth", true); @@ -281,7 +322,7 @@ void MainWindow::restoreState(){ * Stores the history of the widget values and other parameters. */ void MainWindow::saveState(){ - ReStateStorage storage(m_storageFile); + ReStateStorage storage(m_storageFile, &m_logger); storage.setForm("main"); storage.store(ui->comboBoxMaxHeight, "comboBoxMaxHeight"); storage.store(ui->comboBoxMaxWidth, "comboBoxMaxWidth"); @@ -308,19 +349,30 @@ void MainWindow::setStatusMessage(bool error, const QString& message){ } /** - * Enables/disables the buttons/actions relevant for running. + * Starts or stops the search. * - * @param runActive true: the conversion is possible + * @param start true: the search should start */ -void MainWindow::switchRun(bool runActive){ - if (runActive){ - ui->pushButtonConvert->show(); - ui->pushButtonStop->hide(); - }else{ - ui->pushButtonConvert->hide(); - ui->pushButtonStop->show(); - } - ui->actionConvert->setEnabled(runActive); - ui->actionStop->setEnabled(not runActive); +void MainWindow::startStop(bool isStart){ + ui->actionStart->setEnabled(!isStart); + ui->actionStop->setEnabled(isStart); + ui->pushButtonConvert->setEnabled(! isStart); + ui->pushButtonStop->setEnabled(isStart); +} + +/** + * Issues a message. + * + * @param level type of the message + * @param message message to issue + * @return level == LOG_ERROR + */ +bool MainWindow::say(ReLoggerLevel level, const QString& message) +{ + if (level == LOG_ERROR || level == LOG_WARNING) + error(message); + else + log(message); + return level == LOG_ERROR; } diff --git a/appl/reimgconvert/mainwindow.hpp b/appl/reimgconvert/mainwindow.hpp index 8647990..980694a 100644 --- a/appl/reimgconvert/mainwindow.hpp +++ b/appl/reimgconvert/mainwindow.hpp @@ -17,6 +17,7 @@ #include #include #include "converter.hpp" +#include "base/rebase.hpp" #include "gui/regui.hpp" namespace Ui { class MainWindow; @@ -33,21 +34,25 @@ public: public: bool error(const QString& message){ - log("+++ " + message); - return false; + log("+++ " + message); + return false; } bool log(const QString& message); bool logAppendLast(const QString& message); + void on_threadStateChanged(Converter::State state, const QString& info); void setStatusMessage(bool error, const QString& message); void switchRun(bool runActive); + virtual bool say(ReLoggerLevel level, const QString& message); private: void initializeHome(); void restoreState(); void saveState(); void setMaxDimensions(int maxWidth, int maxHeight);public slots: - void on_threadStateChanged(Converter::State state, const QString& info);private slots: + void startStop(bool isStart); +private slots: void activate(); void about(); + void guiTimerUpdate(); void on_pushButtonFileSelect_clicked(); void on_pushButtonStop_clicked(); void on_pushButtonConvert_clicked(); @@ -60,6 +65,9 @@ private: Ui::MainWindow *ui; Converter* m_converter; QLabel* m_statusMessage; + ReLogger m_logger; + ReGuiQueue m_guiQueue; + QTimer* m_guiTimer; }; #endif // MAINWINDOW_HPP diff --git a/appl/reimgconvert/mainwindow.ui b/appl/reimgconvert/mainwindow.ui index 63681a2..1d46a60 100644 --- a/appl/reimgconvert/mainwindow.ui +++ b/appl/reimgconvert/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 799 - 651 + 823 + 783 @@ -20,101 +20,36 @@ ReImgConvert - - - - 11 - 11 - 787 - 647 - - - - - - - - 0 - 150 - - - - - 16777215 - 150 - - - - 0 - - - - Dimensions (quick) - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Template: - - - + + + + + + + + + 0 + 150 + + + + + 16777215 + 150 + + + + 0 + + + + Dimensions (quick) + + - - - - Website: 1024x768 - - + - - Website II: 800x600 - - - - - Photo: 2048x1536 - - - - - Photo II: 3072x2304 - - - - - Midi: 600x400 - - - - - Mini: 150x100 - - - - - - - - - - - - + 100 @@ -128,524 +63,420 @@ - Max. Width: + Template: - - + + - 100 + 315 0 - + + + Website: 1024x768 + + + + + Website II: 800x600 + + + + + Photo: 2048x1536 + + + + + Photo II: 3072x2304 + + + + + Midi: 600x400 + + + + + Mini: 150x100 + + + + + + + + Qt::Horizontal + + - 100 - 16777215 + 40 + 20 - - true - - + - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Width: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Height: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + + + + - Max. Height: + &Activate template - - - - - 100 - 0 - + + + + Qt::Horizontal - + - 100 - 16777215 + 40 + 20 - - true - - + + + + + + Dimensions (separated) + + - - - Qt::Horizontal + + + + 230 + 100 + - + - 40 - 20 + 230 + 100 - - - - - - &Activate + + Portrait: - - - - - - - - - Dimensions (separated) - - - - - - - 230 - 100 - - - - - 230 - 100 - - - - Portrait: - - - - - 2 - 30 - 221 - 61 - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Max. Width: - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Max. Height: - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true - - - - - - - - - - - Qt::Horizontal - - - - 48 - 20 - - - - - - - - - 230 - 100 - - - - - 230 - 100 - - - - Landscape: - - - - - 3 - 31 - 221 - 61 - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Max. Width: - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Max. Height: - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true - - - - - - - - - - - Qt::Horizontal - - - - 47 - 20 - - - - - - - - - 150 - 100 - - - - - 150 - 100 - - - - Square: - - - - - 0 - 60 - 100 - 26 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true - - - - - - 0 - 40 - 141 - 18 - - - - Max. Width/Height: - - - - - - groupBox_2 - groupBox_3 - groupBox - horizontalSpacer - - - - - - - - 0 - 150 - - - - - 16777215 - 150 - - - - Others: - - - - QLayout::SetFixedSize - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Quality (%) + + + + 2 + 30 + 221 + 65 + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Width: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Height: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + - - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - true + + + + + + + 230 + 100 + + + + + 230 + 100 + + + + Landscape: + + + + + 3 + 31 + 221 + 65 + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Width: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Max. Height: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 100 - 0 - - - - + + + + + + + 150 + 100 + + + + + 150 + 100 + + + + Square: + + + + + 0 + 60 100 - 16777215 - - - - File Pattern: + 26 + - - - - 100 @@ -658,208 +489,305 @@ 16777215 - - A pattern of the source files with wildcards '*' (anything) and '?' (exact one char) - true - - - *.jpg - - - - - *.png - - - - - *.gif - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - + + + + 0 + 40 + 141 + 18 + - Dest. Type: - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - + Max. Width/Height: - - - jpg - - - - - png - - - - - - - - - - - - - - 100 - 0 - - - - - 100 - 16777215 - - + + + + + + Qt::Horizontal + + + + 47 + 20 + + + + + + groupBox_2 + groupBox_3 + groupBox + horizontalSpacer_2 + + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + File Pattern: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + true + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Dest. Type: + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + - Destination: + jpg - - - - - - true - - - + + + + png - - - - - - - 50 - 0 - + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + A pattern of the source files with wildcards '*' (anything) and '?' (exact one char) + + + true + + + + *.jpg - - - 50 - 16777215 - + + + + *.png + + - ... + *.gif - - - - - - - - - - - - - + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + - Source Directory (Images): + Quality (%) + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + - + - - - true - - - /tmp/img + + + Source Directory (Images): - + + + + + true + + + /tmp/img + + + + + + + + 30 + 16777215 + + + + Auswahldialog + + + ... + + + + + + + + + + + + + + 100 + 0 + + - 30 + 100 16777215 - - Auswahldialog - - ... + Destination: + + + + + + true + + + + + + + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + ... + + + + + - - - - - Qt::Vertical - - - - 20 - 40 - - - - + @@ -886,8 +814,24 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + false + 150 @@ -914,31 +858,31 @@ + + + - - - - - - listWidget - groupBox_4 - tabWidget - + listWidget + tabWidget + + + + 0 0 - 799 - 23 + 823 + 26 &File - + @@ -963,7 +907,7 @@ false - + @@ -995,7 +939,7 @@ false - + :/main/icons/action_go.png:/main/icons/action_go.png @@ -1041,6 +985,9 @@ + + false + :/main/icons/cancel.png:/main/icons/cancel.png diff --git a/appl/reimgconvert/reimgconvert.pro b/appl/reimgconvert/reimgconvert.pro index 03d87e6..d2d7863 100644 --- a/appl/reimgconvert/reimgconvert.pro +++ b/appl/reimgconvert/reimgconvert.pro @@ -15,17 +15,19 @@ INCLUDEPATH = ../.. /usr/include/c++/4.9 SOURCES += main.cpp\ ../../base/ReException.cpp \ - ../../base/ReQStringUtil.cpp \ + ../../base/ReQStringUtils.cpp \ + ../../base/ReFileUtils.cpp \ ../../base/ReLogger.cpp \ ../../gui/ReStateStorage.cpp \ ../../gui/ReGuiValidator.cpp \ + ../../gui/ReGuiQueue.cpp \ mainwindow.cpp \ converter.cpp \ aboutdialog.cpp HEADERS += mainwindow.hpp \ ../../base/rebase.hpp \ - ../../base/ReQStringUtil.hpp \ + ../../base/ReQStringUtils.hpp \ ../../gui/ReStateStorage.hpp \ ../../gui/ReGuiValidator.hpp \ ../../gui/regui.hpp \ diff --git a/base/rebase.hpp b/base/rebase.hpp index 464806e..74f7517 100644 --- a/base/rebase.hpp +++ b/base/rebase.hpp @@ -72,6 +72,7 @@ typedef QString ReString; #define _mkdir(path) mkdir(path, -1) #define _rmdir rmdir #define _unlink unlink +typedef qint64 uint64_t; #else #define _strcasecmp _stricmp #define OS_SEPARATOR '\\' diff --git a/gui/ReGuiQueue.hpp b/gui/ReGuiQueue.hpp index fd76ecd..9186a17 100644 --- a/gui/ReGuiQueue.hpp +++ b/gui/ReGuiQueue.hpp @@ -15,7 +15,8 @@ class ReGuiQueueItem { public: enum WidgetType { - Undef, LabelText, NewTableRow, LogMessage, ReadyMessage, + Undef, LabelText, NewTableRow, ListEnd, + LogMessage, ReadyMessage, UserDefined1, UserDefined2 }; @@ -33,7 +34,7 @@ public: * @param widget NULL or the widget * @param value the value to set */ - ReGuiQueueItem(WidgetType type, QWidget* widget, const QString value) : + ReGuiQueueItem(WidgetType type, QWidget* widget, const QString& value) : m_type(type), m_widget(widget), m_value(value){