diff --git a/examples/sparql/dbpedia/dbpedia.pro b/examples/sparql/dbpedia/dbpedia.pro index 2df62665..db142b98 100644 --- a/examples/sparql/dbpedia/dbpedia.pro +++ b/examples/sparql/dbpedia/dbpedia.pro @@ -4,8 +4,7 @@ HEADERS += sparqlquerytext.h SOURCES += main.cpp sparqlquerytext.cpp #QT += sparql #enable this later -QT += network xml gui -equals(QT_MAJOR_VERSION, 5): QT += widgets +QT += network xml gui widgets # install # FIXME: install + package examples later #target.path = $$EXAMPLES_DIR/sparql/dbpedia diff --git a/examples/sparql/dbpedia/sparqlquerytext.cpp b/examples/sparql/dbpedia/sparqlquerytext.cpp index 5e43f66c..7e8c1223 100644 --- a/examples/sparql/dbpedia/sparqlquerytext.cpp +++ b/examples/sparql/dbpedia/sparqlquerytext.cpp @@ -53,11 +53,7 @@ SparqlQueryText::SparqlQueryText(QSparqlConnection& conn, QWidget *parent) tableView = new QTableView(); tableView->setModel(model); tableView->resize(1000, 600); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); -#else - tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); -#endif } void SparqlQueryText::runQuery() diff --git a/examples/sparql/qmlbindings/main.cpp b/examples/sparql/qmlbindings/main.cpp index 37323fed..70cd2d63 100644 --- a/examples/sparql/qmlbindings/main.cpp +++ b/examples/sparql/qmlbindings/main.cpp @@ -40,26 +40,16 @@ ****************************************************************************/ #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include #include #include #include -#else -#include -#include -#endif #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) typedef QGuiApplication ApplicationType; typedef QQuickView ViewType; -#else -typedef QApplication ApplicationType; -typedef QDeclarativeView ViewType; -#endif class ModelLiveChange : public QObject { @@ -127,11 +117,7 @@ int main(int argc, char *argv[]) // they haven't been install viewQml.engine()->addImportPath("../../../imports"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) viewQml.setSource(QUrl::fromLocalFile("main-qt5.qml")); -#else - viewQml.setSource(QUrl::fromLocalFile("main.qml")); -#endif // The bindings can be cast back to the appropriate QtSparql classes by setting // an "objectName" property on them, and casting them, eg : diff --git a/examples/sparql/qmlbindings/main.qml b/examples/sparql/qmlbindings/main.qml deleted file mode 100644 index 6d84f7cb..00000000 --- a/examples/sparql/qmlbindings/main.qml +++ /dev/null @@ -1,224 +0,0 @@ -import Qt 4.7 -import QtSparql 1.0 - -Rectangle { - id: mainRectangle - width: 800 - height: 400 - - // this will force the ListView model - // to requery the data - function reload() { - queryModel.reload(); - } - - Rectangle { - id: contactsRect - width: parent.width - height : parent.height - 50 - anchors.top: controlRect.bottom - ListView { - id: contactsView - width: parent.width - height: parent.height - - // We'll use a results list model here - // By setting the "objectName" property we can use these models and connections - // in C++, see main.cpp for an example - model: SparqlListModel { - id: "queryModel" - objectName: "queryModel" - // create a new SparqlConnection for the queryModel - connection: SparqlConnection { id:sparqlConnection; objectName:"sparqlConnection"; driver:"QTRACKER_DIRECT" } - // This is the query for the model - query: "select ?u ?firstName ?secondName"+ - "{ ?u a nco:PersonContact;"+ - "nie:isLogicalPartOf ;"+ - "nco:nameGiven ?firstName;"+ - "nco:nameFamily ?secondName .} order by ?secondName ?firstName" - } - - delegate: Item { height: 50; Text { font.pixelSize: 40; text: secondName+","+firstName } } - } - } -// The "NameInput" page, - Rectangle { - id: nameInput - visible: false - width: mainRectangle.width - height: mainRectangle.height - anchors.verticalCenter: parent.verticalCenter - Rectangle { - width: parent.width - height: 300 - - // This is the button that deals with inserting - // a contact - Rectangle { - // When the button is clicked, insert the data using the "update" function of - // of the sparql connection - MouseArea { - anchors.fill: parent - onClicked: { - var queryString = "insert { "+ - "_:u a nco:PersonContact; nie:isLogicalPartOf ; "+ - "nco:nameGiven $:firstName;"+ - "nco:nameFamily $:secondName . }"; - var boundValues = { "firstName":firstNameInput.text, "secondName":familyNameInput.text } - sparqlConnection.update(queryString, boundValues); - // clean up - firstNameInput.text = "" - familyNameInput.text = "" - nameInput.visible = false - contactsRect.visible = true - contactsView.visible = true - controlRect.visible = true - } - } - anchors.top: gridView.bottom - anchors.topMargin: 20 - anchors.horizontalCenter: gridView.horizontalCenter - color: "red"; width: 75; height: 75 - - gradient: Gradient { - GradientStop { - position: 0.0 - color: "dimgrey" - } - GradientStop { - position: 1.0 - color: "darkgrey" - } - } - Text { anchors.centerIn: parent; font.pixelSize: 50; text: "+" } - - } - - Grid { - id: gridView - columns: 1 - spacing: 2 - width: parent.width - 50 - anchors.horizontalCenter : parent.horizontalCenter - Rectangle { - width: parent.width; height: 50 - Text { smooth: true; font.pixelSize: 50; text: "Firstname"; anchors.verticalCenter: parent.verticalCenter} - } - Rectangle { - border.width:5; radius:5; border.color:"black"; width: parent.width; height: 75 - TextInput { - id: firstNameInput - smooth: true - font.pixelSize: 50 - anchors.fill: parent - anchors.leftMargin: 10 - anchors.topMargin: 10 - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: { - if (!firstNameInput.activeFocus) { - firstNameInput.forceActiveFocus() - } else { - firstNameInput.focus = false - } - } - } - onAccepted: { firstNameInput.closeSoftwareInputPanel() } - } - } - Rectangle { - width: parent.width; height: 50 - Text { smooth: true; font.pixelSize: 50; text: "Surname"; anchors.verticalCenter: parent.verticalCenter} - } - Rectangle { - border.width:5; radius:5; border.color:"black"; width: parent.width; height: 75 - TextInput { - id: familyNameInput - smooth: true - font.pixelSize: 50 - anchors.fill: parent - anchors.leftMargin: 10 - anchors.topMargin: 10 - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: { - if (!familyNameInput.activeFocus) { - familyNameInput.forceActiveFocus(); - } else { - familyNameInput.focus = false; - } - } - } - onAccepted: { familyNameInput.closeSoftwareInputPanel() } - } - } - } - } - } -// the menu bar - Rectangle { - id: controlRect - width: parent.width - height: 50 - - color: "blue" - gradient: Gradient { - GradientStop { - position: 0.0 - color: "dimgrey" - } - GradientStop { - position: 1.0 - color: "darkgrey" - } - } - - Rectangle { - id: addButton - width: 50 - height: 50 - anchors.centerIn: parent - color: "red" - border.width: 1 - radius: 4 - smooth: true - - gradient: Gradient { - GradientStop { - position: 0.0 - color: !mouseArea.pressed ? activePalette.light : activePalette.button - } - GradientStop { - position: 1.0 - color: !mouseArea.pressed ? activePalette.button : activePalette.dark - } - } - SystemPalette { id: activePalette } - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: - { - if (contactsRect.visible) { - controlRect.visible = false - contactsRect.visible = false - nameInput.visible = true - } else { - contactsRect.visible = true - nameInput.visible = false - } - } - } - Text { - id: text - anchors.centerIn:parent - font.pointSize: 50 - smooth: true - text: "+" - color: activePalette.buttonText - } - } - } -} diff --git a/examples/sparql/qmlbindings/qmlbindings.pro b/examples/sparql/qmlbindings/qmlbindings.pro index e123c9a3..9d0d3947 100644 --- a/examples/sparql/qmlbindings/qmlbindings.pro +++ b/examples/sparql/qmlbindings/qmlbindings.pro @@ -3,12 +3,10 @@ include(../sparql-examples.pri) SOURCES += main.cpp #QT += sparql #enable this later -QT += gui dbus -equals(QT_MAJOR_VERSION, 4): QT += declarative -equals(QT_MAJOR_VERSION, 5): QT += quick +QT += gui dbus quick -copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings/main.qml -copy2build.commands = $$QMAKE_COPY $$PWD/main.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings +copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings/main-qt5.qml +copy2build.commands = $$QMAKE_COPY $$PWD/main-qt5.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings QMAKE_EXTRA_TARGETS += copy2build copy2buildhook.depends = copy2build diff --git a/examples/sparql/qmlquerymodel/main.cpp b/examples/sparql/qmlquerymodel/main.cpp index 908a06ed..dfdbf200 100644 --- a/examples/sparql/qmlquerymodel/main.cpp +++ b/examples/sparql/qmlquerymodel/main.cpp @@ -40,15 +40,10 @@ ****************************************************************************/ #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include #include #include #include -#else -#include -#include -#endif #include #include #include @@ -143,30 +138,17 @@ void ModelLiveChange::gotClick(QString firstName, QString familyName) int main(int argc, char *argv[]) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QGuiApplication app(argc, argv); -#else - QApplication app(argc, argv); -#endif // Initialise QML -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QQuickView viewQml; QQmlContext *ctxt = viewQml.rootContext(); -#else - QDeclarativeView viewQml; - QDeclarativeContext *ctxt = viewQml.rootContext(); -#endif // Create the model QSparqlQueryModel *model = new QSparqlQueryModel(); // Now set the context property for the ListView model to the liveQuery model ctxt->setContextProperty("contactModel", model); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) viewQml.setSource(QUrl::fromLocalFile("main-qt5.qml")); -#else - viewQml.setSource(QUrl::fromLocalFile("main.qml")); -#endif ModelLiveChange changeNotifier(model); diff --git a/examples/sparql/qmlquerymodel/main.qml b/examples/sparql/qmlquerymodel/main.qml deleted file mode 100644 index e8d73f25..00000000 --- a/examples/sparql/qmlquerymodel/main.qml +++ /dev/null @@ -1,199 +0,0 @@ -import Qt 4.7 -import QtSparql 1.0 - -Rectangle { - id: mainRectangle - width: 800 - height: 400 - // This signal will be emitted, and caught on the c++ side - // we someone enters a new contact - signal addContact(string firstName, string familyName) - - Rectangle { - id: contactsRect - width: parent.width - height : parent.height - 50 - anchors.top: controlRect.bottom - ListView { - id: contactsView - width: parent.width - height: parent.height - // contactModel will be set from C++ - model: contactModel - delegate: Item { height: 50; Text { font.pixelSize: 40; text: secondName+","+firstName } } - } - } -// The "NameInput" page, - Rectangle { - id: nameInput - visible: false - width: mainRectangle.width - height: mainRectangle.height - anchors.verticalCenter: parent.verticalCenter - Rectangle { - width: parent.width - height: 300 - - // This is the button that deals with inserting - // a contact - Rectangle { - // When the button is clicked, emit the addContact signal with the input - // we can catch and process this on the C++ side - MouseArea { - anchors.fill: parent - onClicked: { - addContact(firstNameInput.text ,familyNameInput.text) - firstNameInput.text = "" - familyNameInput.text = "" - nameInput.visible = false - contactsRect.visible = true - contactsView.visible = true - controlRect.visible = true - } - } - anchors.top: gridView.bottom - anchors.topMargin: 20 - anchors.horizontalCenter: gridView.horizontalCenter - color: "red"; width: 75; height: 75 - - gradient: Gradient { - GradientStop { - position: 0.0 - color: "dimgrey" - } - GradientStop { - position: 1.0 - color: "darkgrey" - } - } - Text { anchors.centerIn: parent; font.pixelSize: 50; text: "+" } - } - - Grid { - id: gridView - columns: 1 - spacing: 2 - width: parent.width - 50 - anchors.horizontalCenter : parent.horizontalCenter - Rectangle { - width: parent.width; height: 50 - Text { smooth: true; font.pixelSize: 50; text: "Firstname"; anchors.verticalCenter: parent.verticalCenter} - } - Rectangle { - border.width:5; radius:5; border.color:"black"; width: parent.width; height: 75 - TextInput { - id: firstNameInput - smooth: true - font.pixelSize: 50 - anchors.fill: parent - anchors.leftMargin: 10 - anchors.topMargin: 10 - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: { - if (!firstNameInput.activeFocus) { - firstNameInput.forceActiveFocus() - } else { - firstNameInput.focus = false - } - } - } - onAccepted: { firstNameInput.closeSoftwareInputPanel() } - } - } - Rectangle { - width: parent.width; height: 50 - Text { smooth: true; font.pixelSize: 50; text: "Surname"; anchors.verticalCenter: parent.verticalCenter} - } - Rectangle { - border.width:5; radius:5; border.color:"black"; width: parent.width; height: 75 - TextInput { - id: familyNameInput - smooth: true - font.pixelSize: 50 - anchors.fill: parent - anchors.leftMargin: 10 - anchors.topMargin: 10 - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: { - if (!familyNameInput.activeFocus) { - familyNameInput.forceActiveFocus(); - } else { - familyNameInput.focus = false; - } - } - } - onAccepted: { familyNameInput.closeSoftwareInputPanel() } - } - } - } - } - } -// the menu bar - Rectangle { - id: controlRect - width: parent.width - height: 50 - - color: "blue" - gradient: Gradient { - GradientStop { - position: 0.0 - color: "dimgrey" - } - GradientStop { - position: 1.0 - color: "darkgrey" - } - } - - Rectangle { - id: addButton - width: 50 - height: 50 - anchors.centerIn: parent - color: "red" - border.width: 1 - radius: 4 - smooth: true - - gradient: Gradient { - GradientStop { - position: 0.0 - color: !mouseArea.pressed ? activePalette.light : activePalette.button - } - GradientStop { - position: 1.0 - color: !mouseArea.pressed ? activePalette.button : activePalette.dark - } - } - SystemPalette { id: activePalette } - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: - { - if (contactsRect.visible) { - controlRect.visible = false - contactsRect.visible = false - nameInput.visible = true - } else { - contactsRect.visible = true - nameInput.visible = false - } - } - } - Text { - id: text - anchors.centerIn:parent - font.pointSize: 50 - smooth: true - text: "+" - color: activePalette.buttonText - } - } - } -} diff --git a/examples/sparql/qmlquerymodel/qmlquerymodel.pro b/examples/sparql/qmlquerymodel/qmlquerymodel.pro index 9756afdb..d6aa0bee 100644 --- a/examples/sparql/qmlquerymodel/qmlquerymodel.pro +++ b/examples/sparql/qmlquerymodel/qmlquerymodel.pro @@ -3,12 +3,10 @@ include(../sparql-examples.pri) SOURCES += main.cpp #QT += sparql #enable this later -QT += gui dbus -equals(QT_MAJOR_VERSION, 4): QT += declarative -equals(QT_MAJOR_VERSION, 5): QT += quick +QT += gui dbus quick -copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlquerymodel/main.qml -copy2build.commands = $$QMAKE_COPY $$PWD/main.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlquerymodel +copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlquerymodel/main-qt5.qml +copy2build.commands = $$QMAKE_COPY $$PWD/main-qt5.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlquerymodel QMAKE_EXTRA_TARGETS += copy2build copy2buildhook.depends = copy2build diff --git a/examples/sparql/querymodel/querymodel.pro b/examples/sparql/querymodel/querymodel.pro index 863f2025..ce7d80b7 100644 --- a/examples/sparql/querymodel/querymodel.pro +++ b/examples/sparql/querymodel/querymodel.pro @@ -3,8 +3,7 @@ HEADERS = customsparqlmodel.h SOURCES = customsparqlmodel.cpp \ main.cpp #QT += sparql #enable this later -QT += gui -equals(QT_MAJOR_VERSION, 5): QT += widgets +QT += gui widgets # install # FIXME: install + package examples later #target.path = $$EXAMPLES_DIR/sparql/querymodel #sources.files = $$SOURCES *.h $$RESOURCES $$FORMS querymodel.pro diff --git a/examples/sparql/sparql-examples.pri b/examples/sparql/sparql-examples.pri index 0d224343..9dd17cbc 100644 --- a/examples/sparql/sparql-examples.pri +++ b/examples/sparql/sparql-examples.pri @@ -1,7 +1,6 @@ include(../../shared.pri) -equals(QT_MAJOR_VERSION, 4): LIBS += -lQtSparql -equals(QT_MAJOR_VERSION, 5): LIBS += -lQt5Sparql +LIBS += -lQt5Sparql QMAKE_RPATHDIR = $$QTSPARQL_BUILD_TREE/$$QTSPARQL_INSTALL_LIB $$QMAKE_RPATHDIR EXAMPLES_DIR = diff --git a/projects.pro b/projects.pro index 4c8a7d30..8303592f 100644 --- a/projects.pro +++ b/projects.pro @@ -4,12 +4,6 @@ include(shared.pri) -lessThan(QT_MAJOR_VERSION, 5) { - lessThan(QT_MAJOR_VERSION, 4) | lessThan(QT_MINOR_VERSION, 7) { - error("QtSparql requires Qt 4.7 or newer but Qt $$[QT_VERSION] was detected.") - } -} - TEMPLATE = subdirs CONFIG += ordered diff --git a/shared.pri b/shared.pri index bf1cc2ea..2f34666d 100644 --- a/shared.pri +++ b/shared.pri @@ -1,15 +1,8 @@ #we need to explicitly set the include path for any Qt Includes now, add them here #then we can add the base include path after we've included the headers from the build tree -equals(QT_MAJOR_VERSION, 4) { - INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCore $$[QT_INSTALL_HEADERS]/QtXml $$[QT_INSTALL_HEADERS]/QtNetwork $$[QT_INSTALL_HEADERS]/QtDeclarative $$[QT_INSTALL_HEADERS]/QtTest $$[QT_INSTALL_HEADERS]/QtGui $$[QT_INSTALL_HEADERS]/QtDBus \ - $$QTSPARQL_BUILD_TREE/include $$QTSPARQL_BUILD_TREE/include/QtSparql/ \ - $$[QT_INSTALL_HEADERS] -} -equals(QT_MAJOR_VERSION, 5) { - INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCore $$[QT_INSTALL_HEADERS]/QtXml $$[QT_INSTALL_HEADERS]/QtNetwork $$[QT_INSTALL_HEADERS]/QtQml $$[QT_INSTALL_HEADERS]/QtQuick $$[QT_INSTALL_HEADERS]/QtTest $$[QT_INSTALL_HEADERS]/QtGui $$[QT_INSTALL_HEADERS]/QtDBus \ - $$QTSPARQL_BUILD_TREE/include $$QTSPARQL_BUILD_TREE/include/Qt5Sparql/ \ - $$[QT_INSTALL_HEADERS] -} +INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCore $$[QT_INSTALL_HEADERS]/QtXml $$[QT_INSTALL_HEADERS]/QtNetwork $$[QT_INSTALL_HEADERS]/QtQml $$[QT_INSTALL_HEADERS]/QtQuick $$[QT_INSTALL_HEADERS]/QtTest $$[QT_INSTALL_HEADERS]/QtGui $$[QT_INSTALL_HEADERS]/QtDBus \ + $$QTSPARQL_BUILD_TREE/include $$QTSPARQL_BUILD_TREE/include/Qt5Sparql/ \ + $$[QT_INSTALL_HEADERS] QT = core @@ -25,12 +18,5 @@ VERSION = 0.2.6 # for documentation DOC_VERSION = 0.2.6 -equals(QT_MAJOR_VERSION, 4) { - LIBRARYNAME = QtSparql - PACKAGENAME = libqtsparql -} -equals(QT_MAJOR_VERSION, 5) { - LIBRARYNAME = Qt5Sparql - PACKAGENAME = libqt5sparql -} - +LIBRARYNAME = Qt5Sparql +PACKAGENAME = libqt5sparql diff --git a/src/plugins/declarative/declarative.pro b/src/plugins/declarative/declarative.pro index eb55e2d7..df70eefe 100644 --- a/src/plugins/declarative/declarative.pro +++ b/src/plugins/declarative/declarative.pro @@ -27,20 +27,14 @@ coverage { QMAKE_EXTRA_TARGETS += coverage } -equals(QT_MAJOR_VERSION, 4): PLUGIN_TYPE = declarative - target.path = $$QTSPARQL_INSTALL_IMPORTS/QtSparql QT = core -equals(QT_MAJOR_VERSION, 4): QT *= declarative -equals(QT_MAJOR_VERSION, 5): { - QT *= qml - DEFINES *= QT_VERSION_5 -} +QT *= qml +DEFINES *= QT_VERSION_5 INSTALLS += target -equals(QT_MAJOR_VERSION, 4): LIBS += -lQtSparql -equals(QT_MAJOR_VERSION, 5): LIBS += -lQt5Sparql +LIBS += -lQt5Sparql DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII DESTDIR = $$QTSPARQL_BUILD_TREE/imports/QtSparql diff --git a/src/plugins/sparqldrivers/endpoint/main.cpp b/src/plugins/sparqldrivers/endpoint/main.cpp index 49f371cc..a9016671 100644 --- a/src/plugins/sparqldrivers/endpoint/main.cpp +++ b/src/plugins/sparqldrivers/endpoint/main.cpp @@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE class QSPARQL_ENDPOINTDriverPlugin : public QSparqlDriverPlugin { Q_OBJECT -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "org.nemomobile.QtSparql.EndpointDriverInterface") -#endif public: QSPARQL_ENDPOINTDriverPlugin(); @@ -78,11 +76,6 @@ QStringList QSPARQL_ENDPOINTDriverPlugin::keys() const return l; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -Q_EXPORT_STATIC_PLUGIN(QSPARQL_ENDPOINTDriverPlugin) -Q_EXPORT_PLUGIN2(qsparqlendpoint, QSPARQL_ENDPOINTDriverPlugin) -#endif - QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/sparqldrivers/qsparqldriverbase.pri b/src/plugins/sparqldrivers/qsparqldriverbase.pri index 079178ff..eff26574 100644 --- a/src/plugins/sparqldrivers/qsparqldriverbase.pri +++ b/src/plugins/sparqldrivers/qsparqldriverbase.pri @@ -3,8 +3,7 @@ TEMPLATE = lib CONFIG += qt plugin QT = core DESTDIR = $$QTSPARQL_BUILD_TREE/plugins/sparqldrivers -equals(QT_MAJOR_VERSION, 4): LIBS += -lQtSparql -equals(QT_MAJOR_VERSION, 5): LIBS += -lQt5Sparql +LIBS += -lQt5Sparql target.path = $$QTSPARQL_INSTALL_PLUGINS/sparqldrivers diff --git a/src/plugins/sparqldrivers/tracker/main.cpp b/src/plugins/sparqldrivers/tracker/main.cpp index aed5f958..68aeda5b 100644 --- a/src/plugins/sparqldrivers/tracker/main.cpp +++ b/src/plugins/sparqldrivers/tracker/main.cpp @@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE class QTrackerDriverPlugin : public QSparqlDriverPlugin { Q_OBJECT -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "org.nemomobile.QtSparql.TrackerDriverInterface") -#endif public: QTrackerDriverPlugin(); @@ -78,11 +76,6 @@ QStringList QTrackerDriverPlugin::keys() const return l; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -Q_EXPORT_STATIC_PLUGIN(QTrackerDriverPlugin) -Q_EXPORT_PLUGIN2(qsparqltracker, QTrackerDriverPlugin) -#endif - QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/sparqldrivers/tracker_direct/main.cpp b/src/plugins/sparqldrivers/tracker_direct/main.cpp index c9e98c94..db547b8d 100644 --- a/src/plugins/sparqldrivers/tracker_direct/main.cpp +++ b/src/plugins/sparqldrivers/tracker_direct/main.cpp @@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE class QTrackerDirectDriverPlugin : public QSparqlDriverPlugin { Q_OBJECT -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "org.nemomobile.QtSparql.TrackerDirectDriverInterface") -#endif public: QTrackerDirectDriverPlugin(); @@ -78,11 +76,6 @@ QStringList QTrackerDirectDriverPlugin::keys() const return l; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -Q_EXPORT_STATIC_PLUGIN(QTrackerDirectDriverPlugin) -Q_EXPORT_PLUGIN2(qsparqltrackerdirect, QTrackerDirectDriverPlugin) -#endif - QT_END_NAMESPACE #include "main.moc" diff --git a/src/plugins/sparqldrivers/virtuoso/main.cpp b/src/plugins/sparqldrivers/virtuoso/main.cpp index 1c7a2ff7..104229ee 100644 --- a/src/plugins/sparqldrivers/virtuoso/main.cpp +++ b/src/plugins/sparqldrivers/virtuoso/main.cpp @@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE class QVirtuosoDriverPlugin : public QSparqlDriverPlugin { Q_OBJECT -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "org.nemomobile.QtSparql.VirtuosoDriverInterface") -#endif public: QVirtuosoDriverPlugin(); @@ -78,11 +76,6 @@ QStringList QVirtuosoDriverPlugin::keys() const return l; } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -Q_EXPORT_STATIC_PLUGIN(QVirtuosoDriverPlugin) -Q_EXPORT_PLUGIN2(qsparqlvirtuoso, QVirtuosoDriverPlugin) -#endif - QT_END_NAMESPACE #include "main.moc" diff --git a/src/sparql/declarative/declarative.pri b/src/sparql/declarative/declarative.pri index 56d4bf30..2ae47f8c 100644 --- a/src/sparql/declarative/declarative.pri +++ b/src/sparql/declarative/declarative.pri @@ -1,9 +1,5 @@ SOURCES += declarative/qsparqlsparqlconnection.cpp declarative/qsparqlsparqllistmodel.cpp HEADERS += declarative/qsparqlsparqlconnection_p.h declarative/qsparqlsparqlconnectionoptions_p.h declarative/qsparqlsparqllistmodel_p.h -equals(QT_MAJOR_VERSION, 4) { - QT += declarative -} -equals(QT_MAJOR_VERSION, 5) { - QT += qml - DEFINES *= QT_VERSION_5 -} +QT += qml +DEFINES *= QT_VERSION_5 + diff --git a/src/sparql/drivers/endpoint/qsparql_endpoint.cpp b/src/sparql/drivers/endpoint/qsparql_endpoint.cpp index 105ba7e1..65a0563d 100644 --- a/src/sparql/drivers/endpoint/qsparql_endpoint.cpp +++ b/src/sparql/drivers/endpoint/qsparql_endpoint.cpp @@ -55,9 +55,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include -#endif #include #include @@ -422,37 +420,23 @@ EndpointResult* EndpointDriver::exec(const QString& query, QSparqlQuery::Stateme bool EndpointResult::exec(const QString& query, QSparqlQuery::StatementType type, const QString& prefixes) { QUrl queryUrl(d->driverPrivate->url); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QUrlQuery urlQuery(queryUrl); urlQuery.addQueryItem(QLatin1String("query"), prefixes + query); -#else - queryUrl.addQueryItem(QLatin1String("query"), prefixes + query); -#endif setQuery(query); setStatementType(type); // Virtuoso protocol extension options - timeout and maxrows QVariant timeout = d->driverPrivate->options.option(QLatin1String("timeout")); if (timeout.isValid()) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) urlQuery.addQueryItem(QLatin1String("timeout"), timeout.toString()); -#else - queryUrl.addQueryItem(QLatin1String("timeout"), timeout.toString()); -#endif } QVariant maxrows = d->driverPrivate->options.option(QLatin1String("maxrows")); if (maxrows.isValid()) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) urlQuery.addQueryItem(QLatin1String("maxrows"), maxrows.toString()); -#else - queryUrl.addQueryItem(QLatin1String("maxrows"), maxrows.toString()); -#endif } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) queryUrl.setQuery(urlQuery); -#endif // qDebug() << "Real url to run.... " << queryUrl.toString(); diff --git a/src/sparql/drivers/tracker/qsparql_tracker.cpp b/src/sparql/drivers/tracker/qsparql_tracker.cpp index e0640acb..006b69b1 100644 --- a/src/sparql/drivers/tracker/qsparql_tracker.cpp +++ b/src/sparql/drivers/tracker/qsparql_tracker.cpp @@ -57,15 +57,9 @@ Q_DECLARE_METATYPE(QVector) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #define ATOMIC_INT_IS_ZERO(val) ((val).load() == 0) #define SET_ATOMIC_INT(val, n) (val).store(n) #define ATOMIC_INT_VALUE(val) (val).load() -#else -#define ATOMIC_INT_IS_ZERO(val) !(val) -#define SET_ATOMIC_INT(val, n) (val) = n -#define ATOMIC_INT_VALUE(val) static_cast(val) -#endif /* Allows a metatype to be declared for a type containing commas. diff --git a/src/sparql/drivers/tracker_direct/atomic_int_operations_p.h b/src/sparql/drivers/tracker_direct/atomic_int_operations_p.h index c1664841..ee9a52a4 100644 --- a/src/sparql/drivers/tracker_direct/atomic_int_operations_p.h +++ b/src/sparql/drivers/tracker_direct/atomic_int_operations_p.h @@ -46,20 +46,12 @@ namespace AtomicIntOperations { inline void setValue(QAtomicInt &v, int n) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) v.store(n); -#else - v = n; -#endif } inline int getValue(const QAtomicInt &v) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) return v.load(); -#else - return static_cast(v); -#endif } } diff --git a/src/sparql/models/qsparqlquerymodel.cpp b/src/sparql/models/qsparqlquerymodel.cpp index 3e058f37..b2af4766 100644 --- a/src/sparql/models/qsparqlquerymodel.cpp +++ b/src/sparql/models/qsparqlquerymodel.cpp @@ -212,9 +212,6 @@ void QSparqlQueryModelPrivate::findRoleNames() Q_FOREACH(QString word, uniqueNames) { roleNames[roleCounter++] = word.toLatin1(); } -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - q->setRoleNames(roleNames); -#endif } else { qWarning() << "QSparqlQueryModel: Invalid Query"; } @@ -603,11 +600,9 @@ QModelIndex QSparqlQueryModel::indexInQuery(const QModelIndex &item) const item.internalPointer()); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QHash QSparqlQueryModel::roleNames() const { return d->roleNames; } -#endif QT_END_NAMESPACE diff --git a/src/sparql/models/qsparqlquerymodel.h b/src/sparql/models/qsparqlquerymodel.h index 52e0bae9..9017e793 100644 --- a/src/sparql/models/qsparqlquerymodel.h +++ b/src/sparql/models/qsparqlquerymodel.h @@ -89,9 +89,7 @@ class Q_SPARQL_EXPORT QSparqlQueryModel: public QAbstractTableModel QSparqlError lastError() const; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) virtual QHash roleNames() const; -#endif Q_SIGNALS: void finished(); diff --git a/src/sparql/models/qsparqlresultslist.cpp b/src/sparql/models/qsparqlresultslist.cpp index e0b194ec..3275fbad 100644 --- a/src/sparql/models/qsparqlresultslist.cpp +++ b/src/sparql/models/qsparqlresultslist.cpp @@ -66,9 +66,7 @@ class QSparqlResultsListPrivate SparqlConnectionOptions *options; int lastRowCount; QSparqlResultsList::Status status; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QHash roleNames; -#endif }; QSparqlResultsList::QSparqlResultsList(QObject *parent) : @@ -141,12 +139,8 @@ void QSparqlResultsList::queryData(int rowCount) QAbstractItemModel::beginInsertRows(QModelIndex(), d->lastRowCount, rowCount - 1); if (d->lastRowCount == 0 && d->result->first()) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QHash &roleNames = d->roleNames; roleNames = QAbstractItemModel::roleNames(); -#else - QHash roleNames = QAbstractItemModel::roleNames(); -#endif QSparqlResultRow resultRow = d->result->current(); // Create two sets of declarative variables from the variable names used @@ -161,10 +155,6 @@ void QSparqlResultsList::queryData(int rowCount) for (int i = 0; i < resultRow.count(); i++) { roleNames.insert((Qt::UserRole + 1) + i + resultRow.count(), QByteArray("$") + resultRow.binding(i).name().toLatin1()); } - -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - setRoleNames(roleNames); -#endif } d->lastRowCount = rowCount; @@ -230,10 +220,7 @@ QString QSparqlResultsList::errorString() const return d->result->lastError().message(); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QHash QSparqlResultsList::roleNames() const { return d->roleNames; } -#endif - diff --git a/src/sparql/models/qsparqlresultslist_p.h b/src/sparql/models/qsparqlresultslist_p.h index bde88985..773f05ef 100644 --- a/src/sparql/models/qsparqlresultslist_p.h +++ b/src/sparql/models/qsparqlresultslist_p.h @@ -87,10 +87,8 @@ class Q_SPARQL_EXPORT QSparqlResultsList : public QAbstractListModel Status status() const; Q_INVOKABLE QString errorString() const; - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + virtual QHash roleNames() const; -#endif public Q_SLOTS: void reload(); diff --git a/src/sparql/sparql.pro b/src/sparql/sparql.pro index 9420c9e3..2dfd748e 100644 --- a/src/sparql/sparql.pro +++ b/src/sparql/sparql.pro @@ -2,8 +2,7 @@ include(../../shared.pri) TEMPLATE = lib CONFIG += create_pc create_prl -equals(QT_MAJOR_VERSION, 4): TARGET = QtSparql -equals(QT_MAJOR_VERSION, 5): TARGET = Qt5Sparql +TARGET = Qt5Sparql DESTDIR = $$QTSPARQL_BUILD_TREE/$$QTSPARQL_INSTALL_LIB DEFINES += QT_BUILD_SPARQL_LIB DEFINES += QT_NO_USING_NAMESPACE @@ -35,8 +34,7 @@ create_mkspecs_dirhook.depends = create_mkspecs_dir create_mkspecs_dirhook.target = Makefile QMAKE_EXTRA_TARGETS += create_mkspecs_dirhook -equals(QT_MAJOR_VERSION, 4): PRF_INPUT_FILE=$$QTSPARQL_SOURCE_TREE/mkspecs/features/qtsparql.prf.in -equals(QT_MAJOR_VERSION, 5): PRF_INPUT_FILE=$$QTSPARQL_SOURCE_TREE/mkspecs/features/qt5/qtsparql.prf.in +PRF_INPUT_FILE=$$QTSPARQL_SOURCE_TREE/mkspecs/features/qt5/qtsparql.prf.in PRF_OUTPUT_FILE=$$QTSPARQL_BUILD_TREE/mkspecs/features/qtsparql.prf install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features install_prf.files = $$PRF_OUTPUT_FILE @@ -56,12 +54,10 @@ INSTALLS += \ target.path = $$QTSPARQL_INSTALL_LIBS QMAKE_PKGCONFIG_PREFIX = $$QTSPARQL_INSTALL_PREFIX -equals(QT_MAJOR_VERSION, 4): QMAKE_PKGCONFIG_REQUIRES = QtCore QtNetwork -equals(QT_MAJOR_VERSION, 5): QMAKE_PKGCONFIG_REQUIRES = Qt5Core Qt5Network +QMAKE_PKGCONFIG_REQUIRES = Qt5Core Qt5Network QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_CFLAGS = -I$$QTSPARQL_INSTALL_HEADERS -equals(QT_MAJOR_VERSION, 4): QMAKE_PKGCONFIG_NAME = QtSparql -equals(QT_MAJOR_VERSION, 5): QMAKE_PKGCONFIG_NAME = Qt5Sparql +QMAKE_PKGCONFIG_NAME = Qt5Sparql QMAKE_PKGCONFIG_DESCRIPTION = "Library for accessing RDF stores." coverage { diff --git a/tests/auto/messagerecorder.h b/tests/auto/messagerecorder.h index fe5559bc..a4731ddd 100644 --- a/tests/auto/messagerecorder.h +++ b/tests/auto/messagerecorder.h @@ -45,20 +45,12 @@ class MessageRecorder { MessageRecorder() { selfPtr = this; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) prevMsgHandler = qInstallMessageHandler(&MessageRecorder::msgHandler); -#else - prevMsgHandler = qInstallMsgHandler(&MessageRecorder::msgHandler); -#endif } ~MessageRecorder() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) qInstallMessageHandler(prevMsgHandler); -#else - qInstallMsgHandler(prevMsgHandler); -#endif selfPtr = 0; } @@ -85,27 +77,15 @@ class MessageRecorder { return false; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) static void msgHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) -#else - static void msgHandler(QtMsgType type, const char *msg) -#endif { if (!selfPtr->handleMsg(type, msg)) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) (*selfPtr->prevMsgHandler)(type, ctxt, msg); -#else - (*selfPtr->prevMsgHandler)(type, msg); -#endif } } private: -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QtMessageHandler prevMsgHandler; -#else - QtMsgHandler prevMsgHandler; -#endif QSet msgsToRecord; QMap msgs; }; diff --git a/tests/auto/qsparql_endpoint/tst_qsparql_endpoint.cpp b/tests/auto/qsparql_endpoint/tst_qsparql_endpoint.cpp index bff713bb..302b830a 100644 --- a/tests/auto/qsparql_endpoint/tst_qsparql_endpoint.cpp +++ b/tests/auto/qsparql_endpoint/tst_qsparql_endpoint.cpp @@ -172,11 +172,7 @@ void tst_QSparqlEndpoint::query_with_error() void tst_QSparqlEndpoint::select_query_server_not_responding() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QSKIP("Neither endpoint driver nor QNetworkAccessManager has timeout functionality"); -#else - QSKIP("Neither endpoint driver nor QNetworkAccessManager has timeout functionality", SkipAll); -#endif // When connection is established but server doesn't respond, client (endpoint driver) hangs QSparqlConnectionOptions options; options.setPort(8080); diff --git a/tests/auto/qsparql_qmlbindings/qsparql_qmlbindings.pro b/tests/auto/qsparql_qmlbindings/qsparql_qmlbindings.pro index 6a8fc39c..36cbc191 100644 --- a/tests/auto/qsparql_qmlbindings/qsparql_qmlbindings.pro +++ b/tests/auto/qsparql_qmlbindings/qsparql_qmlbindings.pro @@ -2,9 +2,7 @@ include(../sparqltest.pri) CONFIG += qt warn_on console depend_includepath # Without 'gui' QTEST_MAIN() would instantiate QCoreApplication instead of # QApplication which is needed for the declarative stuff to work. -QT += testlib gui -equals(QT_MAJOR_VERSION, 4): QT += declarative -equals(QT_MAJOR_VERSION, 5): QT += qml +QT += testlib gui qml SOURCES += tst_qsparql_qmlbindings.cpp @@ -18,7 +16,6 @@ QMAKE_EXTRA_TARGETS += check memcheck #QT = sparql # enable this later -equals(QT_MAJOR_VERSION, 4): install_qml.files = qsparqlconnection.qml qsparqlresultlist.qml qsparqllegacy.qml -equals(QT_MAJOR_VERSION, 5): install_qml.files = qsparqlconnection-qt5.qml qsparqlresultlist-qt5.qml qsparqllegacy-qt5.qml +install_qml.files = qsparqlconnection-qt5.qml qsparqlresultlist-qt5.qml qsparqllegacy-qt5.qml install_qml.path = $$PREFIX/$$QTSPARQL_INSTALL_LIB/$$PACKAGENAME-tests/ INSTALLS += install_qml diff --git a/tests/auto/qsparql_qmlbindings/qsparqlconnection.qml b/tests/auto/qsparql_qmlbindings/qsparqlconnection.qml deleted file mode 100644 index 2f29917c..00000000 --- a/tests/auto/qsparql_qmlbindings/qsparqlconnection.qml +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (ivan.frade@nokia.com) -** -** This file is part of the test suite of the QtSparql module (not yet part of the Qt Toolkit). -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at ivan.frade@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtSparql 1.0 - -Rectangle { - id: rootComp - property string setDriver: "QTRACKER_DIRECT" - property string queryString: sparqlQueryString - property int portNumber: setPortNumber - property string host: setHost - property int connectionStatus: 0 - property int resultReadyCalled: 0 - property variant resultFromSlot: 0 - - signal resultReadySignal(); - - SparqlConnection { - objectName: "connectionWithOptions" - id: sparqlConnection - driver: setDriver - options: SparqlConnectionOptions { id:connectionOptions; hostName: host; port: portNumber } - onStatusChanged: connectionStatus = sparqlConnection.status - onResultReady: resultReadySignal() - } - - function runSelectQuery() - { - return sparqlConnection.select(queryString); - } - - function runAskQuery(query) - { - return sparqlConnection.ask(query); - } - - function runAskQueryAsync(query) - { - sparqlConnection.ask(query, true); - } - - function runConstructQuery() - { - // will result in error, since construct queries are not - // supported by tracker - return sparqlConnection.construct(queryString); - } - - function runSelectQueryAsync() - { - sparqlConnection.resultReady.connect(asyncResultReady); - sparqlConnection.select(queryString, true); - } - - function asyncResultReady(result) - { - resultFromSlot = result; - resultReadySignal(); - } - - // returns from the result property - function returnResults() - { - return sparqlConnection.result; - } - - function returnResultsFromSlot() - { - return resultFromSlot; - } - - function returnConnectionOptions() { - var hash = {}; - for (var prop in connectionOptions) { - hash[prop] = connectionOptions[prop]; - } - return hash; - } - - function insertContact() { - var insertQuery = "insert { a nco:PersonContact; "+ - "nie:isLogicalPartOf ; "+ - "nco:nameGiven 'QML INSERT' }"; - sparqlConnection.update(insertQuery); - } - - function insertBoundContact() { - var insertQuery = "insert { a nco:PersonContact; "+ - "nie:isLogicalPartOf ; "+ - "nco:nameGiven ?:nameGiven; "+ - "nco:nameFamily ?:nameFamily }"; - var boundValues = { "nameFamily":"QML Family", "nameGiven":"QML Insert" }; - sparqlConnection.update(insertQuery, boundValues); - } - - function deleteBoundContact() { - var deleteQuery = "delete { ?u a nco:PersonContact } "+ - "where { ?u a nco:PersonContact; nco:nameGiven ?:ng; nco:nameFamily ?:nf } "; - var boundValues = { "ng":"QML Insert", "nf":"QML Family" }; - sparqlConnection.update(deleteQuery, boundValues); - } - - function selectBoundContact() { - var selectQuery = "select ?u { ?u a nco:PersonContact; "+ - "nie:isLogicalPartOf ; "+ - "nco:nameGiven ?:nameGiven; nco:nameFamily ?:nameFamily}"; - var boundValues = { "nameFamily":"QML Family", "nameGiven":"QML Insert" }; - return sparqlConnection.select(selectQuery, boundValues); - } - - function askBoundContact() { - var askQuery = "ask { ?u a nco:PersonContact; "+ - "nco:nameGiven ?:ng;"+ - "nco:nameFamily ?:nf .}"; - var boundValues = { "ng":"QML Insert", "nf":"QML Family" }; - return sparqlConnection.ask(askQuery, boundValues); - } - - function insertContactAsync() { - var insertQuery = "insert { a nco:PersonContact; "+ - "nie:isLogicalPartOf ; "+ - "nco:nameGiven 'QML INSERT' }"; - sparqlConnection.update(insertQuery, true); - } - - function deleteContact() { - var deleteQuery = "delete { a nco:PersonContact } "+ - "where { a nco:PersonContact } "; - - sparqlConnection.update(deleteQuery); - } - - function deleteContactAsync() { - var deleteQuery = "delete { a nco:PersonContact } "+ - "where { a nco:PersonContact } "; - - sparqlConnection.update(deleteQuery, true); - } - - function getStatus() - { - // return the property value here - // that way we can also check to make sure - // the notify for Status is working - return connectionStatus - } - - function getLastError() - { - return sparqlConnection.errorString(); - } -} - diff --git a/tests/auto/qsparql_qmlbindings/qsparqllegacy.qml b/tests/auto/qsparql_qmlbindings/qsparqllegacy.qml deleted file mode 100644 index 65726c5a..00000000 --- a/tests/auto/qsparql_qmlbindings/qsparqllegacy.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (ivan.frade@nokia.com) -** -** This file is part of the test suite of the QtSparql module (not yet part of the Qt Toolkit). -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at ivan.frade@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtSparql 0.1 - -ListView { - width: 1000; height: 600 - - model: SparqlResultsList { - options: SparqlConnectionOptions { - driverName: "QTRACKER_DIRECT" - hostName: "dbpedia.org" - } - - query: "SELECT $predicate $thing WHERE { $predicate $thing . }" - } - - delegate: Text { text: "Data: " + $predicate + ", " + $thing } -} diff --git a/tests/auto/qsparql_qmlbindings/qsparqlresultlist.qml b/tests/auto/qsparql_qmlbindings/qsparqlresultlist.qml deleted file mode 100644 index e8bcf98a..00000000 --- a/tests/auto/qsparql_qmlbindings/qsparqlresultlist.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (ivan.frade@nokia.com) -** -** This file is part of the test suite of the QtSparql module (not yet part of the Qt Toolkit). -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at ivan.frade@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtSparql 1.0 - -Rectangle { - id: rootComp - property string setDriver: "QTRACKER_DIRECT" - property string queryString: sparqlQueryString - property int modelStatus: 0 - - signal modelCountChanged() - signal modelStatusReady() - - ListView { - id: contactsView - width: parent.width - height: parent.height - - model: SparqlListModel { - id: sparqlResultList - onCountChanged: { modelCountChanged() } - objectName: "queryModel" - // load existing query model - connection: sparqlConnection - query: sparqlQueryString - onStatusChanged: { modelStatusChanged() } - - } - delegate: Item { height: 50; } - } - - SparqlConnection { - objectName: "sparqlConnection" - id: sparqlConnection - driver: setDriver - } - - function modelStatusChanged() - { - modelStatus = sparqlResultList.status; - if (modelStatus == SparqlListModel.Ready) { - modelStatusReady(); - } - } - - function getCount() - { - var resultListCount = sparqlResultList.count; - return resultListCount - } - - function getStatus() - { - // return the property value here - // that way we can also check to make sure - // the notify for Status is working - return modelStatus - } - - function reloadModel() - { - sparqlResultList.reload(); - } - - function setQuery(query) - { - sparqlResultList.query = query; - } - - function getRow(row) - { - return sparqlResultList.get(row); - } - -} - diff --git a/tests/auto/qsparql_qmlbindings/tst_qsparql_qmlbindings.cpp b/tests/auto/qsparql_qmlbindings/tst_qsparql_qmlbindings.cpp index 32663e11..5aac57cb 100644 --- a/tests/auto/qsparql_qmlbindings/tst_qsparql_qmlbindings.cpp +++ b/tests/auto/qsparql_qmlbindings/tst_qsparql_qmlbindings.cpp @@ -39,15 +39,10 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include #include #include #include -#else -#include -#include -#endif #include #include @@ -93,15 +88,9 @@ namespace { // QML stuff enum Status { Null, Ready, Loading, Error }; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QQmlEngine *engine; QQmlComponent *component; QQmlContext *context; -#else -QDeclarativeEngine *engine; -QDeclarativeComponent *component; -QDeclarativeContext *context; -#endif QObject* qmlObject; const QString contactSelectQuery = @@ -154,17 +143,9 @@ bool loadQmlFile(QString fileName, QList > contextPrope { QFileInfo fileInfo(qApp->arguments()[0]); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) engine = new QQmlEngine(); -#else - engine = new QDeclarativeEngine(); -#endif engine->addImportPath("../../../imports"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) component = new QQmlComponent(engine, QUrl::fromLocalFile(fileInfo.absolutePath()+"/"+fileName+"-qt5.qml")); -#else - component = new QDeclarativeComponent(engine, QUrl::fromLocalFile(fileInfo.absolutePath()+"/"+fileName+".qml")); -#endif context = engine->rootContext(); for(int i=0;i= QT_VERSION_CHECK(5, 0, 0) threadJoin.acquire(threadJoinCount.load()); threadJoinCount.store(0); -#else - threadJoin.acquire(threadJoinCount); - threadJoinCount = 0; -#endif } bool tst_QSparqlThreading::waitForSignal(QObject *obj, const char *signal, int delay) diff --git a/tests/auto/qsparql_tracker/tst_qsparql_tracker.cpp b/tests/auto/qsparql_tracker/tst_qsparql_tracker.cpp index 52e09ac5..41d9325a 100644 --- a/tests/auto/qsparql_tracker/tst_qsparql_tracker.cpp +++ b/tests/auto/qsparql_tracker/tst_qsparql_tracker.cpp @@ -70,16 +70,10 @@ private slots: namespace { int testLogLevel = QtWarningMsg; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString &msgString) -#else -void myMessageOutput(QtMsgType type, const char *msg) -#endif { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) const QByteArray ba(msgString.toLocal8Bit()); const char *msg(ba.constData()); -#endif switch (type) { case QtDebugMsg: if (testLogLevel <= 0) @@ -114,11 +108,7 @@ void tst_QSparqlTracker::initTestCase() // For running the test without installing the plugins. Should work in // normal and vpath builds. QCoreApplication::addLibraryPath("../../../plugins"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) qInstallMessageHandler(myMessageOutput); -#else - qInstallMsgHandler(myMessageOutput); -#endif // clean any remainings cleanupTestCase(); diff --git a/tests/auto/sparqltest.pri b/tests/auto/sparqltest.pri index 6d04e1b7..4375842d 100644 --- a/tests/auto/sparqltest.pri +++ b/tests/auto/sparqltest.pri @@ -1,9 +1,6 @@ include(../../shared.pri) -equals(QT_MAJOR_VERSION, 4): LIBS += -lQtSparql -equals(QT_MAJOR_VERSION, 5): { - LIBS += -lQt5Sparql - DEFINES *= QT_VERSION_5 -} +LIBS += -lQt5Sparql +DEFINES *= QT_VERSION_5 QMAKE_RPATHDIR = $$QTSPARQL_BUILD_TREE/$$QTSPARQL_INSTALL_LIB $$QMAKE_RPATHDIR target.path = $$QTSPARQL_INSTALL_TESTS # to be changed when we are part of qt INSTALLS += target diff --git a/tests/auto/tracker_direct_common.cpp b/tests/auto/tracker_direct_common.cpp index 2be1bbf2..ea9236a8 100644 --- a/tests/auto/tracker_direct_common.cpp +++ b/tests/auto/tracker_direct_common.cpp @@ -46,16 +46,10 @@ namespace { int testLogLevel = QtWarningMsg; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString &msgString) -#else - void myMessageOutput(QtMsgType type, const char *msg) -#endif { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) const QByteArray ba(msgString.toLocal8Bit()); const char *msg(ba.constData()); -#endif switch (type) { case QtDebugMsg: if (testLogLevel <= 0) @@ -112,11 +106,7 @@ QSparqlResult* TrackerDirectCommon::runQuery(QSparqlConnection &conn, const QSpa void TrackerDirectCommon::installMsgHandler() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QtMessageHandler prevHandler = qInstallMessageHandler(myMessageOutput); -#else - QtMsgHandler prevHandler = qInstallMsgHandler(myMessageOutput); -#endif if (!origMsgHandler) origMsgHandler = prevHandler; } @@ -186,24 +176,14 @@ bool TrackerDirectCommon::cleanData() void TrackerDirectCommon::testError(const QString& msg) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QtMessageHandler currMsgHandler = 0; if (origMsgHandler != 0) currMsgHandler = qInstallMessageHandler(origMsgHandler); -#else - QtMsgHandler currMsgHandler = 0; - if (origMsgHandler != 0) - currMsgHandler = qInstallMsgHandler(origMsgHandler); -#endif qWarning() << "Test error:" << msg; if (currMsgHandler != 0) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) qInstallMessageHandler(currMsgHandler); -#else - qInstallMsgHandler(currMsgHandler); -#endif } void TrackerDirectCommon::query_contacts() diff --git a/tests/auto/tracker_direct_common.h b/tests/auto/tracker_direct_common.h index 1fd1a386..48f55c25 100644 --- a/tests/auto/tracker_direct_common.h +++ b/tests/auto/tracker_direct_common.h @@ -84,11 +84,7 @@ class TrackerDirectCommon : public QObject void datatypes_as_properties(); private: -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QtMessageHandler origMsgHandler; -#else - QtMsgHandler origMsgHandler; -#endif }; #endif // QSPARQL_TRACKER_COMMON_H