Fix a few conversions

pull/1614/head
Nicolas Werner 1 year ago
parent 4faeae5c73
commit 50bce25838
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 3
      src/Utils.cpp
  2. 1
      src/timeline/EventStore.cpp
  3. 13
      src/timeline/EventStore.h
  4. 1
      src/timeline/TimelineModel.h

@ -632,7 +632,8 @@ rainbowify(cmark_node *node)
// get correct color for char index // get correct color for char index
// Use colors as described here: // Use colors as described here:
// https://shark.comfsm.fm/~dleeling/cis/hsl_rainbow.html // https://shark.comfsm.fm/~dleeling/cis/hsl_rainbow.html
auto color = QColor::fromHslF((charIdx - 1.0) / textLen * (5. / 6.), 0.9, 0.5); auto color = QColor::fromHslF(
static_cast<float>((charIdx - 1.0) / textLen * (5. / 6.)), 0.9f, 0.5f);
// format color for HTML // format color for HTML
auto colorString = color.name(QColor::NameFormat::HexRgb); auto colorString = color.name(QColor::NameFormat::HexRgb);
// create HTML element for current char // create HTML element for current char

@ -15,6 +15,7 @@
#include "EventAccessors.h" #include "EventAccessors.h"
#include "Logging.h" #include "Logging.h"
#include "MatrixClient.h" #include "MatrixClient.h"
#include "Reaction.h"
#include "UserSettingsPage.h" #include "UserSettingsPage.h"
#include "Utils.h" #include "Utils.h"

@ -16,7 +16,6 @@
#include <mtx/responses/messages.hpp> #include <mtx/responses/messages.hpp>
#include <mtx/responses/sync.hpp> #include <mtx/responses/sync.hpp>
#include "Reaction.h"
#include "encryption/Olm.h" #include "encryption/Olm.h"
class EventStore final : public QObject class EventStore final : public QObject
@ -29,7 +28,7 @@ public:
void refetchOnlineKeyBackupKeys(); void refetchOnlineKeyBackupKeys();
// taken from QtPrivate::QHashCombine // taken from QtPrivate::QHashCombine
static uint hashCombine(uint hash, uint seed) static size_t hashCombine(uint hash, uint seed)
{ {
return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2)); return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2));
}; };
@ -38,9 +37,9 @@ public:
std::string room; std::string room;
uint64_t idx; uint64_t idx;
friend uint qHash(const Index &i, uint seed = 0) noexcept friend size_t qHash(const Index &i, size_t seed = 0) noexcept
{ {
seed = hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); seed = hashCombine(qHashBits(i.room.data(), i.room.size(), seed), seed);
seed = hashCombine(qHash(i.idx, seed), seed); seed = hashCombine(qHash(i.idx, seed), seed);
return seed; return seed;
} }
@ -54,10 +53,10 @@ public:
{ {
std::string room, id; std::string room, id;
friend uint qHash(const IdIndex &i, uint seed = 0) noexcept friend size_t qHash(const IdIndex &i, size_t seed = 0) noexcept
{ {
seed = hashCombine(qHashBits(i.room.data(), (int)i.room.size(), seed), seed); seed = hashCombine(qHashBits(i.room.data(), i.room.size(), seed), seed);
seed = hashCombine(qHashBits(i.id.data(), (int)i.id.size(), seed), seed); seed = hashCombine(qHashBits(i.id.data(), i.id.size(), seed), seed);
return seed; return seed;
} }

@ -19,6 +19,7 @@
#include "EventStore.h" #include "EventStore.h"
#include "InputBar.h" #include "InputBar.h"
#include "Permissions.h" #include "Permissions.h"
#include "Reaction.h"
#include "ReadReceiptsModel.h" #include "ReadReceiptsModel.h"
#include "ui/RoomSummary.h" #include "ui/RoomSummary.h"

Loading…
Cancel
Save