Skip to content

Commit

Permalink
Merge pull request #1430 from Karry/object-info-opening-hours
Browse files Browse the repository at this point in the history
expose opening hours from MapObjectInfoModel
  • Loading branch information
Framstag committed May 13, 2023
2 parents ba5e6f4 + cec1ca3 commit d119fbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions libosmscout-client-qt/include/osmscoutclientqt/LookupModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <osmscout/feature/PhoneFeature.h>
#include <osmscout/feature/WebsiteFeature.h>
#include <osmscout/feature/OpeningHoursFeature.h>

#include <osmscoutclientqt/DBThread.h>
#include <osmscoutclientqt/ClientQtImportExport.h>
Expand Down Expand Up @@ -73,6 +74,7 @@ class OSMSCOUT_CLIENT_QT_API LookupModule:public QObject{
QString altLangName;
QString phone;
QString website;
QString openingHours;
QString addressNumber;
LocationDescriptionService::ReverseLookupRef reverseLookupRef;
QList<AdminRegionInfoRef> adminRegionList;
Expand Down Expand Up @@ -200,6 +202,10 @@ public slots:
info.website=QString::fromStdString(website->GetWebsite());
}

if (const osmscout::OpeningHoursFeatureValue *openingHours=features.findValue<osmscout::OpeningHoursFeatureValue>(); openingHours!=nullptr){
info.openingHours=QString::fromStdString(openingHours->GetValue());
}

if (const osmscout::AddressFeatureValue *address=features.findValue<osmscout::AddressFeatureValue>(); address!=nullptr){
info.addressNumber=QString::fromStdString(address->GetAddress());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class OSMSCOUT_CLIENT_QT_API MapObjectInfoModel: public QAbstractListModel
RegionRole = Qt::UserRole+10,
LatRole = Qt::UserRole+11,
LonRole = Qt::UserRole+12,
AltLangName = Qt::UserRole+13
AltLangName = Qt::UserRole+13,
OpeningHours = Qt::UserRole+14
};
Q_ENUM(Roles)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ QHash<int, QByteArray> MapObjectInfoModel::roleNames() const
roles[LatRole] = "lat";
roles[LonRole] = "lon";
roles[AltLangName] = "altLangName";
roles[OpeningHours] = "openingHours";

return roles;
}
Expand Down Expand Up @@ -194,6 +195,9 @@ QVariant MapObjectInfoModel::data(const QModelIndex &index, int role) const
if (role==LonRole){
return QVariant::fromValue(obj.center.GetLon());
}
if (role==OpeningHours){
return QVariant::fromValue(obj.openingHours);
}

//qDebug() << "Undefined role" << role << "("<<LabelRole<<"..."<<NameRole<<")";
return QVariant();
Expand Down

0 comments on commit d119fbd

Please sign in to comment.