From 4b6ae6bba4b999355afd902ef77c51902f095d0d Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Tue, 24 Sep 2013 21:14:58 +0000 Subject: [PATCH] Now the application compiles for QT5. Note that the location of the database in Linux has changed from ~/.local/share/data/Toastfreeware/ConfClerk to ~/.local/share/Toastfreeware/ConfClerk --- src/app/app.pro | 2 +- src/gui/eventdialog.cpp | 6 +++--- src/gui/gui.pro | 6 +++++- src/gui/mainwindow.h | 2 +- src/gui/searchhead.h | 2 +- src/mvc/conferencemodel.h | 3 ++- src/mvc/delegate.cpp | 2 +- src/mvc/delegate.h | 2 +- src/mvc/eventmodel.cpp | 12 +++++++----- src/mvc/mvc.pro | 3 ++- src/sql/sqlengine.cpp | 4 ++-- 11 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/app/app.pro b/src/app/app.pro index 57cd46f..80baf93 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -2,7 +2,7 @@ include(../global.pri) TEMPLATE = app TARGET = confclerk DESTDIR = ../bin -QT += sql xml network +QT += sql xml network widgets CONFIG(maemo5) { QT += maemo5 } diff --git a/src/gui/eventdialog.cpp b/src/gui/eventdialog.cpp index 6b51733..4094d74 100644 --- a/src/gui/eventdialog.cpp +++ b/src/gui/eventdialog.cpp @@ -38,12 +38,12 @@ EventDialog::EventDialog(int conferenceId, int eventId, QWidget *parent): QDialo QString info; // title - info.append(QString("

%1

\n").arg(Qt::escape(event.title()))); + info.append(QString("

%1

\n").arg(event.title().toHtmlEscaped())); // persons info += QString("

%1

\n").arg(tr("Persons")); QStringList persons = event.persons(); - for (int i = 0; i != persons.size(); ++i) persons[i] = Qt::escape(persons[i]); + for (int i = 0; i != persons.size(); ++i) persons[i] = persons[i].toHtmlEscaped(); info += QString("

%1

\n").arg(persons.join(", ")); // abstract @@ -63,7 +63,7 @@ EventDialog::EventDialog(int conferenceId, int eventId, QWidget *parent): QDialo QString name(i.key()); if (url.isEmpty() || url == "http://") continue; if (name.isEmpty()) name = url; - info += QString("
  • %2
  • \n").arg(Qt::escape(url), Qt::escape(name)); + info += QString("
  • %2
  • \n").arg(url.toHtmlEscaped(), name.toHtmlEscaped()); } info += QString("\n"); eventInfoTextBrowser->setHtml(info); diff --git a/src/gui/gui.pro b/src/gui/gui.pro index f9f7028..efffb45 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -5,7 +5,8 @@ DESTDIR = ../bin CONFIG += static QT += sql \ xml \ - network + network \ + widgets QMAKE_CLEAN += ../bin/libgui.a # module dependencies @@ -86,3 +87,6 @@ CONFIG(maemo5) { QT += maemo5 } +OTHER_FILES += \ + test.qml + diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 488dede..338a7a3 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -20,7 +20,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include #include "ui_mainwindow.h" diff --git a/src/gui/searchhead.h b/src/gui/searchhead.h index 5afacbf..155e3ea 100644 --- a/src/gui/searchhead.h +++ b/src/gui/searchhead.h @@ -20,7 +20,7 @@ #ifndef SEARCHHEAD_H #define SEARCHHEAD_H -#include +#include #include #include "ui_searchhead.h" diff --git a/src/mvc/conferencemodel.h b/src/mvc/conferencemodel.h index fe0f242..37cff64 100644 --- a/src/mvc/conferencemodel.h +++ b/src/mvc/conferencemodel.h @@ -52,8 +52,9 @@ private: // reinitialize list from database void reinit() { + beginResetModel(); conferences = Conference::getAll(); - reset(); + endResetModel(); } QList conferences; diff --git a/src/mvc/delegate.cpp b/src/mvc/delegate.cpp index 5551be3..843720a 100644 --- a/src/mvc/delegate.cpp +++ b/src/mvc/delegate.cpp @@ -214,7 +214,7 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, cons option.rect.x()+SPACER, option.rect.y()+option.rect.height()-fmBig.descent()); painter->setFont(fontBig); - painter->drawText(titlePointF,qVariantValue(index.data())); + painter->drawText(titlePointF,index.data().value()); } painter->restore(); diff --git a/src/mvc/delegate.h b/src/mvc/delegate.h index e4f2549..e0f60c4 100644 --- a/src/mvc/delegate.h +++ b/src/mvc/delegate.h @@ -20,7 +20,7 @@ #ifndef DELEGATE_H #define DELEGATE_H -#include +#include class Delegate : public QItemDelegate { diff --git a/src/mvc/eventmodel.cpp b/src/mvc/eventmodel.cpp index 139d330..6b8d47b 100644 --- a/src/mvc/eventmodel.cpp +++ b/src/mvc/eventmodel.cpp @@ -44,6 +44,8 @@ void EventModel::Group::setTitle(const QList& mEvents) { // multiple of one hour. void EventModel::createTimeGroups() { + beginResetModel(); + mGroups.clear(); mParents.clear(); if (mEvents.empty()) return; @@ -90,7 +92,7 @@ void EventModel::createTimeGroups() // the last group needs a title as well mGroups.last().setTitle(mEvents); - reset(); + endResetModel(); } void EventModel::createTrackGroups() { @@ -174,7 +176,7 @@ QModelIndex EventModel::index(int row, int column, const QModelIndex& parent) co if (!parent.isValid()) { - return createIndex(row, column, 0); + return createIndex(row, column, (quintptr) 0); } else if (parent.internalId() == 0) { @@ -199,7 +201,7 @@ QModelIndex EventModel::parent(const QModelIndex & index) const Event * event = static_cast(index.internalPointer()); - return createIndex(mParents[event->id()], 0, 0); + return createIndex(mParents[event->id()], 0, (quintptr) 0); } return QModelIndex(); @@ -228,11 +230,11 @@ int EventModel::rowCount (const QModelIndex & parent) const void EventModel::clearModel() { + beginResetModel(); mGroups.clear(); mEvents.clear(); mParents.clear(); - - reset(); + endResetModel(); } diff --git a/src/mvc/mvc.pro b/src/mvc/mvc.pro index f0d92d7..bf4c275 100644 --- a/src/mvc/mvc.pro +++ b/src/mvc/mvc.pro @@ -3,7 +3,8 @@ TEMPLATE = lib TARGET = mvc DESTDIR = ../bin CONFIG += static -QT += sql +QT += sql \ + widgets QMAKE_CLEAN += ../bin/libmvc.a # module dependencies diff --git a/src/sql/sqlengine.cpp b/src/sql/sqlengine.cpp index 0c16ab7..d5245be 100644 --- a/src/sql/sqlengine.cpp +++ b/src/sql/sqlengine.cpp @@ -23,9 +23,9 @@ #include #include #include +#include #include -#include #include "sqlengine.h" #include "track.h" #include "conference.h" @@ -36,7 +36,7 @@ const QString DATE_FORMAT ("yyyy-MM-dd"); const QString TIME_FORMAT ("hh:mm"); SqlEngine::SqlEngine(QObject *aParent): QObject(aParent) { - QDir dbPath(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + QDir dbPath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); dbFilename = dbPath.absoluteFilePath("ConfClerk.sqlite"); } -- 2.39.5