diff --git a/.gitignore b/.gitignore
index e84db77..6f07b24 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@
*.la
*.a
/oxygen/
+/build/
diff --git a/src/interface/AbstractDistrictQuery.cpp b/src/interface/AbstractDistrictQuery.cpp
new file mode 100644
index 0000000..9982652
--- /dev/null
+++ b/src/interface/AbstractDistrictQuery.cpp
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : AbstractDistrictQuery.cpp
+** Date : 2015-09-05T23:26:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "AbstractDistrictQuery.h"
+
+AbstractDistrictQuery::AbstractDistrictQuery( QObject* parent )
+ : QObject( parent )
+{
+}
+
+AbstractDistrictQuery::~AbstractDistrictQuery()
+{
+}
diff --git a/src/interface/AbstractDistrictQuery.h b/src/interface/AbstractDistrictQuery.h
new file mode 100644
index 0000000..f9b4167
--- /dev/null
+++ b/src/interface/AbstractDistrictQuery.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : AbstractDistrictQuery.h
+** Date : 2015-09-05T23:26:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef ABSTRACTDISTRICTQUERY_H
+#define ABSTRACTDISTRICTQUERY_H
+
+#include
+
+#include "District.h"
+
+class AbstractDistrictQuery : public QObject
+{
+ Q_OBJECT
+
+public:
+ AbstractDistrictQuery( QObject* parent = 0 );
+ virtual ~AbstractDistrictQuery();
+
+ virtual void setMinimumSearchLength( int length ) = 0;
+ virtual int minimumSearchLength() const = 0;
+
+public slots:
+ virtual void search( const QString& text ) = 0;
+
+signals:
+ void districtsReceived( const District::List& districts );
+ void error( const QString& error );
+};
+
+#endif // ABSTRACTDISTRICTQUERY_H
diff --git a/src/interface/AbstractHousingDriver.cpp b/src/interface/AbstractHousingDriver.cpp
index 051162c..15e3837 100644
--- a/src/interface/AbstractHousingDriver.cpp
+++ b/src/interface/AbstractHousingDriver.cpp
@@ -79,6 +79,7 @@ QVariant AbstractHousingDriver::RequestProperties::toVariant() const
map[ "features" ] = int( features );
map[ "inputs" ] = variantInputs;
map[ "cities" ] = City::listToVariant( cities );
+ map[ "districts" ] = District::listToVariant( districts );
map[ "ignored" ] = variantIgnored;
map[ "bookmarked" ] = variantBookmarked;
@@ -108,6 +109,7 @@ void AbstractHousingDriver::RequestProperties::fromVariant( const QVariant& vari
}
cities = City::variantToList( map.value( "cities" ) );
+ districts = District::variantToList( map.value( "districts" ) );
ignoredIdSet.clear();
diff --git a/src/interface/AbstractHousingDriver.h b/src/interface/AbstractHousingDriver.h
index 3ff56d7..4906fd5 100644
--- a/src/interface/AbstractHousingDriver.h
+++ b/src/interface/AbstractHousingDriver.h
@@ -37,8 +37,10 @@
#include "Announcement.h"
#include "City.h"
+#include "District.h"
class AbstractCityQuery;
+class AbstractDistrictQuery;
class AbstractHousingDriver : public QObject
{
@@ -138,6 +140,7 @@ class AbstractHousingDriver : public QObject
SearchFeatures features;
QHash inputs;
City::List cities;
+ District::List districts;
QSet ignoredIdSet;
QSet bookmarkedIdSet;
@@ -205,6 +208,7 @@ class AbstractHousingDriver : public QObject
virtual AbstractHousingDriver::SearchFeatures supportedSearchFeatures() const = 0;
virtual AbstractCityQuery* cityQuery() const = 0;
+ virtual AbstractDistrictQuery* districtQuery() const = 0;
virtual QMap roomsInputs() const = 0;
virtual QMap bedroomsInputs() const = 0;
virtual bool isOwnUrl( const QUrl& url ) const = 0;
diff --git a/src/interface/District.cpp b/src/interface/District.cpp
new file mode 100644
index 0000000..0e7e9c9
--- /dev/null
+++ b/src/interface/District.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : District.cpp
+** Date : 2015-09-05T23:44:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "District.h"
+
+#include
+#include
+
+class DistrictData : public QSharedData {
+public:
+ QString label;
+ QString value;
+ QString valuesup;
+ QString code;
+
+public:
+ DistrictData() {
+ }
+
+ DistrictData( const DistrictData& other )
+ : QSharedData( other ),
+ label( other.label ),
+ value( other.value ),
+ valuesup( other.valuesup ),
+ code( other.code )
+ {
+ }
+
+ ~DistrictData() {
+ }
+};
+
+District::District( const QVariant& variant )
+ : d( new DistrictData )
+{
+ if ( !variant.isNull() ) {
+ fromVariant( variant );
+ }
+}
+
+District::District( const District& other )
+ : d( other.d )
+{
+}
+
+District::District( const QString& label, const QString& value, const QString& code, const QString& valuesup )
+ : d( new DistrictData )
+{
+ d->label = label;
+ d->value = value;
+ d->valuesup = valuesup;
+ d->code = code;
+}
+
+District::~District()
+{
+}
+
+District& District::operator=( const District& other )
+{
+ if ( this != &other ) {
+ d = other.d;
+ }
+
+ return *this;
+}
+
+bool District::operator==( const District& other ) const
+{
+ return d->value == other.d->value && d->valuesup == other.d->valuesup;
+}
+
+bool District::operator<( const District& other ) const
+{
+ return d->label.compare( other.d->label ) < 0;
+}
+
+bool District::isNull() const
+{
+ return d->label.isEmpty() &&
+ d->value.isEmpty() &&
+ d->valuesup.isEmpty() &&
+ d->code.isEmpty()
+ ;
+}
+
+QString District::label() const
+{
+ return d->label;
+}
+
+QString District::value() const
+{
+ return d->value;
+}
+
+QString District::valuesup() const
+{
+ return d->valuesup;
+}
+
+QString District::code() const
+{
+ return d->code;
+}
+
+QVariant District::toVariant() const
+{
+ QVariantMap map;
+ map[ "label" ] = d->label;
+ map[ "value" ] = d->value;
+ map[ "valuesup" ] = d->valuesup;
+ map[ "code" ] = d->code;
+ return map;
+}
+
+void District::fromVariant( const QVariant& variant )
+{
+ if ( !variant.type() == QVariant::Map ) {
+ return;
+ }
+
+ const QVariantMap map = variant.toMap();
+ d->label = map.value( "label" ).toString();
+ d->value = map.value( "value" ).toString();
+ d->valuesup = map.value( "valuesup" ).toString();
+ d->code = map.value( "code" ).toString();
+}
+
+QVariant District::listToVariant( const District::List& districts )
+{
+ QVariantList list;
+
+ foreach ( const District& district, districts ) {
+ list << district.toVariant();
+ }
+
+ return list;
+}
+
+District::List District::variantToList( const QVariant& variant )
+{
+ District::List list;
+
+ if ( variant.type() == QVariant::List ) {
+ const QVariantList districts = variant.toList();
+
+ foreach ( const QVariant& district, districts ) {
+ list << District( district );
+ }
+ }
+
+ return list;
+}
diff --git a/src/interface/District.h b/src/interface/District.h
new file mode 100644
index 0000000..cab62d8
--- /dev/null
+++ b/src/interface/District.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : District.h
+** Date : 2015-09-05T23:44:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef DISTRICT_H
+#define DISTRICT_H
+
+#include
+#include
+#include
+
+class DistrictData;
+
+class District
+{
+public:
+ typedef QList List;
+
+ District( const QVariant& variant = QVariant() );
+ District( const District& other );
+ District( const QString& label, const QString& value, const QString& code, const QString& valuesup );
+ virtual ~District();
+
+ virtual District& operator=( const District& other );
+ virtual bool operator==( const District& other ) const;
+ virtual bool operator<( const District& other ) const;
+
+ bool isNull() const;
+ QString label() const;
+ QString value() const;
+ QString valuesup() const;
+ QString code() const;
+
+ QVariant toVariant() const;
+ void fromVariant( const QVariant& variant );
+
+ static QVariant listToVariant( const District::List& districts );
+ static District::List variantToList( const QVariant& variant );
+
+private:
+ QSharedDataPointer d;
+};
+
+#endif // DISTRICT_H
diff --git a/src/interface/DistrictModel.cpp b/src/interface/DistrictModel.cpp
new file mode 100644
index 0000000..e186540
--- /dev/null
+++ b/src/interface/DistrictModel.cpp
@@ -0,0 +1,257 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictModel.cpp
+** Date : 2015-09-06T00:07:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "DistrictModel.h"
+
+#include
+
+class DistrictModelPrivate {
+public:
+ District::List districts;
+ bool codeVisible;
+
+public:
+ DistrictModelPrivate()
+ : codeVisible( false )
+ {
+ }
+};
+
+DistrictModel::DistrictModel( QObject* parent )
+ : QAbstractTableModel( parent ),
+ d( new DistrictModelPrivate )
+{
+}
+
+DistrictModel::~DistrictModel()
+{
+ delete d;
+}
+
+int DistrictModel::columnCount( const QModelIndex& parent ) const
+{
+ return parent == QModelIndex() ? DistrictModel::LastRole -DistrictModel::FirstRole : 0;
+}
+
+int DistrictModel::rowCount( const QModelIndex& parent ) const
+{
+ return parent == QModelIndex() ? d->districts.count() : 0;
+}
+
+QVariant DistrictModel::data( const QModelIndex& index, int role ) const
+{
+ if ( index.isValid() ) {
+ const District& district = this->district( index );
+
+ switch ( role ) {
+ case Qt::DisplayRole:
+ case Qt::EditRole: {
+ switch ( index.column() ) {
+ case 0:
+ return d->codeVisible ? QString( "%1 (%2)" ).arg( district.label() ).arg( district.code() ) : district.label();
+ case 1:
+ return district.value();
+ case 2:
+ return district.code();
+ }
+
+ break;
+ }
+
+ case DistrictModel::LabelRole: {
+ return district.label();
+ }
+
+ case DistrictModel::ValueRole: {
+ return district.value();
+ }
+
+ case DistrictModel::CodeRole: {
+ return district.code();
+ }
+ }
+ }
+
+ return QVariant();
+}
+
+QVariant DistrictModel::headerData( int section, Qt::Orientation orientation, int role ) const
+{
+ if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < columnCount() ) {
+ switch ( section +DistrictModel::FirstRole ) {
+ case DistrictModel::LabelRole:
+ return tr( "Label" );
+ case DistrictModel::ValueRole:
+ return tr( "Value" );
+ case DistrictModel::CodeRole:
+ return tr( "Code" );
+ default:
+ break;
+ }
+ }
+
+ return QAbstractTableModel::headerData( section, orientation, role );
+}
+
+void DistrictModel::sort( int column, Qt::SortOrder order )
+{
+ Q_UNUSED( column );
+
+ if ( rowCount() == 0 ) {
+ return;
+ }
+
+ emit layoutAboutToBeChanged();
+
+ const QModelIndexList oldIndexes = persistentIndexList();
+ QModelIndexList newIndexes;
+
+ QMap oldMapping;
+ QMap newMapping;
+
+ for ( int i = 0; i < d->districts.count(); i++ ) {
+ oldMapping[ i ] = d->districts[ i ];
+ }
+
+ switch ( order ) {
+ case Qt::AscendingOrder: {
+ qSort( d->districts.begin(), d->districts.end() );
+ break;
+ }
+
+ case Qt::DescendingOrder: {
+ qSort( d->districts.begin(), d->districts.end(), qGreater() );
+ break;
+ }
+ }
+
+ for ( int i = 0; i < d->districts.count(); i++ ) {
+ newMapping[ d->districts[ i ] ] = i;
+ }
+
+ for ( int i = 0; i < oldIndexes.count(); i++ ) {
+ const QModelIndex& index = oldIndexes[ i ];
+ const District& district = oldMapping[ index.row() ];
+ newIndexes << QAbstractTableModel::index( newMapping[ district ], index.column() );
+ }
+
+ changePersistentIndexList( oldIndexes, newIndexes );
+
+ emit layoutChanged();
+}
+
+void DistrictModel::clear()
+{
+ const int count = d->districts.count();
+
+ if ( count == 0 ) {
+ return;
+ }
+
+ beginRemoveRows( QModelIndex(), 0, count -1 );
+ d->districts.clear();
+ endRemoveRows();
+}
+
+void DistrictModel::setDistricts( const District::List& districts )
+{
+ clear();
+
+ const int count = districts.count();
+
+ if ( count == 0 ) {
+ return;
+ }
+
+ beginInsertRows( QModelIndex(), 0, count -1 );
+ d->districts = districts;
+ qSort( d->districts );
+ endInsertRows();
+}
+
+District::List DistrictModel::districts() const
+{
+ return d->districts;
+}
+
+void DistrictModel::addDistrict( const District& district )
+{
+ if ( d->districts.contains( district ) ) {
+ return;
+ }
+
+ const int count = d->districts.count();
+
+ beginInsertRows( QModelIndex(), count, count );
+ d->districts << district;
+ endInsertRows();
+ sort( 0 );
+}
+
+District DistrictModel::district( const QModelIndex& index ) const
+{
+ return d->districts.value( index.row() );
+}
+
+void DistrictModel::removeDistricts( const QModelIndexList& _indexes )
+{
+ if ( _indexes.isEmpty() ) {
+ return;
+ }
+
+ QModelIndexList indexes = _indexes;
+
+ qSort( indexes );
+
+ emit layoutAboutToBeChanged();
+
+ const QModelIndexList oldIndexes = persistentIndexList();
+ QModelIndexList newIndexes;
+
+ for ( int i = 0; i < oldIndexes.count(); i++ ) {
+ newIndexes << QModelIndex();
+ }
+
+ for ( int i = indexes.count() -1; i >= 0; i-- ) {
+ const QModelIndex& index = indexes[ i ];
+
+ d->districts.removeAt( index.row() );
+ }
+
+ changePersistentIndexList( oldIndexes, newIndexes );
+
+ emit layoutChanged();
+}
+
+void DistrictModel::setCodeVisible( bool visible )
+{
+ d->codeVisible = visible;
+ emit dataChanged( index( 0, 0 ), index( rowCount() -1, columnCount() -1 ) );
+}
+
+bool DistrictModel::isCodeVisible() const
+{
+ return d->codeVisible;
+}
diff --git a/src/interface/DistrictModel.h b/src/interface/DistrictModel.h
new file mode 100644
index 0000000..8b76e36
--- /dev/null
+++ b/src/interface/DistrictModel.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictModel.h
+** Date : 2015-09-06T00:07:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef DISTRICTMODEL_H
+#define DISTRICTMODEL_H
+
+#include
+
+#include "District.h"
+
+class DistrictModelPrivate;
+
+class DistrictModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ enum CustomRoles {
+ LabelRole = Qt::UserRole,
+ ValueRole,
+ CodeRole,
+ // internal, do not use
+ FirstRole = LabelRole,
+ LastRole = CodeRole
+ };
+
+ DistrictModel( QObject* parent = 0 );
+ virtual ~DistrictModel();
+
+ virtual int columnCount( const QModelIndex& parent = QModelIndex() ) const;
+ virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
+ virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
+ virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
+
+ void clear();
+
+ void setDistricts( const District::List& districts );
+ District::List districts() const;
+
+ void addDistrict( const District& district );
+ District district( const QModelIndex& index ) const;
+ void removeDistricts( const QModelIndexList& indexes );
+
+ void setCodeVisible( bool visible );
+ bool isCodeVisible() const;
+
+private:
+ DistrictModelPrivate* d;
+};
+
+#endif // DISTRICTMODEL_H
diff --git a/src/seloger/SeLogerDistrictQuery.cpp b/src/seloger/SeLogerDistrictQuery.cpp
new file mode 100644
index 0000000..97267f4
--- /dev/null
+++ b/src/seloger/SeLogerDistrictQuery.cpp
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : SeLogerDistrictQuery.cpp
+** Date : 2015-09-05T23:32:14
+** License : GPL3
+** Home Page : https://github.com/pasnox/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "SeLogerDistrictQuery.h"
+#include "objects/NetworkManager.h"
+#include "objects/Housing.h"
+
+#include
+#include
+#include
+#include
+
+class SeLogerDistrictQueryPrivate : public QObject {
+ Q_OBJECT
+
+public:
+ SeLogerDistrictQuery* query;
+ int searchLength;
+
+public:
+ SeLogerDistrictQueryPrivate( SeLogerDistrictQuery* _query )
+ : QObject( _query ),
+ query( _query ),
+ searchLength( 2 )
+ {
+ connect( NetworkManager::instance(), SIGNAL( jsonFinished( QNetworkReply*, const QByteArray&, const QVariantMap& ) ), this, SLOT( jsonFinished( QNetworkReply*, const QByteArray&, const QVariantMap& ) ) );
+ connect( this, SIGNAL( districtsReceived( const District::List& ) ), query, SIGNAL( districtsReceived( const District::List& ) ) );
+ connect( this, SIGNAL( error( const QString& ) ), query, SIGNAL( error( const QString& ) ) );
+ }
+
+ QUrl requestUrl( const QString& text ) const {
+ return QUrl( QString( "http://www.seloger.com/js,ajax,villequery_v3.htm?ville=%1&mode=1" ).arg( text ) );
+ }
+
+private slots:
+ void jsonFinished( QNetworkReply* reply, const QByteArray& json, const QVariantMap& data ) {
+ Q_UNUSED( reply );
+ Q_UNUSED( json );
+
+ if ( data.value( "success" ).toBool() ) {
+ const QStringList priorities = QStringList()
+ << "quartier"
+ << "suggestions"
+ ;
+ const QVariantList results = data.value( "json" ).toList();
+ QVariantList districtsList;
+ bool found = false;
+
+ foreach ( const QString& priority, priorities ) {
+ foreach ( const QVariant& variant, results ) {
+ const QVariantMap map = variant.toMap();
+ const QString label = map.value( "label" ).toString().toLower();
+
+ if ( label == priority ) {
+ districtsList = map.value( "values" ).toList();
+ found = true;
+ break;
+ }
+ }
+
+ if ( found ) {
+ break;
+ }
+ }
+
+ if ( !found ) {
+ emit error( SeLogerDistrictQuery::tr( "No data found." ) );
+ return;
+ }
+
+ District::List districts;
+
+ foreach ( const QVariant& districtVariant, districtsList ) {
+ const QVariantMap district = districtVariant.toMap();
+
+ if ( !district.isEmpty() ) {
+ districts << District( Housing::toPlainText( district.value( "label" ).toString() ), district.value( "value" ).toString(), district.value( "code" ).toString(), district.value( "valuesup" ).toString() );
+ }
+ }
+
+ emit districtsReceived( districts );
+ }
+ else {
+ emit error( data.value( "message" ).toString() );
+ }
+ }
+
+signals:
+ void districtsReceived( const District::List& districts );
+ void error( const QString& error );
+};
+
+SeLogerDistrictQuery::SeLogerDistrictQuery( QObject* parent )
+ : AbstractDistrictQuery( parent ),
+ d( new SeLogerDistrictQueryPrivate( this ) )
+{
+}
+
+SeLogerDistrictQuery::~SeLogerDistrictQuery()
+{
+}
+
+void SeLogerDistrictQuery::setMinimumSearchLength( int length )
+{
+ d->searchLength = length;
+}
+
+int SeLogerDistrictQuery::minimumSearchLength() const
+{
+ return d->searchLength;
+}
+
+void SeLogerDistrictQuery::search( const QString& text )
+{
+ if ( text.length() < d->searchLength ) {
+ emit error( tr( "Your text is too short to start the search." ) );
+ return;
+ }
+
+ NetworkManager::instance()->getJson( QNetworkRequest( d->requestUrl( text ) ) );
+}
+
+#include "SeLogerDistrictQuery.moc"
diff --git a/src/seloger/SeLogerDistrictQuery.h b/src/seloger/SeLogerDistrictQuery.h
new file mode 100644
index 0000000..f223859
--- /dev/null
+++ b/src/seloger/SeLogerDistrictQuery.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : SeLogerDistrictQuery.h
+** Date : 2015-09-05T23:32:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef SELOGERDISTRICTQUERY_H
+#define SELOGERDISTRICTQUERY_H
+
+#include "interface/AbstractDistrictQuery.h"
+
+class SeLogerDistrictQueryPrivate;
+
+class SeLogerDistrictQuery : public AbstractDistrictQuery
+{
+ Q_OBJECT
+
+public:
+ SeLogerDistrictQuery( QObject* parent = 0 );
+ virtual ~SeLogerDistrictQuery();
+
+ virtual void setMinimumSearchLength( int length );
+ virtual int minimumSearchLength() const;
+
+public slots:
+ virtual void search( const QString& text );
+
+private:
+ SeLogerDistrictQueryPrivate* d;
+};
+
+#endif // SELOGERDISTRICTQUERY_H
diff --git a/src/seloger/SeLogerHousingDriver.cpp b/src/seloger/SeLogerHousingDriver.cpp
index 7b08eb0..0d28d33 100644
--- a/src/seloger/SeLogerHousingDriver.cpp
+++ b/src/seloger/SeLogerHousingDriver.cpp
@@ -25,6 +25,7 @@
****************************************************************************/
#include "SeLogerHousingDriver.h"
#include "SeLogerCityQuery.h"
+#include "SeLogerDistrictQuery.h"
#include
#include
@@ -134,6 +135,11 @@ AbstractCityQuery* SeLogerHousingDriver::cityQuery() const
return new SeLogerCityQuery( QApplication::instance() );
}
+AbstractDistrictQuery* SeLogerHousingDriver::districtQuery() const
+{
+ return new SeLogerDistrictQuery( QApplication::instance() );
+}
+
QMap SeLogerHousingDriver::roomsInputs() const
{
QMap rooms;
@@ -191,6 +197,7 @@ void SeLogerHousingDriver::setUpSearchRequest( QNetworkRequest& request, QByteAr
QUrl url( d->webServiceUrl() );
QStringList cities;
+ QStringList districts;
QStringList types;
QStringList rooms;
QStringList bedrooms;
@@ -199,6 +206,13 @@ void SeLogerHousingDriver::setUpSearchRequest( QNetworkRequest& request, QByteAr
cities << city.value();
}
+ foreach ( const District& district, properties.districts ) {
+ districts << district.value();
+ if ( !cities.contains(district.valuesup()) ) {
+ cities << district.valuesup();
+ }
+ }
+
foreach ( const QVariant& variant, properties.numberOfRooms() ) {
rooms << variant.toString();
}
@@ -271,6 +285,7 @@ void SeLogerHousingDriver::setUpSearchRequest( QNetworkRequest& request, QByteAr
}
url.addQueryItem( "ci", cities.join( "," ) );
+ url.addQueryItem( "idq", districts.join( "," ) );
if ( properties.properties != AbstractHousingDriver::SearchPropertyNone ) {
url.addQueryItem( "idtypebien", types.join( "," ) );
diff --git a/src/seloger/SeLogerHousingDriver.h b/src/seloger/SeLogerHousingDriver.h
index 97b8673..6563467 100644
--- a/src/seloger/SeLogerHousingDriver.h
+++ b/src/seloger/SeLogerHousingDriver.h
@@ -47,6 +47,7 @@ class SeLogerHousingDriver : public AbstractHousingDriver
virtual AbstractHousingDriver::SearchFeatures supportedSearchFeatures() const;
virtual AbstractCityQuery* cityQuery() const;
+ virtual AbstractDistrictQuery* districtQuery() const;
virtual QMap roomsInputs() const;
virtual QMap bedroomsInputs() const;
virtual bool isOwnUrl( const QUrl& url ) const;
diff --git a/src/src.pro b/src/src.pro
index 91fddbb..a2516ad 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -96,6 +96,7 @@ blackberry {
FORMS *= \
widgets/CitySearchWidget.ui \
+ widgets/DistrictSearchWidget.ui \
widgets/InputSearchWidget.ui \
widgets/AnnouncementWidget.ui \
widgets/FeedbackWidget.ui \
@@ -106,19 +107,25 @@ HEADERS *= \
objects/Housing.h \
interface/City.h \
interface/CityModel.h \
+ interface/District.h \
+ interface/DistrictModel.h \
interface/Announcement.h \
interface/AnnouncementModel.h \
interface/AnnouncementProxyModel.h \
interface/AnnouncementItemDelegate.h \
interface/AbstractCityQuery.h \
+ interface/AbstractDistrictQuery.h \
interface/AbstractHousingDriver.h \
interface/Feedback.h \
interface/FeedbackModel.h \
interface/FeedbackItemDelegate.h \
seloger/SeLogerCityQuery.h \
+ seloger/SeLogerDistrictQuery.h \
seloger/SeLogerHousingDriver.h \
widgets/CityComboBox.h \
+ widgets/DistrictComboBox.h \
widgets/CitySearchWidget.h \
+ widgets/DistrictSearchWidget.h \
widgets/InputSearchWidget.h \
widgets/AnnouncementWidget.h \
widgets/AnnouncementView.h \
@@ -131,19 +138,25 @@ SOURCES *= \
objects/Housing.cpp \
interface/City.cpp \
interface/CityModel.cpp \
+ interface/District.cpp \
+ interface/DistrictModel.cpp \
interface/Announcement.cpp \
interface/AnnouncementModel.cpp \
interface/AnnouncementProxyModel.cpp \
interface/AnnouncementItemDelegate.cpp \
interface/AbstractCityQuery.cpp \
+ interface/AbstractDistrictQuery.cpp \
interface/AbstractHousingDriver.cpp \
interface/Feedback.cpp \
interface/FeedbackModel.cpp \
interface/FeedbackItemDelegate.cpp \
seloger/SeLogerCityQuery.cpp \
+ seloger/SeLogerDistrictQuery.cpp \
seloger/SeLogerHousingDriver.cpp \
widgets/CityComboBox.cpp \
+ widgets/DistrictComboBox.cpp \
widgets/CitySearchWidget.cpp \
+ widgets/DistrictSearchWidget.cpp \
widgets/InputSearchWidget.cpp \
widgets/AnnouncementWidget.cpp \
widgets/AnnouncementView.cpp \
diff --git a/src/widgets/CityComboBox.cpp b/src/widgets/CityComboBox.cpp
index 2c33d7b..e3ae014 100644
--- a/src/widgets/CityComboBox.cpp
+++ b/src/widgets/CityComboBox.cpp
@@ -65,7 +65,7 @@ class CityComboBoxPrivate : public QObject {
private slots:
void updateQuery() {
if ( !query ) {
- comboBox->setToolTip( CityComboBox::tr( "No AbstractCityQuery setted." ) );
+ comboBox->setToolTip( CityComboBox::tr( "No AbstractCityQuery set." ) );
return;
}
diff --git a/src/widgets/DistrictComboBox.cpp b/src/widgets/DistrictComboBox.cpp
new file mode 100644
index 0000000..bae36f9
--- /dev/null
+++ b/src/widgets/DistrictComboBox.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictComboBox.cpp
+** Date : 2015-09-06T00:17:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "DistrictComboBox.h"
+#include "interface/DistrictModel.h"
+#include "interface/AbstractDistrictQuery.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class DistrictComboBoxPrivate : public QObject {
+ Q_OBJECT
+
+public:
+ DistrictComboBox* comboBox;
+ DistrictModel* model;
+ QTimer* timer;
+ AbstractDistrictQuery* query;
+
+public:
+ DistrictComboBoxPrivate( DistrictComboBox* _cb )
+ : QObject( _cb ),
+ comboBox( _cb ),
+ model( new DistrictModel( this ) ),
+ timer( new QTimer( this ) ),
+ query( 0 )
+ {
+ comboBox->setEditable( true );
+ comboBox->setModel( model );
+ comboBox->setModelColumn( 0 );
+ comboBox->lineEdit()->setPlaceholderText( DistrictComboBox::tr( "Type a district name / zip code..." ) );
+ timer->setInterval( 500 );
+ timer->setSingleShot( true );
+
+ connect( comboBox->lineEdit(), SIGNAL( textEdited( const QString& ) ), timer, SLOT( start() ) );
+ connect( timer, SIGNAL( timeout() ), this, SLOT( updateQuery() ) );
+ }
+
+private slots:
+ void updateQuery() {
+ if ( !query ) {
+ comboBox->setToolTip( DistrictComboBox::tr( "No AbstractDistrictQuery set." ) );
+ return;
+ }
+
+ const QString text = comboBox->lineEdit()->text();
+
+ if ( text.length() < query->minimumSearchLength() ) {
+ return;
+ }
+
+ query->search( text );
+ }
+
+ void setToolTip( const QString& text ) {
+ comboBox->setToolTip( text );
+ QToolTip::showText( comboBox->mapToGlobal( QPoint( 1, 1 ) ), text, comboBox );
+ }
+
+ void districtsReceived( const District::List& districts ) {
+ model->setDistricts( districts );
+
+ if ( !districts.isEmpty() ) {
+ comboBox->showPopup();
+ }
+ }
+};
+
+DistrictComboBox::DistrictComboBox( QWidget* parent )
+ : pComboBox( parent ),
+ d( new DistrictComboBoxPrivate( this ) )
+{
+}
+
+DistrictComboBox::~DistrictComboBox()
+{
+}
+
+void DistrictComboBox::setDistrictQuery( AbstractDistrictQuery* query )
+{
+ if ( d->query == query ) {
+ return;
+ }
+
+ if ( d->query ) {
+ disconnect( d->query, SIGNAL( error( const QString& ) ), d, SLOT( setToolTip( const QString& ) ) );
+ disconnect( d->query, SIGNAL( districtsReceived( const District::List& ) ), d, SLOT( districtsReceived( const District::List& ) ) );
+ d->query->deleteLater();
+ }
+
+ d->query = query;
+
+ if ( d->query ) {
+ d->query->setParent( this );
+ connect( d->query, SIGNAL( error( const QString& ) ), d, SLOT( setToolTip( const QString& ) ) );
+ connect( d->query, SIGNAL( districtsReceived( const District::List& ) ), d, SLOT( districtsReceived( const District::List& ) ) );
+ }
+}
+
+AbstractDistrictQuery* DistrictComboBox::districtQuery() const
+{
+ return d->query;
+}
+
+District DistrictComboBox::district() const
+{
+ return d->model->district( d->model->index( currentIndex(), modelColumn() ) );
+}
+
+#include "DistrictComboBox.moc"
diff --git a/src/widgets/DistrictComboBox.h b/src/widgets/DistrictComboBox.h
new file mode 100644
index 0000000..ce1f1a8
--- /dev/null
+++ b/src/widgets/DistrictComboBox.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictComboBox.h
+** Date : 2015-09-06T00:17:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef DISTRICTCOMBOBOX_H
+#define DISTRICTCOMBOBOX_H
+
+#include "FreshGui/pComboBox"
+
+#include "interface/District.h"
+
+class DistrictComboBoxPrivate;
+class AbstractDistrictQuery;
+
+class DistrictComboBox : public pComboBox
+{
+ Q_OBJECT
+
+public:
+ DistrictComboBox( QWidget* parent = 0 );
+ virtual ~DistrictComboBox();
+
+ void setDistrictQuery( AbstractDistrictQuery* query );
+ AbstractDistrictQuery* districtQuery() const;
+
+ District district() const;
+
+private:
+ DistrictComboBoxPrivate* d;
+};
+
+#endif // DISTRICTCOMBOBOX_H
diff --git a/src/widgets/DistrictSearchWidget.cpp b/src/widgets/DistrictSearchWidget.cpp
new file mode 100644
index 0000000..7c4e8a0
--- /dev/null
+++ b/src/widgets/DistrictSearchWidget.cpp
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictSearchWidget.cpp
+** Date : 2015-09-06T00:26:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#include "DistrictSearchWidget.h"
+#include "ui_DistrictSearchWidget.h"
+#include "interface/AbstractDistrictQuery.h"
+#include "interface/DistrictModel.h"
+
+#include
+#include
+#include
+
+class DistrictSearchWidgetPrivate : public QObject {
+ Q_OBJECT
+
+public:
+ DistrictSearchWidget* widget;
+ Ui_DistrictSearchWidget* ui;
+ DistrictModel* model;
+
+public:
+ DistrictSearchWidgetPrivate( DistrictSearchWidget* _widget )
+ : QObject( _widget ),
+ widget( _widget ),
+ ui( new Ui_DistrictSearchWidget ),
+ model( new DistrictModel( this ) )
+ {
+ ui->setupUi( widget );
+ ui->lvDistricts->setModel( model );
+
+ model->setCodeVisible( true );
+
+ updateButtons();
+
+ connect( ui->tbDistrictAdd, SIGNAL( clicked() ), this, SLOT( addDistrict() ) );
+ connect( ui->tbDistrictRemove, SIGNAL( clicked() ), this, SLOT( removeDistricts() ) );
+ connect( ui->tbDistrictClear, SIGNAL( clicked() ), this, SLOT( clearDistricts() ) );
+ connect( ui->lvDistricts->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( updateButtons() ) );
+ connect( model, SIGNAL( rowsInserted( const QModelIndex&, int, int ) ), this, SLOT( updateButtons() ) );
+ connect( model, SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ), this, SLOT( updateButtons() ) );
+ connect( model, SIGNAL( layoutChanged() ), this, SLOT( updateButtons() ) );
+ connect( model, SIGNAL( modelReset() ), this, SLOT( updateButtons() ) );
+ }
+
+ ~DistrictSearchWidgetPrivate() {
+ delete ui;
+ }
+
+ void retranslateUi() {
+ ui->retranslateUi( widget );
+ }
+
+private slots:
+ void addDistrict() {
+ model->addDistrict( ui->cbDistrict->district() );
+ }
+
+ void removeDistricts() {
+ model->removeDistricts( ui->lvDistricts->selectionModel()->selectedIndexes() );
+ }
+
+ void clearDistricts() {
+ const QString title = QString::null;
+ const QString message = DistrictSearchWidget::tr( "Are you sure you want to clear the list ?" );
+ const QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
+ const QMessageBox::StandardButton defaultButton = QMessageBox::No;
+
+ if ( QMessageBox::question( widget->window(), title, message, buttons, defaultButton ) == defaultButton ) {
+ return;
+ }
+
+ model->clear();
+ }
+
+ void updateButtons() {
+ const bool hasDistricts = model->rowCount() > 0;
+ const bool hasSelection = !ui->lvDistricts->selectionModel()->selectedIndexes().isEmpty();
+
+ ui->tbDistrictRemove->setEnabled( hasSelection );
+ ui->tbDistrictClear->setEnabled( hasDistricts );
+ }
+};
+
+DistrictSearchWidget::DistrictSearchWidget( QWidget* parent )
+ : QWidget( parent ),
+ d( new DistrictSearchWidgetPrivate( this ) )
+{
+}
+
+DistrictSearchWidget::~DistrictSearchWidget()
+{
+}
+
+void DistrictSearchWidget::setDistrictQuery( AbstractDistrictQuery* query )
+{
+ d->ui->cbDistrict->setDistrictQuery( query );
+}
+
+AbstractDistrictQuery* DistrictSearchWidget::districtQuery() const
+{
+ return d->ui->cbDistrict->districtQuery();
+}
+
+void DistrictSearchWidget::setDistricts( const District::List& districts )
+{
+ d->model->setDistricts( districts );
+}
+
+District::List DistrictSearchWidget::districts() const
+{
+ return d->model->districts();
+}
+
+void DistrictSearchWidget::setCodeVisible( bool visible )
+{
+ d->model->setCodeVisible( visible );
+}
+
+bool DistrictSearchWidget::isCodeVisible() const
+{
+ return d->model->isCodeVisible();
+}
+
+void DistrictSearchWidget::changeEvent( QEvent* event )
+{
+ QWidget::changeEvent( event );
+
+ if ( event->type() == QEvent::LanguageChange ) {
+ d->retranslateUi();
+ }
+}
+
+#include "DistrictSearchWidget.moc"
diff --git a/src/widgets/DistrictSearchWidget.h b/src/widgets/DistrictSearchWidget.h
new file mode 100644
index 0000000..d2ee7ae
--- /dev/null
+++ b/src/widgets/DistrictSearchWidget.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+**
+** Authors : don-vip
+** Project : Housing
+** FileName : DistrictSearchWidget.h
+** Date : 2015-09-06T00:26:14
+** License : GPL3
+** Home Page : https://github.com/don-vip/housing
+** Comment : An application to search for rent / purchase of appartment / house.
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see .
+**
+****************************************************************************/
+#ifndef DISTRICTSEARCHWIDGET_H
+#define DISTRICTSEARCHWIDGET_H
+
+#include
+
+#include "interface/District.h"
+
+class QEvent;
+class AbstractDistrictQuery;
+class DistrictSearchWidgetPrivate;
+
+class DistrictSearchWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DistrictSearchWidget( QWidget* parent = 0 );
+ virtual ~DistrictSearchWidget();
+
+ void setDistrictQuery( AbstractDistrictQuery* query );
+ AbstractDistrictQuery* districtQuery() const;
+
+ void setDistricts( const District::List& districts );
+ District::List districts() const;
+
+ void setCodeVisible( bool visible );
+ bool isCodeVisible() const;
+
+protected:
+ virtual void changeEvent( QEvent* event );
+
+private:
+ DistrictSearchWidgetPrivate* d;
+};
+
+#endif // DISTRICTSEARCHWIDGET_H
diff --git a/src/widgets/DistrictSearchWidget.ui b/src/widgets/DistrictSearchWidget.ui
new file mode 100644
index 0000000..22a190a
--- /dev/null
+++ b/src/widgets/DistrictSearchWidget.ui
@@ -0,0 +1,129 @@
+
+
+ DistrictSearchWidget
+
+
+
+ 0
+ 0
+ 300
+ 260
+
+
+
+
+ 0
+
+ -
+
+
+ District:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Add to the list
+
+
+
+
+
+
+ -
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+ QAbstractItemView::ScrollPerPixel
+
+
+ QAbstractItemView::ScrollPerPixel
+
+
+ QListView::Adjust
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+
+
-
+
+
+ Remove selection from the list
+
+
+
+
+
+
+ -
+
+
+ Clear the list
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 163
+
+
+
+
+
+
+
+
+
+
+
+ DistrictComboBox
+ QComboBox
+ widgets/DistrictComboBox.h
+
+
+
+
+
diff --git a/src/widgets/InputSearchWidget.cpp b/src/widgets/InputSearchWidget.cpp
index 9c6c82f..a4a46a7 100644
--- a/src/widgets/InputSearchWidget.cpp
+++ b/src/widgets/InputSearchWidget.cpp
@@ -112,6 +112,7 @@ public slots:
const QMap bedrooms = driver->bedroomsInputs();
ui->cswCities->setCityQuery( driver->cityQuery() );
+ ui->cswDistricts->setDistrictQuery( driver->districtQuery() );
ui->cbRooms->clear();
ui->cbBedrooms->clear();
@@ -276,6 +277,7 @@ void InputSearchWidget::setRequestProperties( const AbstractHousingDriver::Reque
}
d->ui->cswCities->setCities( properties.cities );
+ d->ui->cswDistricts->setDistricts( properties.districts );
cb = d->ui->cbRooms;
const QSet roomsSet = properties.numberOfRooms().toSet();
@@ -335,6 +337,7 @@ AbstractHousingDriver::RequestProperties InputSearchWidget::requestProperties()
}
properties.cities = d->ui->cswCities->cities();
+ properties.districts = d->ui->cswDistricts->districts();
cb = d->ui->cbRooms;
QVariantList rooms;
diff --git a/src/widgets/InputSearchWidget.ui b/src/widgets/InputSearchWidget.ui
index cbd0ebe..af6f6ef 100644
--- a/src/widgets/InputSearchWidget.ui
+++ b/src/widgets/InputSearchWidget.ui
@@ -71,14 +71,17 @@
-
-
+
- Cities
+ Cities / Districts
-
+ -
+
+
@@ -317,6 +320,12 @@
widgets/CitySearchWidget.h
1
+
+ DistrictSearchWidget
+ QWidget
+ widgets/DistrictSearchWidget.h
+ 1
+
pComboBox
QComboBox
diff --git a/translations/housing_en_US.ts b/translations/housing_en_US.ts
index 51efde5..fc7fb64 100644
--- a/translations/housing_en_US.ts
+++ b/translations/housing_en_US.ts
@@ -114,7 +114,7 @@
- No AbstractCityQuery setted.
+ No AbstractCityQuery set.
@@ -164,6 +164,65 @@
+
+ DistrictComboBox
+
+
+ Type a district name / zip code...
+
+
+
+
+ No AbstractDistrictQuery set.
+
+
+
+
+ DistrictModel
+
+
+ Label
+
+
+
+
+ Value
+
+
+
+
+ Code
+
+
+
+
+ DistrictSearchWidget
+
+
+ District:
+
+
+
+
+ Add to the list
+
+
+
+
+ Remove selection from the list
+
+
+
+
+ Clear the list
+
+
+
+
+ Are you sure you want to clear the list ?
+
+
+
FeedbackDialog
@@ -249,71 +308,71 @@
- Cities
+ Cities / Districts
-
+
Properties
-
+
Rooms
-
+
Bedrooms
-
+
Budget
-
-
-
+
+
+
Min.
-
-
-
-
-
-
+
+
+
+
+
+
Indifferent
-
-
-
+
+
+
Max.
-
+
Surface
-
+
Ground
-
+
Sorting
-
+
Features
@@ -498,130 +557,214 @@
+
+ SeLogerDistrictQuery
+
+
+ No data found.
+
+
+
+
+ Your text is too short to start the search.
+
+
+
SeLogerHousingDriver
-
+
All
-
+
%s: Can't set focus
-
+
%s: Invalid query
-
+
%s: Can't evaluateTo
- UIMain
+ UIDesktopMain
-
+
Search Results
-
+
Total pages:
-
+
Found:
-
+
Visible:
-
+
Announcements:
-
+
Search Criteria
-
+
Search
-
+
Tools bar
-
+
Feedback
-
+
Switch the ignore state of the announcement
-
+
Switch the bookmark state of the announcement
-
+
Open the announcement in a new tab
-
+
Open the announcement in the default browser
-
+
Geotag the announcement in a new tab
-
+
Geotag the announcement in the default browser
-
+
+ Start search
+
+
+
+
+ UIMain
+
+
Ignored
-
+
Bookmarked
-
+
Normal
-
+
Loading %1...
-
+
Geotaging %1...
+
+ UIMobileMain
+
+
+ Total pages:
+
+
+
+
+ Found:
+
+
+
+
+ Visible:
+
+
+
+
+ Announcements:
+
+
+
+
+ Tools bar
+
+
+
+
+ Switch the ignore state of the announcement
+
+
+
+
+ Switch the bookmark state of the announcement
+
+
+
+
+ Open the announcement in a new tab
+
+
+
+
+ Open the announcement in the default browser
+
+
+
+
+ Geotag the announcement in a new tab
+
+
+
+
+ Geotag the announcement in the default browser
+
+
+
+
+ Start search
+
+
+
diff --git a/translations/housing_fr_FR.qm b/translations/housing_fr_FR.qm
index a2eb8b1..25d9504 100644
Binary files a/translations/housing_fr_FR.qm and b/translations/housing_fr_FR.qm differ
diff --git a/translations/housing_fr_FR.ts b/translations/housing_fr_FR.ts
index 8967741..897e367 100644
--- a/translations/housing_fr_FR.ts
+++ b/translations/housing_fr_FR.ts
@@ -21,7 +21,7 @@
Rooms
- Piéces
+ Pièces
@@ -114,8 +114,8 @@
- No AbstractCityQuery setted.
- Pas d'objet de recherche définit.
+ No AbstractCityQuery set.
+ Pas d'objet de recherche défini.
@@ -151,7 +151,7 @@
Remove selection from the list
- Enlever la séléction de la liste
+ Enlever la sélection de la liste
@@ -164,6 +164,65 @@
Êtes vous sûr de vouloir vider la liste ?
+
+ DistrictComboBox
+
+
+ Type a district name / zip code...
+ Ecrivez le nom d'un quartier / un code postal...
+
+
+
+ No AbstractDistrictQuery set.
+ Pas d'objet de recherche défini.
+
+
+
+ DistrictModel
+
+
+ Label
+ Libellé
+
+
+
+ Value
+ Valeur
+
+
+
+ Code
+ Code postal
+
+
+
+ DistrictSearchWidget
+
+
+ District:
+ Quartier :
+
+
+
+ Add to the list
+ Ajouter à la liste
+
+
+
+ Remove selection from the list
+ Enlever la sélection de la liste
+
+
+
+ Clear the list
+ Vider la liste
+
+
+
+ Are you sure you want to clear the list ?
+ Êtes vous sûr de vouloir vider la liste ?
+
+
FeedbackDialog
@@ -248,72 +307,76 @@
Achat
-
Cities
- Villes
+ Villes
+
+
+
+ Cities / Districts
+ Villes / Quartiers
-
+
Properties
Propriétés
-
+
Rooms
Piéces
-
+
Bedrooms
Chambres
-
+
Budget
Budget
-
-
-
+
+
+
Min.
Min.
-
-
-
-
-
-
+
+
+
+
+
+
Indifferent
Indifférent
-
-
-
+
+
+
Max.
Max.
-
+
Surface
Surface
-
+
Ground
Terrain
-
+
Sorting
Tri
-
+
Features
Avancés
@@ -498,130 +561,274 @@
Votre texte est trop court pour commencer la recherche.
+
+ SeLogerDistrictQuery
+
+
+ No data found.
+ Aucun résultat.
+
+
+
+ Your text is too short to start the search.
+ Votre texte est trop court pour commencer la recherche.
+
+
SeLogerHousingDriver
-
+
All
Tout
-
+
%s: Can't set focus
%s: Impossible de définir le centre
-
+
%s: Invalid query
%s: Requête invalide
-
+
%s: Can't evaluateTo
%s: Impossible d'évaluer
- UIMain
+ UIDesktopMain
-
+
Search Results
Résultats de recherche
-
+
Total pages:
Page totales:
-
+
Found:
Trouvées:
-
+
Visible:
Visibles:
-
+
Announcements:
Annonces:
-
+
Search Criteria
- Critéres de recherche
+ Critères de recherche
-
+
Search
Rechercher
-
+
Tools bar
Barre d'outils
-
+
Feedback
Suivi
-
+
Switch the ignore state of the announcement
Changer l'état ignoré de l'annonce
-
+
Switch the bookmark state of the announcement
Changer l'état favori de l'annonce
-
+
Open the announcement in a new tab
Ouvrir l'annonce dans un nouvel onglet
-
+
Open the announcement in the default browser
Ouvrir l'annonce dans le navigateur par défaut
-
+
Geotag the announcement in a new tab
Géolocaliser l'annonce dans un nouvel onglet
-
+
Geotag the announcement in the default browser
Géolocaliser l'annonce dans le navigateur par défaut
-
+
+ Start search
+ Lancer la recherche
+
+
+
+ UIMain
+
+ Search Results
+ Résultats de recherche
+
+
+ Total pages:
+ Page totales:
+
+
+ Found:
+ Trouvées:
+
+
+ Visible:
+ Visibles:
+
+
+ Announcements:
+ Annonces:
+
+
+ Search Criteria
+ Critéres de recherche
+
+
+ Search
+ Rechercher
+
+
+ Tools bar
+ Barre d'outils
+
+
+ Feedback
+ Suivi
+
+
+ Switch the ignore state of the announcement
+ Changer l'état ignoré de l'annonce
+
+
+ Switch the bookmark state of the announcement
+ Changer l'état favori de l'annonce
+
+
+ Open the announcement in a new tab
+ Ouvrir l'annonce dans un nouvel onglet
+
+
+ Open the announcement in the default browser
+ Ouvrir l'annonce dans le navigateur par défaut
+
+
+ Geotag the announcement in a new tab
+ Géolocaliser l'annonce dans un nouvel onglet
+
+
+ Geotag the announcement in the default browser
+ Géolocaliser l'annonce dans le navigateur par défaut
+
+
+
Ignored
Ignoré
-
+
Bookmarked
Favori
-
+
Normal
Normal
-
+
Loading %1...
Chargement de %1...
-
+
Geotaging %1...
Géolocalisation de %1...
+
+ UIMobileMain
+
+
+ Total pages:
+ Page totales:
+
+
+
+ Found:
+ Trouvées:
+
+
+
+ Visible:
+ Visibles:
+
+
+
+ Announcements:
+ Annonces:
+
+
+
+ Tools bar
+ Barre d'outils
+
+
+
+ Switch the ignore state of the announcement
+ Changer l'état ignoré de l'annonce
+
+
+
+ Switch the bookmark state of the announcement
+ Changer l'état favori de l'annonce
+
+
+
+ Open the announcement in a new tab
+ Ouvrir l'annonce dans un nouvel onglet
+
+
+
+ Open the announcement in the default browser
+ Ouvrir l'annonce dans le navigateur par défaut
+
+
+
+ Geotag the announcement in a new tab
+ Géolocaliser l'annonce dans un nouvel onglet
+
+
+
+ Geotag the announcement in the default browser
+ Géolocaliser l'annonce dans le navigateur par défaut
+
+
+
+ Start search
+ Lancer la recherche
+
+