summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/ServerList/ServerListDelegate.h')
-rw-r--r--Swift/QtUI/ServerList/ServerListDelegate.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Swift/QtUI/ServerList/ServerListDelegate.h b/Swift/QtUI/ServerList/ServerListDelegate.h
new file mode 100644
index 0000000..79afc37
--- /dev/null
+++ b/Swift/QtUI/ServerList/ServerListDelegate.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <QStyledItemDelegate>
+
+#include <Swiften/Elements/StatusShow.h>
+
+#include <Swift/QtUI/Roster/DelegateCommons.h>
+
+namespace Swift {
+
+ class ServerListDelegate : public QStyledItemDelegate {
+ public:
+ ServerListDelegate();
+ ~ServerListDelegate();
+ QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
+ private:
+ void paintServerAvatar(QPainter* painter, const QStyleOptionViewItem& option, const QString& avatarPath, const StatusShow& presence, bool isIdle, size_t unreadCount) const;
+ private:
+ DelegateCommons common_;
+ static const int presenceIconHeight = 12;
+ static const int presenceIconWidth = 12;
+ };
+
+}