Skip to content

Commit

Permalink
Use cid as good as we can to show friend status and possibly use alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaseberle committed May 8, 2023
1 parent 976066b commit 0ddb685
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/BookedAtcDialogModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ QVariant BookedAtcDialogModel::data(const QModelIndex &index, int role) const {
if(!index.isValid() || (index.row() >= rowCount(index)))
return QVariant();

if(role == Qt::DisplayRole) {
if(role == Qt::FontRole) {
BookedController* c = _controllers[index.row()];
QFont result;
result.setBold(c->isFriend());
return result;
} else if(role == Qt::DisplayRole) {
BookedController* c = _controllers[index.row()];
switch(index.column()) {
case 0: return c->label;
Expand Down
7 changes: 4 additions & 3 deletions src/BookedController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
BookedController::BookedController(const QJsonObject& json, const WhazzupData* whazzup) :
Client(json, whazzup)
{
m_name = userId;

bookingType = json["type"].toString();
m_starts = QDateTime::fromString(json["start"].toString() + "Z", "yyyy-MM-dd HH:mm:sst");

timeConnected = m_starts = QDateTime::fromString(json["start"].toString() + "Z", "yyyy-MM-dd HH:mm:sst");
m_ends = QDateTime::fromString(json["end"].toString() + "Z", "yyyy-MM-dd HH:mm:sst");

if(bookingType == "booking") {
Expand Down Expand Up @@ -38,8 +41,6 @@ BookedController::BookedController(const QJsonObject& json, const WhazzupData* w
} else if (label.right(4) == "_FSS") {
facilityType = 7;
}

timeConnected = starts();
}

QString BookedController::facilityString() const {
Expand Down
4 changes: 2 additions & 2 deletions src/WhazzupData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ WhazzupData::WhazzupData(QByteArray* bytes, WhazzupType type):
} else if(type == ATCBOOKINGS) {
QJsonArray json = data.array();
for(int i = 0; i < json.size(); ++i) {
QJsonObject bookedControllerObject = json[i].toObject();
BookedController *bc = new BookedController(bookedControllerObject, this);
QJsonObject bookedControllerJson = json[i].toObject();
BookedController *bc = new BookedController(bookedControllerJson, this);
bookedControllers.append(bc);
}
bookingsTime = QDateTime::currentDateTime();
Expand Down

0 comments on commit 0ddb685

Please sign in to comment.