Major port Qt4 to Qt6
- Updated header inclusions from QtGui to QtWidgets for consistency and compatibility with Qt 5 and later. - Replaced deprecated QApplication::desktop() with QApplication::primaryScreen() for obtaining screen DPI. - Modified MyOutputHandler to use QMessageLogContext and QString for improved logging. - Changed QMatrix to QTransform for image rotation in ImageCutout class. - Updated various debug statements to use toLocal8Bit() instead of toAscii() for better string handling. - Refactored several classes to use QElapsedTimer instead of QTime for performance measurement. - Ensured all operator overloads in Section and Tag classes are marked as const for better const-correctness.
This commit is contained in:
+2
-2
@@ -15,8 +15,8 @@ CTestTestfile.cmake
|
||||
install_manifest.txt
|
||||
Makefile
|
||||
|
||||
ClippingStation.app/
|
||||
ClippingStation.app
|
||||
Clipping\ Station.app/
|
||||
Clipping\ Station.app
|
||||
|
||||
# qmake / Qt Creator
|
||||
*.pro.user*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -------------------------------------------------
|
||||
# Project created by QtCreator 2009-08-20T00:31:05
|
||||
# -------------------------------------------------
|
||||
QT += sql
|
||||
QT += core gui sql widgets network concurrent printsupport
|
||||
TARGET = "Clipping Station"
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp \
|
||||
@@ -91,11 +91,11 @@ FORMS += clippingstation.ui \
|
||||
prominencedialog.ui \
|
||||
pagetextdialog.ui \
|
||||
searchpublicationlistdialog.ui
|
||||
ICON = socialhose.icns
|
||||
ICON = emediasearch.icns
|
||||
RC_FILE = ClippingStation.rc
|
||||
win32 {
|
||||
LIBS += -L"C:\curl-7.19.6\bin\"
|
||||
INCLUDEPATH += "C:\curl-7.19.6\include\"
|
||||
LIBS += -L"C:\curl-7.19.6\bin\""
|
||||
INCLUDEPATH += "C:\curl-7.19.6\include\""
|
||||
}
|
||||
LIBS += -lcurl
|
||||
RESOURCES += icons.qrc
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "imageoutputformatdialog.h"
|
||||
#include "ui_imageoutputformatdialog.h"
|
||||
#include <QRegularExpression>
|
||||
|
||||
ImageOutputFormatDialog::ImageOutputFormatDialog(QWidget *parent, QStringList list, bool keeppagenumber, int startpagenumber) :
|
||||
QDialog(parent),
|
||||
@@ -19,7 +20,7 @@ ImageOutputFormatDialog::ImageOutputFormatDialog(QWidget *parent, QStringList li
|
||||
{
|
||||
QString name = list[i];
|
||||
//the newName value will be stripped down from all NON numeric character, and will output the name in the format dddd.jpg, where d is digit (0-9)
|
||||
QString destinationName = QString("%1.jpg").arg(name.remove(QRegExp("[^\\d]")), 4, QChar('0'));
|
||||
QString destinationName = QString("%1.jpg").arg(name.remove(QRegularExpression("[^\\d]")), 4, QChar('0'));
|
||||
outputFileNames << destinationName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef IMAGEOUTPUTFORMATDIALOG_H
|
||||
#define IMAGEOUTPUTFORMATDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ImageOutputFormatDialog;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
//! \brief the implementation of the class
|
||||
#include <QtGui>
|
||||
#include <QtGlobal> //Q_WS_WIN
|
||||
#include <QCompleter>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "importerdialog.h"
|
||||
#include "imageoutputformatdialog.h"
|
||||
@@ -621,7 +623,7 @@ void ImporterDialog::updateDatabase()
|
||||
queryMaster.bindValue(":id", id_publication_issue);
|
||||
if( !queryMaster.exec() )
|
||||
{
|
||||
qDebug() << "update publication issue: " << queryMaster.lastQuery().toAscii();
|
||||
qDebug() << "update publication issue: " << queryMaster.lastQuery().toLocal8Bit();
|
||||
qDebug() << "user id: " << m_user.id();
|
||||
}
|
||||
|
||||
@@ -660,7 +662,7 @@ void ImporterDialog::updateDatabase()
|
||||
if( !queryMaster.exec())
|
||||
{
|
||||
QMessageBox::critical(this, tr("SQL Error"), queryMaster.lastError().databaseText());
|
||||
qDebug() << "issue_sections insert query error: " << queryMaster.lastQuery().toAscii();
|
||||
qDebug() << "issue_sections insert query error: " << queryMaster.lastQuery().toLocal8Bit();
|
||||
ui->importButton->setEnabled(true);
|
||||
setEnabled(true);
|
||||
return;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef IMPORTERDIALOG_H
|
||||
#define IMPORTERDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
#include <QtSql>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
+17
-17
@@ -67,7 +67,7 @@ void Article::updateImageCutouts(QSqlDatabase &database, QList<ImageCutout *> cu
|
||||
query.bindValue(":id_article", m_id);
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void Article::updateTags(QSqlDatabase &database, QList<Tag> &tags, bool isArabic
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void Article::updateTags(QSqlDatabase &database, QList<Tag> &tags, bool isArabic
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void Article::updateTags(QSqlDatabase &database, QList<Tag> &tags, bool isArabic
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void Article::updateImagesNumber(QSqlDatabase &database, int images_number)
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ void Article::updateImagesNumber(QSqlDatabase &database, int articleId, int imag
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ void Article::updateStatus(QSqlDatabase &database, int status)
|
||||
query.bindValue(":id_article" , m_id);
|
||||
|
||||
if ( !query.exec() )
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
|
||||
void Article::updateStatus(QSqlDatabase &database, int articleId, int status)
|
||||
@@ -252,7 +252,7 @@ void Article::updateStatus(QSqlDatabase &database, int articleId, int status)
|
||||
query.bindValue(":id_article" , articleId);
|
||||
|
||||
if ( !query.exec() )
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
|
||||
qDebug("end of updateStatus() for article %d", articleId);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void Article::updateHeadline(QSqlDatabase &database, int id, QString headline, b
|
||||
query.bindValue(":id_article", id);
|
||||
|
||||
if ( !query.exec() )
|
||||
qDebug() << "updateHeadline() error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "updateHeadline() error: " << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ void Article::updateText(QSqlDatabase &database, int id, QString text)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "updateText() error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "updateText() error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "text is " << text;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ void Article::deleteArticle(QSqlDatabase &database)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ void Article::deleteArticle(QSqlDatabase &database)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ void Article::deleteArticle(QSqlDatabase &database)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ bool Article::updateArticle(QSqlDatabase &database, Publication &publication, QL
|
||||
|
||||
if(!queryMaster.exec())
|
||||
{
|
||||
qDebug() << "Sql Error (updateArticle): " << queryMaster.lastError().text().toAscii();
|
||||
qDebug() << "Sql Error (updateArticle): " << queryMaster.lastError().text().toLocal8Bit();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ int Article::clip(QSqlDatabase &database, Publication &publication, int created_
|
||||
|
||||
if(!queryMaster.exec())
|
||||
{
|
||||
qDebug() << queryMaster.lastQuery().toAscii();
|
||||
qDebug() << queryMaster.lastQuery().toLocal8Bit();
|
||||
//QMessageBox::critical(this, tr("SQL Error"), queryMaster.lastError().databaseText());
|
||||
return -1;
|
||||
}
|
||||
@@ -657,7 +657,7 @@ void Article::getSize(Publication &publication, qreal image_size, qreal &size_l,
|
||||
|
||||
//tmpsize += (size_w * size_l);
|
||||
qreal tmpsize = (width * height) / image_size;
|
||||
//qDebug() << cutoutsList[i]->pageName().toAscii();
|
||||
//qDebug() << cutoutsList[i]->pageName().toLocal8Bit();
|
||||
//qDebug("\t%.2f", tmpsize);
|
||||
|
||||
if(!tmpCount.contains(cutoutsList[i]->pageName()) )
|
||||
@@ -760,7 +760,7 @@ void Article::setCippingCoordinates(QSqlDatabase &database, int id_article, QLis
|
||||
|
||||
if (!query.exec())
|
||||
{
|
||||
qDebug() << "Error (clipping coordinates): "<< query.lastError().databaseText().toAscii();
|
||||
qDebug() << "Error (clipping coordinates): "<< query.lastError().databaseText().toLocal8Bit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef AUTHENTICATIONDIALOG_H
|
||||
#define AUTHENTICATIONDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AuthenticationDialog;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <QtConcurrentRun>
|
||||
#include <QMutex>
|
||||
#include <QDesktopServices>
|
||||
#include <QScreen>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cstdio>
|
||||
using namespace std;
|
||||
@@ -49,7 +51,7 @@ It should be handled, not handled yet!
|
||||
|
||||
*/
|
||||
|
||||
QMutex mutex;
|
||||
QMutex g_clipMutex;
|
||||
|
||||
QString ClippingStation::m_cacheDir;
|
||||
QString ClippingStation::m_address;
|
||||
@@ -805,7 +807,7 @@ void ClippingStation::onActionSendPageToOCR()
|
||||
|
||||
QString pageName = index .data(Qt::DisplayRole).toString();
|
||||
//convert pageName from Page # to ####.jpg
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegExp("[^\\d]")), 4, QChar('0'));
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegularExpression("[^\\d]")), 4, QChar('0'));
|
||||
|
||||
QString sectionName = model->parent(index) .data(Qt::DisplayRole).toString();
|
||||
QString issueDate = model->parent(index).parent().data(Qt::DisplayRole).toString();
|
||||
@@ -1016,7 +1018,7 @@ void ClippingStation::onActionViewPageText()
|
||||
QModelIndex index = list[0];
|
||||
|
||||
QString pageName = index .data(Qt::DisplayRole).toString();
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegExp("[^\\d]")), 4, QChar('0'));
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegularExpression("[^\\d]")), 4, QChar('0'));
|
||||
|
||||
QString sectionName = model->parent(index) .data(Qt::DisplayRole).toString();
|
||||
QString issueDate = model->parent(index).parent().data(Qt::DisplayRole).toString();
|
||||
@@ -1123,7 +1125,7 @@ void ClippingStation::onActionGoToKeywordWikiPage()
|
||||
|
||||
QString keyword = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
keyword.replace(QRegExp("\\s"), "_");
|
||||
keyword.replace(QRegularExpression("\\s"), "_");
|
||||
keyword.replace(' ', '_');
|
||||
// keyword.replace("'", "_");
|
||||
// keyword.replace("-", "_");
|
||||
@@ -1208,7 +1210,7 @@ void ClippingStation::loadIssuesWithPreclipsOnly()
|
||||
//load the first pre-clip
|
||||
QAbstractItemModel *model = ui->clipsTreeView->model();
|
||||
QModelIndex preclipRootIndex = model->index(0, 0, QModelIndex() );
|
||||
QModelIndex pindex = preclipRootIndex.child(0, 0);
|
||||
QModelIndex pindex = model->index(0, 0, preclipRootIndex);
|
||||
if(pindex.isValid())
|
||||
articleTreeViewClicked(pindex);
|
||||
}
|
||||
@@ -1291,7 +1293,7 @@ void ClippingStation::loadUndoneIssuesOnly()
|
||||
//load the first pre-clip
|
||||
QAbstractItemModel *model = ui->clipsTreeView->model();
|
||||
QModelIndex preclipRootIndex = model->index(0, 0, QModelIndex() );
|
||||
QModelIndex pindex = preclipRootIndex.child(0, 0);
|
||||
QModelIndex pindex = model->index(0, 0, preclipRootIndex);
|
||||
if(pindex.isValid())
|
||||
articleTreeViewClicked(pindex);
|
||||
}
|
||||
@@ -1322,7 +1324,7 @@ void ClippingStation::issueTreeViewItemClicked(QModelIndex index)
|
||||
m_publication.loadIssueSections(issueItem, issueDate, m_cacheDir);
|
||||
}
|
||||
|
||||
QString sectionName = model->data(index.child(0,0), Qt::DisplayRole).toString();
|
||||
QString sectionName = model->data(model->index(0, 0, index), Qt::DisplayRole).toString();
|
||||
|
||||
if( m_currentIssueDate != issueDate)
|
||||
ui->fullpageView->removeImageCutouts();
|
||||
@@ -1470,7 +1472,7 @@ void ClippingStation::articleTreeViewClicked(QModelIndex index)
|
||||
if(index.parent() == preclipRootIndex)
|
||||
{
|
||||
id = model->index(index.row(), 1, index.parent() ).data(Qt::DisplayRole).toInt();
|
||||
currentIndex = index.child(0, 0);
|
||||
currentIndex = model->index(0, 0, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1559,7 +1561,7 @@ void ClippingStation::articleTreeViewClicked(QModelIndex index)
|
||||
if(index.parent() == clipRootIndex)
|
||||
{
|
||||
id = model->index(index.row(), 1, index.parent() ).data(Qt::DisplayRole).toInt();
|
||||
currentIndex = index.child(0, 0);
|
||||
currentIndex = model->index(0, 0, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1846,7 +1848,7 @@ void ClippingStation::saveImageRotation()
|
||||
//do the roation
|
||||
double rotate = ui->rotateSpinBox->value();
|
||||
|
||||
QMatrix mx;
|
||||
QTransform mx;
|
||||
mx = mx.rotate(rotate);
|
||||
image = image.transformed(mx, Qt::SmoothTransformation);
|
||||
|
||||
@@ -2183,7 +2185,7 @@ bool ClippingStation::recursiveDelete(const QDir &dir)
|
||||
if(finfo.isDir() )
|
||||
{
|
||||
QDir subDir(finfo.absoluteFilePath());
|
||||
qDebug() << "SubDir: " << subDir.absolutePath().toAscii();
|
||||
qDebug() << "SubDir: " << subDir.absolutePath().toLocal8Bit();
|
||||
QDir dir1 = dir;
|
||||
|
||||
if ( recursiveDelete(subDir) )
|
||||
@@ -2191,7 +2193,7 @@ bool ClippingStation::recursiveDelete(const QDir &dir)
|
||||
dir1.cdUp();
|
||||
if ( !dir1.rmdir(finfo.absoluteFilePath() ) )
|
||||
{
|
||||
qDebug() << "Error deleting directory: " << finfo.absoluteFilePath().toAscii();
|
||||
qDebug() << "Error deleting directory: " << finfo.absoluteFilePath().toLocal8Bit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2450,12 +2452,12 @@ void ClippingStation::clip()
|
||||
|
||||
if(m_useFtp)
|
||||
{
|
||||
QFuture<bool> future = QtConcurrent::run(&saveClipImagesToFtpServer, m_currentIssueDate, m_currentPreclipId, list, true, m_masterDatabase);
|
||||
QFuture<bool> future = QtConcurrent::run([=]() mutable { return saveClipImagesToFtpServer(m_currentIssueDate, m_currentPreclipId, list, true, m_masterDatabase); });
|
||||
m_saveClipImagesToFtpServerWatcher.setFuture(future);
|
||||
}
|
||||
else
|
||||
{
|
||||
QFuture<int> future = QtConcurrent::run(&saveClipImagesToFileServer, m_currentIssueDate, m_currentPreclipId, list);
|
||||
QFuture<int> future = QtConcurrent::run([=]() mutable { return saveClipImagesToFileServer(m_currentIssueDate, m_currentPreclipId, list); });
|
||||
m_saveClipImagesToFileServerWatcher.setFuture(future); //ret = saveClipImagesToFileServer(m_currentPreclipId, list); //save the clip images in the clip directories
|
||||
//ret = saveClipImagesToFileServer(m_currentIssueDate, m_currentPreclipId, list, true, m_masterDatabase);
|
||||
}
|
||||
@@ -2464,7 +2466,7 @@ void ClippingStation::clip()
|
||||
{
|
||||
qDebug() << m_publication.name() << " not skip OCR, Insert to db";
|
||||
bool isArabic = (m_publication.language() == "Arabic");
|
||||
QFuture<bool> future2 = QtConcurrent::run(&addTextToClip, m_currentPreclipId, cutoutsList, db, isArabic);
|
||||
QFuture<bool> future2 = QtConcurrent::run([=]() mutable { return addTextToClip(m_currentPreclipId, cutoutsList, db, isArabic); });
|
||||
m_addTextToClipWatcher.setFuture(future2);
|
||||
}
|
||||
else
|
||||
@@ -2504,12 +2506,12 @@ void ClippingStation::clip()
|
||||
bool ret = true;
|
||||
if(m_useFtp)
|
||||
{
|
||||
QFuture<bool> future = QtConcurrent::run(&saveClipImagesToFtpServer, m_currentIssueDate, id_article, list, false, m_masterDatabase);
|
||||
QFuture<bool> future = QtConcurrent::run([=]() mutable { return saveClipImagesToFtpServer(m_currentIssueDate, id_article, list, false, m_masterDatabase); });
|
||||
m_saveClipImagesToFtpServerWatcher.setFuture(future);
|
||||
}
|
||||
else
|
||||
{
|
||||
QFuture<int> future = QtConcurrent::run(&saveClipImagesToFileServer, m_currentIssueDate, id_article, list);
|
||||
QFuture<int> future = QtConcurrent::run([=]() mutable { return saveClipImagesToFileServer(m_currentIssueDate, id_article, list); });
|
||||
m_saveClipImagesToFileServerWatcher.setFuture(future); //ret = saveClipImagesToFileServer(m_currentPreclipId, list); //save the clip images in the clip directories
|
||||
//ret = saveClipImagesToFileServer(m_currentIssueDate, id_article, list, true, m_masterDatabase);
|
||||
}
|
||||
@@ -2520,7 +2522,7 @@ void ClippingStation::clip()
|
||||
//QSqlDatabase db = m_masterDatabase.cloneDatabase(m_masterDatabase, "master2222");
|
||||
//db.open();
|
||||
bool isArabic = (m_publication.language() == "Arabic");
|
||||
QFuture<bool> future2 = QtConcurrent::run(&addTextToClip, id_article, cutoutsList, db, isArabic);
|
||||
QFuture<bool> future2 = QtConcurrent::run([=]() mutable { return addTextToClip(id_article, cutoutsList, db, isArabic); });
|
||||
m_addTextToClipWatcher.setFuture(future2);
|
||||
}
|
||||
else
|
||||
@@ -2563,7 +2565,7 @@ void ClippingStation::clip()
|
||||
QModelIndex preclipRootIndex = model->index(0, 0, QModelIndex() );
|
||||
//if(preclipRootIndex.model()->children().count() > 0)
|
||||
{
|
||||
QModelIndex pindex = preclipRootIndex.child(0, 0);
|
||||
QModelIndex pindex = model->index(0, 0, preclipRootIndex);
|
||||
if(pindex.isValid())
|
||||
articleTreeViewClicked(pindex);
|
||||
else
|
||||
@@ -2719,7 +2721,7 @@ QList<QImage> ClippingStation::createClipImages()
|
||||
|
||||
int ClippingStation::saveClipImagesToFileServer(QString currentIssue, int id_article, QList<QImage> &list)
|
||||
{
|
||||
mutex.lock();
|
||||
g_clipMutex.lock();
|
||||
qDebug("saveClipImages() for article %d", id_article);
|
||||
//we save the images on this format ClippingsPath/YYYY/MM/DD/ID_ARTICLE-X
|
||||
|
||||
@@ -2741,7 +2743,7 @@ int ClippingStation::saveClipImagesToFileServer(QString currentIssue, int id_art
|
||||
{
|
||||
QMessageBox::critical(0, tr("saveClipImagesToFileServer() Error"), tr("Error creating directory structure for clippings!"));
|
||||
qDebug("saveClipImagesToFileServer(): Error creating directory ");
|
||||
mutex.unlock();
|
||||
g_clipMutex.unlock();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2760,7 +2762,7 @@ int ClippingStation::saveClipImagesToFileServer(QString currentIssue, int id_art
|
||||
{
|
||||
QMessageBox::critical(0, tr("saveClipImagesToFileServer() Error"), tr("Error creating directory structure for local clippings!"));
|
||||
qDebug("saveClipImagesToFileServer(): Error creating directory ");
|
||||
mutex.unlock();
|
||||
g_clipMutex.unlock();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2809,7 +2811,7 @@ int ClippingStation::saveClipImagesToFileServer(QString currentIssue, int id_art
|
||||
file.remove(localpath +fname); //remove it locally
|
||||
file.remove(path +fname); //and from file server
|
||||
}
|
||||
mutex.unlock();
|
||||
g_clipMutex.unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2866,14 +2868,14 @@ int ClippingStation::saveClipImagesToFileServer(QString currentIssue, int id_art
|
||||
Article::updateImagesNumber(m_clipDatabase, id_article, list.count());
|
||||
Article::updateStatus(m_clipDatabase, id_article, 2);
|
||||
qDebug("saveClipImages(): Everything is OK for article %d, updating the status =2 and images number = %d", id_article, list.count());
|
||||
mutex.unlock();
|
||||
g_clipMutex.unlock();
|
||||
return id_article;
|
||||
}
|
||||
|
||||
//if error happens, return to preclip, if pre-clip, or delete it from clipping
|
||||
Article::updateImagesNumber(m_clipDatabase, id_article, 0);
|
||||
qDebug("saveClipImages(): Error happend for article %d. roll back to original values", id_article);
|
||||
mutex.unlock();
|
||||
g_clipMutex.unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2902,10 +2904,10 @@ bool ClippingStation::saveClipImagesToFtpServer (QString ¤tIssue, int &id_
|
||||
|
||||
if( list[i].save(tmpfilename, "jpg", 100) )
|
||||
{
|
||||
ret = upload(curlhandle, filename.toAscii(), tmpfilename.toAscii(), 0, 3, str);
|
||||
ret = upload(curlhandle, filename.toLocal8Bit(), tmpfilename.toLocal8Bit(), 0, 3, str);
|
||||
if(!ret)
|
||||
{
|
||||
qDebug() << "saveClipImagesToFtpServer(): Error uploading image " << filename.toAscii() << ": " << str;
|
||||
qDebug() << "saveClipImagesToFtpServer(): Error uploading image " << filename.toLocal8Bit() << ": " << str;
|
||||
QFile::remove(tmpfilename);
|
||||
saveClipImagesToFtpServerErrorMsg = str;
|
||||
ret = false;
|
||||
@@ -2928,10 +2930,10 @@ bool ClippingStation::saveClipImagesToFtpServer (QString ¤tIssue, int &id_
|
||||
|
||||
if( m_thumbnail.save(tmpfilename, "jpg", 100) )
|
||||
{
|
||||
ret = upload(curlhandle, filename.toAscii(), tmpfilename.toAscii(), 0, 3, str);
|
||||
ret = upload(curlhandle, filename.toLocal8Bit(), tmpfilename.toLocal8Bit(), 0, 3, str);
|
||||
if(!ret)
|
||||
{
|
||||
qDebug() << "saveClipImagesToFtpServer(): Error uploading image " << filename.toAscii() << ": " << str;
|
||||
qDebug() << "saveClipImagesToFtpServer(): Error uploading image " << filename.toLocal8Bit() << ": " << str;
|
||||
QFile::remove(tmpfilename);
|
||||
saveClipImagesToFtpServerErrorMsg = str;
|
||||
//ret = false;
|
||||
@@ -3223,9 +3225,9 @@ void ClippingStation::loadClippingImages(int clipid)
|
||||
if(m_useFtp)
|
||||
{
|
||||
QString file = path+ tmpfilename;
|
||||
if (!download(curlhandle, file.toAscii(), tmpfilename.toAscii(), 0, 3, str))
|
||||
if (!download(curlhandle, file.toLocal8Bit(), tmpfilename.toLocal8Bit(), 0, 3, str))
|
||||
{
|
||||
qDebug() << "loadClippingImages(): Error loading image " << file.toAscii() << ": " << str;
|
||||
qDebug() << "loadClippingImages(): Error loading image " << file.toLocal8Bit() << ": " << str;
|
||||
QMessageBox::critical(this, "error loading clip", QString("Ftp Error (%1) : %2").arg(file).arg(str) );
|
||||
}
|
||||
else
|
||||
@@ -3280,7 +3282,7 @@ void ClippingStation::orderCutoutsSelections()
|
||||
|
||||
void ClippingStation::addMargintoPos(QPointF &pos, bool isfirst)
|
||||
{
|
||||
int dpi = QApplication::desktop()->logicalDpiX();
|
||||
int dpi = QApplication::primaryScreen()->logicalDotsPerInchX();
|
||||
|
||||
MarginValues mv;
|
||||
if(isfirst)
|
||||
@@ -3306,14 +3308,14 @@ void ClippingStation::orderList(QList<ImageCutout*> &cutouts)
|
||||
min = j;
|
||||
}
|
||||
if(min != i)
|
||||
cutouts.swap(i, min);
|
||||
cutouts.swapItemsAt(i, min);
|
||||
}
|
||||
}
|
||||
|
||||
QSizeF ClippingStation::A4CellSize(bool isfirst)
|
||||
{
|
||||
// we compute pixels dimensions for the page.
|
||||
int dpi = QApplication::desktop()->logicalDpiX();
|
||||
int dpi = QApplication::primaryScreen()->logicalDotsPerInchX();
|
||||
qreal pageWidth = dpi * A4_WIDTH;
|
||||
qreal pageHeight = dpi * A4_HEIGHT;
|
||||
|
||||
@@ -3450,7 +3452,7 @@ bool ClippingStation::calculatePosAndScale(QSizeF cellSize, QImage &img, int typ
|
||||
QString str;
|
||||
for(int j=0; j< 20; j++)
|
||||
str += QString("%1").arg(cells[i][j]) + " ";
|
||||
qDebug() << str.toAscii();
|
||||
qDebug() << str.toLocal8Bit();
|
||||
}
|
||||
qDebug("*****************************************************");
|
||||
*/
|
||||
@@ -3540,7 +3542,7 @@ bool ClippingStation::calculatePosAndScale(QSizeF cellSize, QImage &img, int typ
|
||||
QString str;
|
||||
for(int j=0; j< 20; j++)
|
||||
str += QString("%1").arg(cells[i][j]) + " ";
|
||||
qDebug() << str.toAscii();
|
||||
qDebug() << str.toLocal8Bit();
|
||||
}
|
||||
qDebug("*****************************************************");
|
||||
*/
|
||||
@@ -3591,7 +3593,7 @@ bool ClippingStation::isImageLocked(QString image, int &lockedBy)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "isImageLocked() SQL query Error :" << query.lastError().databaseText().toAscii();
|
||||
qDebug() << "isImageLocked() SQL query Error :" << query.lastError().databaseText().toLocal8Bit();
|
||||
qDebug("%d\t%d\t%d", id_publication, id_issue, id_section);
|
||||
qDebug() << page_name;
|
||||
ret = query.exec("UNLOCK TABLES");
|
||||
@@ -3702,7 +3704,7 @@ int ClippingStation::getImageId(const QString name)
|
||||
|
||||
if ( !query2.exec() )
|
||||
{
|
||||
qDebug() << "Error in slave db query " << query2.lastQuery().toAscii();
|
||||
qDebug() << "Error in slave db query " << query2.lastQuery().toLocal8Bit();
|
||||
qDebug() << "Error is " << query2.lastError().text();
|
||||
return -1;
|
||||
}
|
||||
@@ -3727,7 +3729,7 @@ void ClippingStation::loadImageHighlights(int imageId)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "Error in ocr db query " << query.lastQuery().toAscii();
|
||||
qDebug() << "Error in ocr db query " << query.lastQuery().toLocal8Bit();
|
||||
qDebug() << "Error is " << query.lastError().text();
|
||||
return;
|
||||
}
|
||||
@@ -3768,7 +3770,7 @@ void ClippingStation::loadImageHighlights(int imageId)
|
||||
tagH.append(t);
|
||||
}
|
||||
|
||||
qDebug() << "End get info from page_tag_coordinates" << endl;
|
||||
qDebug() << "End get info from page_tag_coordinates" << Qt::endl;
|
||||
|
||||
//QTimer::singleShot(100, this, SLOT(addRelatedKeywordsToTag(tagH)));
|
||||
|
||||
@@ -3871,7 +3873,7 @@ QList<WordCoordinates> ClippingStation::loadImageText(QString page, QSqlDatabase
|
||||
|
||||
if (!query.exec())
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
return tagW;
|
||||
}
|
||||
|
||||
@@ -3890,7 +3892,7 @@ QList<WordCoordinates> ClippingStation::loadImageText(QString page, QSqlDatabase
|
||||
|
||||
if ( !query2.exec() )
|
||||
{
|
||||
qDebug() << query2.lastError().text().toAscii();
|
||||
qDebug() << query2.lastError().text().toLocal8Bit();
|
||||
return tagW;
|
||||
}
|
||||
|
||||
@@ -3973,7 +3975,7 @@ void ClippingStation::updateSectionPagesStatus()
|
||||
for(int k=0; k< pagesCount; k++)
|
||||
{
|
||||
QString pageName = model->index(k, 0, sectionIndex).data(Qt::DisplayRole).toString();
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegExp("[^\\d]")), 4, QChar('0'));
|
||||
pageName = QString("%1.jpg").arg(pageName.remove(QRegularExpression("[^\\d]")), 4, QChar('0'));
|
||||
|
||||
QModelIndex pageIndex = model->index(k, 0, sectionIndex);
|
||||
if( hash.find(pageName) != hash.end() )
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
#ifndef CLIPPINGSTATION_H
|
||||
#define CLIPPINGSTATION_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
#include <QtSql>
|
||||
#include <QMainWindow>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "user.h"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QPrinter>
|
||||
#include <QImage>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
@@ -87,7 +87,7 @@ QImage DrawerScene::screenShot()
|
||||
m_pageItem->hideMargins();
|
||||
m_pageItem->unselectItems();
|
||||
|
||||
int dpi = QApplication::desktop()->logicalDpiX();
|
||||
int dpi = QApplication::primaryScreen()->logicalDotsPerInchX();
|
||||
int w = static_cast<int> (dpi * A4_WIDTH);
|
||||
int h = static_cast<int> (dpi * A4_HEIGHT);
|
||||
//int w = 827;
|
||||
@@ -101,7 +101,7 @@ QImage DrawerScene::screenShot()
|
||||
setBackgroundBrush(Qt::white);
|
||||
painter.setBackgroundMode(Qt::TransparentMode);
|
||||
painter.setBackground(Qt::white);
|
||||
painter.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
//QRect rec = m_pageItem->boundingRect().toRect();
|
||||
//rec.setX(rec.x() - 20);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef DROPPEDITEMZOOMDIALOG_H
|
||||
#define DROPPEDITEMZOOMDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
|
||||
#include "droppeditem.h"
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ void FullPageScene::addTagCoordinates(QList<TagCoordinates> &tagH)
|
||||
pt2 += m_imageItem->pos();
|
||||
|
||||
QRectF rec(pt1, pt2);
|
||||
QGraphicsRectItem *rect = new QGraphicsRectItem(rec, 0, this);
|
||||
QGraphicsRectItem *rect = new QGraphicsRectItem(rec);
|
||||
rect->setZValue(1.1);
|
||||
rect->setPen(QPen( Qt::NoPen ) );
|
||||
rect->setBrush( brush );
|
||||
@@ -271,7 +271,7 @@ bool FullPageScene::isPointIsOnImageCutoutItem(const QPointF & point)
|
||||
|
||||
foreach (ImageCutout* rec, m_imageCutoutsList)
|
||||
{
|
||||
if( itemAt(point) == rec)
|
||||
if( itemAt(point, QTransform()) == rec)
|
||||
{
|
||||
m_currentImageCutout = rec;
|
||||
return true;
|
||||
@@ -397,7 +397,7 @@ QImage FullPageScene::screenShot()
|
||||
QImage image(w, h, QImage::Format_ARGB32 );
|
||||
|
||||
QPainter painter(&image);
|
||||
painter.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
foreach (ImageCutout *rect, m_imageCutoutsList)
|
||||
rect->setScreenshot(true);
|
||||
|
||||
@@ -167,23 +167,27 @@ int download(CURL* curlhandle, const char * remotepath, const char * localpath,
|
||||
}
|
||||
|
||||
|
||||
void MyOutputHandler(QtMsgType type, const char *msg) {
|
||||
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
|
||||
Q_UNUSED(context)
|
||||
if(!g_debug)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Debug: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Debug: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Critical: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Critical: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
//g_logfile << QTime::currentTime().toString().toAscii().data() << " Warning: \t" << msg << "\n";
|
||||
//g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Warning: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Fatal: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Fatal: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
abort();
|
||||
case QtInfoMsg:
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Info: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
g_logfile.flush();
|
||||
|
||||
@@ -107,6 +107,6 @@ int download(CURL* curlhandle, const char * remoepath, const char * localpath,
|
||||
long timeout, long tries, char * strerror);
|
||||
|
||||
|
||||
void MyOutputHandler(QtMsgType type, const char *msg);
|
||||
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||
|
||||
#endif // GLOBALFUNCTIONS_H
|
||||
|
||||
@@ -82,7 +82,7 @@ bool ImageCachingDialog::createCacheDirectory(QString dstPath)
|
||||
bool ImageCachingDialog::recursiveDelete(const QDir &dir)
|
||||
{
|
||||
QString abspath = dir.absolutePath();
|
||||
qDebug() <<abspath.toAscii();
|
||||
qDebug() <<abspath.toLocal8Bit();
|
||||
|
||||
//QList<QFileInfo> infLst = dir.entryInfoList(QStringList("*.jpg"), QDir::NoSymLinks);
|
||||
QStringList flist = dir.entryList(QStringList("*.jpg"), QDir::NoSymLinks | QDir::Files );
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef IMAGECACHINGDIALOG_H
|
||||
#define IMAGECACHINGDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include <QKeyEvent>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void ImageCachingThread::run()
|
||||
while( !m_imageCacheDlg.m_resume )
|
||||
return;
|
||||
|
||||
//qDebug() << "Copying " << m_srcFiles[i].toAscii();
|
||||
//qDebug() << "Copying " << m_srcFiles[i].toLocal8Bit();
|
||||
|
||||
if (m_imageCacheDlg.m_cachedImages[ m_dstPath+m_dstFiles[i] ] )
|
||||
{
|
||||
@@ -92,7 +92,7 @@ bool ImageCachingThread::cacheFromFtpServer(QString srcPage, QString dstPage)
|
||||
|
||||
char strerror[256];
|
||||
|
||||
bool ret = download(curlhandle, srcPage.toAscii(), dstPage.toAscii(), 0, 1, strerror);
|
||||
bool ret = download(curlhandle, srcPage.toLocal8Bit(), dstPage.toLocal8Bit(), 0, 1, strerror);
|
||||
|
||||
curl_easy_cleanup(curlhandle);
|
||||
curl_global_cleanup();
|
||||
|
||||
@@ -211,7 +211,7 @@ QImage ImageCutout::createCutout() const
|
||||
{
|
||||
// after calculating the pixmap, we rotate it if needed
|
||||
QImage image = px.toImage();
|
||||
QMatrix mx;
|
||||
QTransform mx;
|
||||
mx = mx.rotate(m_rotationAngle);
|
||||
// mx = mx.scale(.5, .5); //dont do this
|
||||
image = image.transformed(mx);
|
||||
|
||||
@@ -171,7 +171,7 @@ void ImporterThread::upload()
|
||||
|
||||
//do the actual upload process
|
||||
//first we upload the 96 dpi, then we upload the 300 dpi
|
||||
if (!::upload(curlhandle, QString(m_dstPath + m_dstFiles[i]).toAscii(), image96DpiFilePath.toAscii(), 0, 1, strerror))
|
||||
if (!::upload(curlhandle, QString(m_dstPath + m_dstFiles[i]).toLocal8Bit(), image96DpiFilePath.toLocal8Bit(), 0, 1, strerror))
|
||||
{
|
||||
//if error happens, then set the apropriate values for the calling object, and exit the thread
|
||||
QString errMsg(strerror);
|
||||
@@ -188,7 +188,7 @@ void ImporterThread::upload()
|
||||
QFileInfo f2(QString(m_srcPath + m_srcFiles[i])); //get the current files size
|
||||
m_dlg.m_currentFileSize = f2.size();
|
||||
|
||||
if (!::upload(curlhandle, QString(m_dstPath + m_dstFiles[i]).toAscii(), QString(m_srcPath + m_srcFiles[i]).toAscii(), 0, 1, strerror))
|
||||
if (!::upload(curlhandle, QString(m_dstPath + m_dstFiles[i]).toLocal8Bit(), QString(m_srcPath + m_srcFiles[i]).toLocal8Bit(), 0, 1, strerror))
|
||||
{
|
||||
//if error happens, then set the apropriate values for the calling object, and exit the thread
|
||||
QString errMsg(strerror);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "issue.h"
|
||||
#include "imagecutout.h"
|
||||
#include <QRegularExpression>
|
||||
|
||||
Issue::Issue(int id, QString date, int publication_id) : m_id(id)
|
||||
, m_date(date), m_publicationId(publication_id)
|
||||
@@ -403,7 +404,7 @@ void Issue::addImageCutoutsToSections(QSqlDatabase &database, QStandardItem *iss
|
||||
QModelIndex pageIndex = model->index(k, 0, sectionIndex);
|
||||
QStandardItem *pageItem = model->itemFromIndex(pageIndex);
|
||||
QString pagename = pageIndex.data(Qt::DisplayRole).toString();
|
||||
pagename = QString("%1.jpg").arg(pagename.remove(QRegExp("[^\\d]")), 4, QChar('0'));
|
||||
pagename = QString("%1.jpg").arg(pagename.remove(QRegularExpression("[^\\d]")), 4, QChar('0'));
|
||||
|
||||
pageItem->removeRows(0, pageItem->rowCount() );
|
||||
|
||||
@@ -569,7 +570,7 @@ void Issue::markIssueAsDone(QSqlDatabase &database, bool isDone, int userId)
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "markIssueAsDone() SQL Error: " << query.lastError().databaseText().toAscii();
|
||||
qDebug() << "markIssueAsDone() SQL Error: " << query.lastError().databaseText().toLocal8Bit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QApplication>
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include "globalfunctions.h"
|
||||
@@ -25,11 +25,10 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication::setGraphicsSystem("raster");
|
||||
QApplication a(argc, argv);
|
||||
|
||||
//g_logfile.open("clippingstation.log", ios::app);
|
||||
qInstallMsgHandler(MyOutputHandler);
|
||||
qInstallMessageHandler(MyOutputHandler);
|
||||
|
||||
ClippingStation w;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <QBrush>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include <QGraphicsSceneDragDropEvent>
|
||||
#include <QMimeData>
|
||||
#include <QGraphicsScene>
|
||||
@@ -42,7 +42,7 @@ PageItem::PageItem(const QString & paperFormat, bool isfirst) :
|
||||
return; // error ! by now we don't support others page format !
|
||||
|
||||
// we compute pixels dimensions for the page.
|
||||
int dpi = QApplication::desktop()->logicalDpiX();
|
||||
int dpi = QApplication::primaryScreen()->logicalDotsPerInchX();
|
||||
m_pageWidth = dpi * A4_WIDTH;
|
||||
m_pageHeight = dpi * A4_HEIGHT;
|
||||
|
||||
@@ -202,7 +202,7 @@ void PageItem::setPixmap(const QPixmap &pix)
|
||||
|
||||
int PageItem::cutoutsCount()
|
||||
{
|
||||
QList<QGraphicsItem*> list = this->children();
|
||||
QList<QGraphicsItem*> list = this->childItems();
|
||||
|
||||
int count = childItems().count() - 5; //5 is for the margin items
|
||||
if(m_isFirstPage)
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "pagemargin.h"
|
||||
|
||||
#include <QPen>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
#include <QGraphicsLineItem>
|
||||
|
||||
#include "constants.h"
|
||||
@@ -31,7 +31,7 @@ PageMargin::PageMargin(bool isfirst,QGraphicsRectItem * parent)
|
||||
: QGraphicsRectItem(parent)
|
||||
{
|
||||
// we compute pixels dimensions for the page.
|
||||
int dpi = QApplication::desktop()->logicalDpiX();
|
||||
int dpi = QApplication::primaryScreen()->logicalDotsPerInchX();
|
||||
qreal pageWidth = dpi * A4_WIDTH;
|
||||
qreal pageHeight = dpi * A4_HEIGHT;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef PAGETEXTDIALOG_H
|
||||
#define PAGETEXTDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class PageTextDialog;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef PROMINENCEDIALOG_H
|
||||
#define PROMINENCEDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
#include "prominence.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "issue.h"
|
||||
#include "constants.h"
|
||||
#include "systemconfiguration.h"
|
||||
#include <QElapsedTimer>
|
||||
|
||||
Publication::Publication()
|
||||
{
|
||||
@@ -165,7 +166,7 @@ void Publication::loadIssues(QTreeView *view, QString localcachDir)
|
||||
|
||||
query.bindValue(":id", m_id);
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
if(!query.exec())
|
||||
{
|
||||
@@ -310,13 +311,13 @@ void Publication::loadFilteredIssues(QTreeView *view, QSqlDatabase &ocrDatabase,
|
||||
else
|
||||
{
|
||||
qDebug() << "ocr query : " << ocr;
|
||||
qDebug() << "ocr query error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "ocr query error: " << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "id_company query : " << kywrd;
|
||||
qDebug() << "id_company query error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "id_company query error: " << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
ptcWhere = QString(" AND sp.section_pages IN (%1)").arg(section_pages.join(", "));
|
||||
}
|
||||
@@ -357,10 +358,10 @@ void Publication::loadFilteredIssues(QTreeView *view, QSqlDatabase &ocrDatabase,
|
||||
" group by name_publication_en, issue_date, name_article_section_en, page_name"
|
||||
" order by name_publication_en, issue_date, id_section, page_name;").arg(ocrTable).arg(ptcTable).arg(m_id).arg(ptcWhere).arg(parts);
|
||||
|
||||
qDebug() << "loadFilteredIssues() query is " << str.toAscii() ;
|
||||
qDebug() << "loadFilteredIssues() query is " << str.toLocal8Bit() ;
|
||||
QSqlQuery query(str, m_database);
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
if(!query.exec())
|
||||
{
|
||||
@@ -518,7 +519,7 @@ void Publication::loadIssuesOnly(QTreeView *view)
|
||||
|
||||
query.bindValue(":id", m_id);
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
if(!query.exec())
|
||||
{
|
||||
@@ -671,7 +672,7 @@ void Publication::loadUndoneIssuesOnly(QTreeView *view)
|
||||
|
||||
query.bindValue(":id", m_id);
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
if(!query.exec())
|
||||
{
|
||||
@@ -719,7 +720,7 @@ void Publication::loadIssueSections(QStandardItem *issueItem, QString issueDate,
|
||||
query.bindValue(":issue_date", issueDate);
|
||||
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
if(!query.exec())
|
||||
{
|
||||
@@ -766,7 +767,7 @@ QList<QStandardItem*> Publication::getFilenamesFromDatabase(int id_publication,
|
||||
QStringList &localFiles, QStringList &remoteFiles,
|
||||
QString &localIssuePath, QString &remoteIssuePath)
|
||||
{
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
|
||||
static QString issuesPath = SystemConfiguration::issuesPath();
|
||||
@@ -925,7 +926,7 @@ QStringList Publication::publicationsWithPreclips(QSqlDatabase &database)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
return QStringList();
|
||||
}
|
||||
@@ -1026,13 +1027,13 @@ QStringList Publication::publicationsFiltered(QSqlDatabase &database, QSqlDataba
|
||||
else
|
||||
{
|
||||
qDebug() << "ocr query : " << ocr;
|
||||
qDebug() << "ocr query error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "ocr query error: " << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "id_company query : " << kywrd;
|
||||
qDebug() << "id_company query error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "id_company query error: " << query.lastError().text().toLocal8Bit();
|
||||
}
|
||||
ptcWhere = QString(" AND sp.section_pages IN (%1)").arg(section_pages.join(", "));
|
||||
}
|
||||
@@ -1081,12 +1082,12 @@ QStringList Publication::publicationsFiltered(QSqlDatabase &database, QSqlDataba
|
||||
" group by name_publication_en"
|
||||
" order by name_publication_en").arg(ocrTable).arg(ptcWhere).arg(parts);
|
||||
|
||||
qDebug() << "publicationsFiltered query is \n" << str.toAscii() ;
|
||||
qDebug() << "publicationsFiltered query is \n" << str.toLocal8Bit() ;
|
||||
QSqlQuery query(str, database);
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -1111,7 +1112,7 @@ QStringList Publication::publicationsWithUndoneIssues(QSqlDatabase &database)
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "publicationsWithUndoneIssues() SQL Error: " << query.lastError().databaseText().toAscii();
|
||||
qDebug() << "publicationsWithUndoneIssues() SQL Error: " << query.lastError().databaseText().toLocal8Bit();
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef SEARCHPUBLICATIONLISTDIALOG_H
|
||||
#define SEARCHPUBLICATIONLISTDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SearchPublicationListDialog;
|
||||
|
||||
@@ -27,7 +27,7 @@ Section::Section(int id, QString name): m_id(id), m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Section::operator == (const Section §ion)
|
||||
bool Section::operator == (const Section §ion) const
|
||||
{
|
||||
return (this->m_name == section.m_name);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ QString Section::name()
|
||||
|
||||
void Section::setFiles(QStringList localFiles, QStringList remoteFiles)
|
||||
{
|
||||
// qDebug() << "Section name: " << m_name.toAscii();
|
||||
// qDebug() << "Section name: " << m_name.toLocal8Bit();
|
||||
m_localFiles = localFiles;
|
||||
m_remoteFiles= remoteFiles;
|
||||
}
|
||||
@@ -178,9 +178,9 @@ void Section::getFilesAndPaths(QStringList &imagesList, QString &filesRemotePath
|
||||
*/
|
||||
void Section::getLocalAndRemoteFiles(QStringList &localFiles, QStringList &remoteFiles)
|
||||
{
|
||||
//qDebug() << "Section name: " << m_name.toAscii();
|
||||
//qDebug() << "Section name: " << m_name.toLocal8Bit();
|
||||
localFiles = m_localFiles;
|
||||
remoteFiles= m_remoteFiles;
|
||||
//qDebug() << "filename: " << m_localFiles[0].toAscii();
|
||||
//qDebug() << "filename: " << m_localFiles[0].toLocal8Bit();
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
Section(int id, QString name); //QSqlDatabase masterDb, QSqlDatabase slaveDb);
|
||||
|
||||
|
||||
bool operator == (const Section §ion);
|
||||
bool operator == (const Section §ion) const;
|
||||
|
||||
//! \fn sectionNames()
|
||||
//! returns a list of sections in the database
|
||||
|
||||
+14
-14
@@ -41,7 +41,7 @@ Tag::Tag(int id, QString tag, QString arabicTag, int towrite, QString comment ,
|
||||
}
|
||||
|
||||
|
||||
bool Tag::operator == (const Tag& right)
|
||||
bool Tag::operator == (const Tag& right) const
|
||||
{
|
||||
return (m_id == right.m_id);
|
||||
}
|
||||
@@ -160,8 +160,8 @@ QList<Tag> Tag::searchTags(QSqlDatabase &database, QString &searchword)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "searchTags() SQL Error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toAscii();
|
||||
qDebug() << "searchTags() SQL Error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toLocal8Bit();
|
||||
return QList<Tag> ();
|
||||
}
|
||||
|
||||
@@ -198,15 +198,15 @@ QList<Tag> Tag::searchTags(QSqlDatabase &database, QList<int> &tagIds)
|
||||
|
||||
//ids += QString("%1").arg(tagIds[tagIds.count()-1]);
|
||||
|
||||
//qDebug() << "searchTags IDS " << ids.toAscii();
|
||||
//qDebug() << "searchTags IDS " << ids.toLocal8Bit();
|
||||
|
||||
query.prepare("SELECT id_company, name_company, desc_company, towrite FROM company WHERE id_company = :id");
|
||||
query.bindValue(":id", tagIds[i]);
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "searchTags() SQL Error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toAscii();
|
||||
qDebug() << "searchTags() SQL Error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toLocal8Bit();
|
||||
return QList<Tag> ();
|
||||
}
|
||||
|
||||
@@ -237,8 +237,8 @@ QString Tag::loadSearchwords(QSqlDatabase& database, QString keyword)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "loadSearchwords() SQL Error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toAscii();
|
||||
qDebug() << "loadSearchwords() SQL Error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toLocal8Bit();
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -260,12 +260,12 @@ QList<Tag> Tag::loadArticleTags(QSqlDatabase &database, int articleId)
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "Error: loadArticleTags() SQL Error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toAscii();
|
||||
qDebug() << "Error: loadArticleTags() SQL Error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toLocal8Bit();
|
||||
return QList<Tag> ();
|
||||
}
|
||||
|
||||
//qDebug() << query.executedQuery().toAscii();
|
||||
//qDebug() << query.executedQuery().toLocal8Bit();
|
||||
|
||||
QList<Tag> list;
|
||||
|
||||
@@ -302,7 +302,7 @@ void Tag::setArticleTags(QSqlDatabase &database, int articleId, QList<Tag> &tags
|
||||
|
||||
if(!query.exec() )
|
||||
{
|
||||
qDebug() << query.lastError().text().toAscii();
|
||||
qDebug() << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "\t...." << query.lastError().databaseText();
|
||||
}
|
||||
}
|
||||
@@ -334,8 +334,8 @@ void Tag::loadTagProminence(QSqlDatabase& database, QList<Tag>& tags, int articl
|
||||
|
||||
if ( !query.exec() )
|
||||
{
|
||||
qDebug() << "Error: loadTagProminence() SQL Error: " << query.lastError().text().toAscii();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toAscii();
|
||||
qDebug() << "Error: loadTagProminence() SQL Error: " << query.lastError().text().toLocal8Bit();
|
||||
qDebug() << "Executed Query: " << query.executedQuery().toLocal8Bit();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
//! \fn operator ==()
|
||||
//! comparison operator
|
||||
//! \author elzubeir
|
||||
bool operator == (const Tag& right);
|
||||
bool operator == (const Tag& right) const;
|
||||
|
||||
//! \fn id()
|
||||
//! \return string holding the tag id
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
#ifndef TAGSWRAPPER_H
|
||||
#define TAGSWRAPPER_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
#include <QtSql>
|
||||
#include <QTreeWidget>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "tag.h"
|
||||
|
||||
+16
-45
@@ -21,6 +21,7 @@
|
||||
#include <QtCore>
|
||||
#include <QtSql>
|
||||
#include <QMessageBox>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include "user.h"
|
||||
#include "authenticationdialog.h"
|
||||
@@ -147,7 +148,7 @@ void User::track(int pageId, int publicationId, int pubIssueId, int issueSecId,
|
||||
|
||||
bool User::isUpdate(int pageId)
|
||||
{
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
|
||||
QSqlQuery query(m_slaveDatabase);
|
||||
@@ -159,13 +160,8 @@ bool User::isUpdate(int pageId)
|
||||
{
|
||||
qDebug() << "isUpdate query error: " << query.lastError().text();
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,13 +171,8 @@ bool User::isUpdate(int pageId)
|
||||
|
||||
qDebug("isUpdate(): Time elapsed: %.6f s", t.elapsed()/1000.0 );
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
|
||||
if(ret)
|
||||
qDebug() << "isUpdate returned true";
|
||||
@@ -196,7 +187,7 @@ bool User::isUpdate(int pageId)
|
||||
|
||||
void User::updateTrack(int pageId, double seconds)
|
||||
{
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
|
||||
QSqlQuery query(m_masterDatabase);
|
||||
@@ -209,25 +200,15 @@ void User::updateTrack(int pageId, double seconds)
|
||||
{
|
||||
qDebug() << "updateTrack query error: " << query.lastError().text();
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("updateTrack(): Time elapsed: %.6f s", t.elapsed()/1000.0 );
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
qDebug() << "end of updateTrack()";
|
||||
|
||||
}
|
||||
@@ -252,7 +233,7 @@ void User::insertTrack(int pageId, int publicationId, int pubIssueId, int issueS
|
||||
------------------------
|
||||
*/
|
||||
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
|
||||
QSqlQuery query(m_masterDatabase);
|
||||
@@ -276,23 +257,13 @@ void User::insertTrack(int pageId, int publicationId, int pubIssueId, int issueS
|
||||
{
|
||||
qDebug() << "insertTrack query error: " << query.lastError().text();
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
return;
|
||||
}
|
||||
qDebug("insertTrack(): Time elapsed: %.6f s", t.elapsed()/1000.0 );
|
||||
qDebug() << "query: " << query.lastQuery();
|
||||
QMapIterator<QString, QVariant> i(query.boundValues());
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
qDebug() << i.key().toAscii().data() << ": "
|
||||
<< i.value().toString().toAscii().data() << endl;
|
||||
}
|
||||
// Note: query.boundValues() API changed in Qt 6
|
||||
// qDebug() << "Bound values: " << query.boundValues();
|
||||
qDebug() << "end of insertTrack()";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user