fixed bug due to passing shared_ptr to RsThread::async() without making an explicit copy before

This commit is contained in:
csoler 2020-11-08 18:25:20 +01:00
commit d2bd947252
31 changed files with 632 additions and 443 deletions

View file

@ -16,6 +16,7 @@
# version format # version format
version: RetroShare-git-{branch}-{build} version: RetroShare-git-{branch}-{build}
image: Visual Studio 2019
# you can use {branch} name in version format too # you can use {branch} name in version format too
# version: 1.0.{build}-{branch} # version: 1.0.{build}-{branch}
@ -94,7 +95,7 @@ install:
- set PATH=C:\msys64\usr\bin;%PATH% - set PATH=C:\msys64\usr\bin;%PATH%
- set PATH=C:\msys64\mingw32\bin;%PATH% - set PATH=C:\msys64\mingw32\bin;%PATH%
- > - >
pacman --noconfirm -S pacman --noconfirm -Sy
mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-rapidjson mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-rapidjson
mingw-w64-i686-sqlcipher mingw-w64-i686-xapian-core mingw-w64-i686-cmark mingw-w64-i686-sqlcipher mingw-w64-i686-xapian-core mingw-w64-i686-cmark
#- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH% #- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH%

View file

@ -416,7 +416,7 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
} }
// have to convert to virtual peer id, to be able to use existing serialiser and file format // have to convert to virtual peer id, to be able to use existing serialiser and file format
bool p3HistoryMgr::chatIdToVirtualPeerId(ChatId chat_id, RsPeerId &peer_id) bool p3HistoryMgr::chatIdToVirtualPeerId(const ChatId& chat_id, RsPeerId &peer_id)
{ {
if (chat_id.isBroadcast()) { if (chat_id.isBroadcast()) {
peer_id = RsPeerId(); peer_id = RsPeerId();

View file

@ -68,9 +68,9 @@ public:
virtual void saveDone(); virtual void saveDone();
virtual bool loadList(std::list<RsItem*>& load); virtual bool loadList(std::list<RsItem*>& load);
private: static bool chatIdToVirtualPeerId(const ChatId& chat_id, RsPeerId& peer_id);
static bool chatIdToVirtualPeerId(ChatId chat_id, RsPeerId& peer_id);
private:
uint32_t nextMsgId; uint32_t nextMsgId;
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> > mMessages; std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> > mMessages;

View file

@ -1876,7 +1876,9 @@ bool p3PeerMgrIMPL::getExtAddressReportedByFriends(sockaddr_storage &addr, uint8
static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr) static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr)
{ {
bool changed = false ; bool changed = false ;
#ifdef PEER_DEBUG
rstime_t now = time(NULL) ; rstime_t now = time(NULL) ;
#endif
for(std::list<pqiIpAddress>::iterator it2(lst.begin());it2 != lst.end();) for(std::list<pqiIpAddress>::iterator it2(lst.begin());it2 != lst.end();)
{ {

View file

@ -70,6 +70,7 @@ public:
class RsHistory class RsHistory
{ {
public: public:
virtual bool chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id) = 0;
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount) = 0; virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount) = 0;
virtual bool getMessage(uint32_t msgId, HistoryMsg &msg) = 0; virtual bool getMessage(uint32_t msgId, HistoryMsg &msg) = 0;
virtual void removeMessages(const std::list<uint32_t> &msgIds) = 0; virtual void removeMessages(const std::list<uint32_t> &msgIds) = 0;
@ -77,8 +78,9 @@ public:
virtual bool getEnable(uint32_t chat_type) = 0; virtual bool getEnable(uint32_t chat_type) = 0;
virtual void setEnable(uint32_t chat_type, bool enable) = 0; virtual void setEnable(uint32_t chat_type, bool enable) = 0;
virtual uint32_t getMaxStorageDuration() = 0 ;
virtual void setMaxStorageDuration(uint32_t seconds) = 0 ; virtual uint32_t getMaxStorageDuration() = 0;
virtual void setMaxStorageDuration(uint32_t seconds) = 0;
// 0 = no limit, >0 count of saved messages // 0 = no limit, >0 count of saved messages
virtual uint32_t getSaveCount(uint32_t chat_type) = 0; virtual uint32_t getSaveCount(uint32_t chat_type) = 0;

View file

@ -6,7 +6,7 @@
* Copyright (c) 2004-2009 Marcelo Roberto Jimenez ( phoenix@amule.org ) * * Copyright (c) 2004-2009 Marcelo Roberto Jimenez ( phoenix@amule.org ) *
* Copyright (c) 2006-2009 aMule Team ( admin@amule.org / http://www.amule.org)* * Copyright (c) 2006-2009 aMule Team ( admin@amule.org / http://www.amule.org)*
* Copyright (c) 2009-2010 Retroshare Team * * Copyright (c) 2009-2010 Retroshare Team *
* Copyright (C) 2019 Gioacchino Mazzurco <gio@eigenlab.org> * * Copyright (C) 2019-2020 Gioacchino Mazzurco <gio@eigenlab.org> *
* * * *
* This program is free software: you can redistribute it and/or modify * * This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -35,6 +35,7 @@
#include "util/rsstring.h" #include "util/rsstring.h"
#include "rs_upnp/upnp18_retrocompat.h" #include "rs_upnp/upnp18_retrocompat.h"
#include "util/rstime.h" #include "util/rstime.h"
#include "util/rsdebug.h"
#ifdef __GNUC__ #ifdef __GNUC__
#if __GNUC__ >= 4 #if __GNUC__ >= 4
@ -924,15 +925,17 @@ m_WanService(NULL)
// Pointer to self // Pointer to self
s_CtrlPoint = this; s_CtrlPoint = this;
// Start UPnP
int ret;
char *ipAddress = NULL;
unsigned short port = 0;
#ifdef UPNP_DEBUG #ifdef UPNP_DEBUG
int resLog = UpnpInitLog(); int resLog = UpnpInitLog();
std::cerr << "UPnPControlPoint::CUPnPControlPoint() Init log : " << resLog << std::endl; std::cerr << "UPnPControlPoint::CUPnPControlPoint() Init log : " << resLog << std::endl;
#endif #endif
ret = UpnpInit(ipAddress, udpPort);
#if UPNP_VERSION < 11400
int ret = UpnpInit(nullptr, udpPort);
#else
int ret = UpnpInit2(nullptr, udpPort);
#endif
#ifdef UPNP_DEBUG #ifdef UPNP_DEBUG
std::cerr << "CUPnPControlPoint Constructor UpnpInit finished" << std::endl; std::cerr << "CUPnPControlPoint Constructor UpnpInit finished" << std::endl;
#endif #endif
@ -942,15 +945,8 @@ m_WanService(NULL)
#endif #endif
goto error; goto error;
} }
port = UpnpGetServerPort();
ipAddress = UpnpGetServerIpAddress(); RS_INFO("bound to ", UpnpGetServerIpAddress(), ":", UpnpGetServerPort());
#ifdef UPNP_DEBUG
std::cerr << "UPnPControlPoint::CUPnPControlPoint() bound to " << ipAddress << ":" <<
port << "." << std::endl;
#else
// unused variable
(void)port;
#endif
ret = UpnpRegisterClient( ret = UpnpRegisterClient(
reinterpret_cast<Upnp_FunPtr>(&CUPnPControlPoint::Callback), reinterpret_cast<Upnp_FunPtr>(&CUPnPControlPoint::Callback),
@ -1022,7 +1018,6 @@ error:
#ifdef UPNP_DEBUG #ifdef UPNP_DEBUG
std::cerr << "UPnPControlPoint::CUPnPControlPoint() UpnpFinish called within CUPnPControlPoint constructor." << std::endl; std::cerr << "UPnPControlPoint::CUPnPControlPoint() UpnpFinish called within CUPnPControlPoint constructor." << std::endl;
#endif #endif
return;
} }

View file

@ -31,6 +31,11 @@ p3History::~p3History()
{ {
} }
bool p3History::chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id)
{
return mHistoryMgr->chatIdToVirtualPeerId(chat_id, peer_id);
}
void p3History::setMaxStorageDuration(uint32_t seconds) void p3History::setMaxStorageDuration(uint32_t seconds)
{ {
mHistoryMgr->setMaxStorageDuration(seconds) ; mHistoryMgr->setMaxStorageDuration(seconds) ;

View file

@ -37,16 +37,21 @@ public:
p3History(p3HistoryMgr* historyMgr); p3History(p3HistoryMgr* historyMgr);
virtual ~p3History(); virtual ~p3History();
virtual bool chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id);
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount); virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount);
virtual bool getMessage(uint32_t msgId, HistoryMsg &msg); virtual bool getMessage(uint32_t msgId, HistoryMsg &msg);
virtual void removeMessages(const std::list<uint32_t> &msgIds); virtual void removeMessages(const std::list<uint32_t> &msgIds);
virtual void clear(const ChatId &chatPeerId); virtual void clear(const ChatId &chatPeerId);
virtual bool getEnable(uint32_t chat_type); virtual bool getEnable(uint32_t chat_type);
virtual void setEnable(uint32_t chat_type, bool enable); virtual void setEnable(uint32_t chat_type, bool enable);
virtual uint32_t getMaxStorageDuration();
virtual void setMaxStorageDuration(uint32_t seconds);
// 0 = no limit, >0 count of saved messages
virtual uint32_t getSaveCount(uint32_t chat_type); virtual uint32_t getSaveCount(uint32_t chat_type);
virtual void setSaveCount(uint32_t chat_type, uint32_t count); virtual void setSaveCount(uint32_t chat_type, uint32_t count);
virtual void setMaxStorageDuration(uint32_t seconds) ;
virtual uint32_t getMaxStorageDuration() ;
private: private:
p3HistoryMgr* mHistoryMgr; p3HistoryMgr* mHistoryMgr;

View file

@ -234,15 +234,13 @@
<property name="title"> <property name="title">
<string>Chat Room info</string> <string>Chat Room info</string>
</property> </property>
<layout class="QVBoxLayout" name="lobbyinfo_groupBoxVLayout"> <layout class="QGridLayout" name="lobbyinfo_groupBoxgridLayout">
<item> <item row="0" column="0">
<layout class="QHBoxLayout" name="lobbyInfoHLayout"> <layout class="QGridLayout" name="lobbyinfo_gridLayout">
<property name="topMargin"> <property name="topMargin">
<number>6</number> <number>6</number>
</property> </property>
<item> <item row="0" column="0">
<layout class="QVBoxLayout" name="lobbyInfoNameVLayout">
<item>
<widget class="QLabel" name="lobbyname_label"> <widget class="QLabel" name="lobbyname_label">
<property name="font"> <property name="font">
<font> <font>
@ -255,76 +253,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QLabel" name="lobbyid_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Chat room Id:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lobbytopic_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Topic:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lobbytype_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lobbysec_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Security:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lobbypeers_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Peers:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="lobbyInfoValueVLayout">
<item>
<widget class="QLabel" name="lobbyname_lineEdit"> <widget class="QLabel" name="lobbyname_lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -337,7 +266,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QLabel" name="lobbyid_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Chat room Id:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lobbyid_lineEdit"> <widget class="QLabel" name="lobbyid_lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -350,7 +292,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<widget class="QLabel" name="lobbytopic_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Topic:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lobbytopic_lineEdit"> <widget class="QLabel" name="lobbytopic_lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -366,7 +321,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="3" column="0">
<widget class="QLabel" name="lobbytype_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lobbytype_lineEdit"> <widget class="QLabel" name="lobbytype_lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -379,14 +347,40 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="4" column="0">
<widget class="QLabel" name="lobbysec_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Security:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lobbysec_lineEdit"> <widget class="QLabel" name="lobbysec_lineEdit">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="5" column="0">
<widget class="QLabel" name="lobbypeers_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Peers:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="lobbypeers_lineEdit"> <widget class="QLabel" name="lobbypeers_lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -401,9 +395,7 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item row="1" column="0">
</item>
<item>
<widget class="QLabel" name="lobbyInfoLabel"> <widget class="QLabel" name="lobbyInfoLabel">
<property name="text"> <property name="text">
<string notr="true">TextLabel</string> <string notr="true">TextLabel</string>
@ -413,7 +405,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<spacer name="lobbyInfoVSpacer"> <spacer name="lobbyInfoVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>

View file

@ -56,6 +56,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGrou
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost())); connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect(ui->addPicButton, SIGNAL(clicked() ), this , SLOT(addPicture())); connect(ui->addPicButton, SIGNAL(clicked() ), this , SLOT(addPicture()));
connect(ui->RichTextEditWidget, SIGNAL(textSizeOk(bool)),ui->submitButton, SLOT(setEnabled(bool)));
ui->headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/postedlinks.png")); ui->headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/postedlinks.png"));
ui->headerFrame->setHeaderText(tr("Create a new Post")); ui->headerFrame->setHeaderText(tr("Create a new Post"));

View file

@ -42,7 +42,6 @@
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/settings/rsettingswin.h" #include "gui/settings/rsettingswin.h"
#include "gui/settings/RsharePeerSettings.h" #include "gui/settings/RsharePeerSettings.h"
#include "gui/im_history/ImHistoryBrowser.h"
#include "gui/common/StatusDefs.h" #include "gui/common/StatusDefs.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/Emoticons.h" #include "gui/common/Emoticons.h"
@ -78,7 +77,7 @@ ChatWidget::ChatWidget(QWidget *parent)
, lastStatusSendTime(0) , lastStatusSendTime(0)
, firstShow(true), inChatCharFormatChanged(false), firstSearch(true) , firstShow(true), inChatCharFormatChanged(false), firstSearch(true)
, lastUpdateCursorPos(0), lastUpdateCursorEnd(0) , lastUpdateCursorPos(0), lastUpdateCursorEnd(0)
, completer(NULL), notify(NULL) , completer(NULL), imBrowser(NULL), notify(NULL)
, ui(new Ui::ChatWidget) , ui(new Ui::ChatWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -87,8 +86,8 @@ ChatWidget::ChatWidget(QWidget *parent)
double fmm = iconHeight > FMM_THRESHOLD ? FMM : FMM_SMALLER; double fmm = iconHeight > FMM_THRESHOLD ? FMM : FMM_SMALLER;
iconHeight *= fmm; iconHeight *= fmm;
QSize iconSize = QSize(iconHeight, iconHeight); QSize iconSize = QSize(iconHeight, iconHeight);
int butt_size(iconSize.height() + fmm); //int butt_size(iconSize.height() + fmm);
QSize buttonSize = QSize(butt_size, butt_size); //QSize buttonSize = QSize(butt_size, butt_size);
lastMsgDate = QDate::currentDate(); lastMsgDate = QDate::currentDate();
@ -1607,8 +1606,9 @@ void ChatWidget::deleteChatHistory()
void ChatWidget::messageHistory() void ChatWidget::messageHistory()
{ {
ImHistoryBrowser imBrowser(chatId, ui->chatTextEdit, window()); if (!imBrowser)
imBrowser.exec(); imBrowser = new ImHistoryBrowser(chatId, ui->chatTextEdit, this->title, window());
imBrowser->show();
} }
void ChatWidget::addExtraFile() void ChatWidget::addExtraFile()

View file

@ -23,20 +23,22 @@
#ifndef CHATWIDGET_H #ifndef CHATWIDGET_H
#define CHATWIDGET_H #define CHATWIDGET_H
#include <QWidget> #include "ChatLobbyUserNotify.h"
#include <QCompleter> #include "ChatStyle.h"
#include <QTextCursor>
#include <QTextCharFormat>
#include <QToolButton>
#include "gui/common/HashBox.h" #include "gui/common/HashBox.h"
#include "gui/common/RsButtonOnText.h" #include "gui/common/RsButtonOnText.h"
#include "ChatStyle.h" #include "gui/im_history/ImHistoryBrowser.h"
#include "gui/style/RSStyle.h" #include "gui/style/RSStyle.h"
#include "ChatLobbyUserNotify.h"
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <QCompleter>
#include <QTextCharFormat>
#include <QTextCursor>
#include <QToolButton>
#include <QWidget>
//For PersonId anchor. //For PersonId anchor.
#define PERSONID "PersonId:" #define PERSONID "PersonId:"
@ -259,6 +261,7 @@ private:
QDate lastMsgDate ; QDate lastMsgDate ;
QCompleter *completer; QCompleter *completer;
ImHistoryBrowser* imBrowser;
QList<ChatWidgetHolder*> mChatWidgetHolder; QList<ChatWidgetHolder*> mChatWidgetHolder;
ChatLobbyUserNotify* notify; ChatLobbyUserNotify* notify;

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>476</width> <width>421</width>
<height>38</height> <height>39</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -17,6 +17,9 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -138,8 +141,8 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>0</width>
<height>20</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>

View file

@ -58,6 +58,7 @@ void RSTreeView::setAutoSelect(bool b)
void RSTreeView::resizeEvent(QResizeEvent *e) void RSTreeView::resizeEvent(QResizeEvent *e)
{ {
QTreeView::resizeEvent(e);
emit sizeChanged(e->size()); emit sizeChanged(e->size());
} }

View file

@ -26,6 +26,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <iostream> #include <iostream>
static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000;
GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author,QWidget *parent) : GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author,QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId) ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId)
@ -33,6 +35,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, co
ui->setupUi(this); ui->setupUi(this);
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createComment())); connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createComment()));
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->commentTextEdit, SIGNAL(textChanged()), this, SLOT(checkLength()));
/* fill in the available OwnIds for signing */ /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author); ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author);
@ -105,3 +108,19 @@ GxsCreateCommentDialog::~GxsCreateCommentDialog()
{ {
delete ui; delete ui;
} }
void GxsCreateCommentDialog::checkLength(){
QString text;
RsHtml::optimizeHtml(ui->commentTextEdit, text);
std::wstring msg = text.toStdWString();
int charRemains = MAX_ALLOWED_GXS_MESSAGE_SIZE - msg.length();
if(charRemains >= 0) {
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
ui->infoLabel->setStyleSheet("QLabel#infoLabel { }");
}else{
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
ui->infoLabel->setStyleSheet("QLabel#infoLabel {color: red; font: bold; }");
}
ui->postButton->setEnabled(charRemains>=0);
ui->infoLabel->setText(text);
}

View file

@ -43,6 +43,7 @@ public:
private slots: private slots:
void createComment(); void createComment();
void checkLength();
private: private:
Ui::GxsCreateCommentDialog *ui; Ui::GxsCreateCommentDialog *ui;

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>459</width> <width>505</width>
<height>324</height> <height>367</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -32,7 +32,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -142,17 +142,20 @@ p, li { white-space: pre-wrap; }
<property name="topMargin"> <property name="topMargin">
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0"> <item row="5" column="0">
<widget class="GxsIdLabel" name="replaytolabel"> <spacer name="horizontalSpacer">
<property name="styleSheet"> <property name="orientation">
<string notr="true"/> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="text"> <property name="sizeHint" stdset="0">
<string/> <size>
<width>276</width>
<height>20</height>
</size>
</property> </property>
</widget> </spacer>
</item> </item>
<item row="1" column="0" colspan="3"> <item row="2" column="0" colspan="3">
<widget class="MimeTextEdit" name="commentTextEdit"> <widget class="MimeTextEdit" name="commentTextEdit">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
@ -165,7 +168,21 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="5" column="2">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="infoLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="signedHLayout"> <layout class="QHBoxLayout" name="signedHLayout">
<item> <item>
<widget class="QLabel" name="signedLabel"> <widget class="QLabel" name="signedLabel">
@ -189,30 +206,26 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="5" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>276</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="postButton"> <widget class="QPushButton" name="postButton">
<property name="text"> <property name="text">
<string>Post</string> <string>Post</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="0" column="0" colspan="3">
<widget class="QPushButton" name="cancelButton"> <widget class="GxsIdLabel" name="replaytolabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>Cancel</string> <string/>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -58,10 +58,12 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channel.png")); headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channel.png"));
if(!existing_post.isNull()) if(!existing_post.isNull()){
headerFrame->setHeaderText(tr("Edit Channel Post")); headerFrame->setHeaderText(tr("Edit Channel Post"));
else postButton->setText(tr("Update"));
}else{
headerFrame->setHeaderText(tr("New Channel Post")); headerFrame->setHeaderText(tr("New Channel Post"));
}
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
@ -79,6 +81,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool))); connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool)));
connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int))); connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int)));
connect(RichTextEditWidget, SIGNAL(textSizeOk(bool)),postButton, SLOT(setEnabled(bool)));
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png")); channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png")); attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));

View file

@ -284,6 +284,7 @@ void GxsChannelFilesStatusWidget::download()
rsFiles->FileRequest(mFile.mName, mFile.mHash, mFile.mSize, destination, RS_FILE_REQ_ANONYMOUS_ROUTING, sources); rsFiles->FileRequest(mFile.mName, mFile.mHash, mFile.mSize, destination, RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
emit onButtonClick();// Signals the parent widget to e.g. update the downloadable file count
check(); check();
} }
@ -291,6 +292,7 @@ void GxsChannelFilesStatusWidget::pause()
{ {
rsFiles->FileControl(mFile.mHash, RS_FILE_CTRL_PAUSE); rsFiles->FileControl(mFile.mHash, RS_FILE_CTRL_PAUSE);
emit onButtonClick();// Signals the parent widget to e.g. update the downloadable file count
check(); check();
} }
@ -298,6 +300,7 @@ void GxsChannelFilesStatusWidget::resume()
{ {
rsFiles->FileControl(mFile.mHash, RS_FILE_CTRL_START); rsFiles->FileControl(mFile.mHash, RS_FILE_CTRL_START);
emit onButtonClick();// Signals the parent widget to e.g. update the downloadable file count
check(); check();
} }
@ -309,6 +312,7 @@ void GxsChannelFilesStatusWidget::cancel()
rsFiles->FileCancel(mFile.mHash); rsFiles->FileCancel(mFile.mHash);
emit onButtonClick();// Signals the parent widget to e.g. update the downloadable file count
check(); check();
} }

View file

@ -37,6 +37,10 @@ public:
explicit GxsChannelFilesStatusWidget(const RsGxsFile &file, QWidget *parent = 0); explicit GxsChannelFilesStatusWidget(const RsGxsFile &file, QWidget *parent = 0);
~GxsChannelFilesStatusWidget(); ~GxsChannelFilesStatusWidget();
signals:
void onButtonClick();
private slots: private slots:
void check(); void check();
void download(); void download();

View file

@ -107,8 +107,12 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
// //
// We need to update the data! // We need to update the data!
if(e->mChannelGroupId == mChannelGroup.mMeta.mGroupId) // make a copy of e, so as to avoid destruction of the shared pointer during async thread execution, since [e] doesn't actually tell
RsThread::async([this, e]() // the shared_ptr that it is copied! So no counter is updated.
RsGxsChannelEvent E(*e);
if(E.mChannelGroupId == mChannelGroup.mMeta.mGroupId)
RsThread::async([this, E]()
{ {
// 1 - get message data from p3GxsChannels. No need for pointers here, because we send only a single post to postToObject() // 1 - get message data from p3GxsChannels. No need for pointers here, because we send only a single post to postToObject()
@ -116,23 +120,28 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes; std::vector<RsGxsVote> votes;
if(!rsGxsChannels->getChannelContent(mChannelGroup.mMeta.mGroupId,std::set<RsGxsMessageId>{ e->mChannelMsgId }, posts,comments,votes)) std::cerr << "display of e 1: " << E << std::endl;
if(!rsGxsChannels->getChannelContent(E.mChannelGroupId,std::set<RsGxsMessageId>{ E.mChannelMsgId }, posts,comments,votes))
{ {
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << e->mChannelGroupId << "/" << e->mChannelMsgId << std::endl; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
return; return;
} }
// Need to call this in order to get the actuall comment count. The previous call only retrieves the message, since we supplied the message ID. // Need to call this in order to get the actuall comment count. The previous call only retrieves the message, since we supplied the message ID.
// another way to go would be to save the comment ids of the existing message and re-insert them before calling getChannelContent. // another way to go would be to save the comment ids of the existing message and re-insert them before calling getChannelContent.
if(!rsGxsChannels->getChannelComments(mChannelGroup.mMeta.mGroupId,std::set<RsGxsMessageId>{ e->mChannelMsgId },comments)) std::cerr << "display of e 2: " << E << std::endl;
std::cerr << "Before call : IS_MSG_READ=" << IS_MSG_NEW(posts[0].mMeta.mMsgFlags) << " for message id " << E.mChannelMsgId << std::endl;
if(!rsGxsChannels->getChannelComments(E.mChannelGroupId,std::set<RsGxsMessageId>{ E.mChannelMsgId },comments))
{ {
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve message comment data for channel/msg " << e->mChannelGroupId << "/" << e->mChannelMsgId << std::endl; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve message comment data for channel/msg " << E.mChannelGroupId << "/" << E.mChannelMsgId << std::endl;
return; return;
} }
updateCommentCounts(posts,comments); updateCommentCounts(posts,comments);
std::cerr << "After call : IS_MSG_READ=" << IS_MSG_NEW(posts[0].mMeta.mMsgFlags) << std::endl;
// 2 - update the model in the UI thread. // 2 - update the model in the UI thread.
RsQThreadUtils::postToObject( [posts,this]() RsQThreadUtils::postToObject( [posts,this]()
@ -151,11 +160,11 @@ void RsGxsChannelPostsModel::handleEvent_main_thread(std::shared_ptr<const RsEve
} }
},this); },this);
}); });
}
default: default:
break; break;
} }
}
} }
void RsGxsChannelPostsModel::initEmptyHierarchy() void RsGxsChannelPostsModel::initEmptyHierarchy()

View file

@ -56,7 +56,7 @@
* #define DEBUG_CHANNEL * #define DEBUG_CHANNEL
***/ ***/
static const int mTokenTypeGroupData = 1; //static const int mTokenTypeGroupData = 1;
static const int CHANNEL_TABS_DETAILS= 0; static const int CHANNEL_TABS_DETAILS= 0;
static const int CHANNEL_TABS_POSTS = 1; static const int CHANNEL_TABS_POSTS = 1;
@ -280,12 +280,16 @@ void ChannelPostDelegate::setWidgetGrid(bool use_grid)
//=== ChannelPostFilesDelegate ===// //=== ChannelPostFilesDelegate ===//
//===============================================================================================================================================// //===============================================================================================================================================//
QWidget *ChannelPostFilesDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const QWidget *ChannelPostFilesDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/*option*/, const QModelIndex& index) const
{ {
ChannelPostFileInfo file = index.data(Qt::UserRole).value<ChannelPostFileInfo>() ; ChannelPostFileInfo file = index.data(Qt::UserRole).value<ChannelPostFileInfo>() ;
if(index.column() == RsGxsChannelPostFilesModel::COLUMN_FILES_FILE) if(index.column() == RsGxsChannelPostFilesModel::COLUMN_FILES_FILE)
return new GxsChannelFilesStatusWidget(file,parent); {
GxsChannelFilesStatusWidget* w = new GxsChannelFilesStatusWidget(file,parent);
connect(w,SIGNAL(onButtonClick()),this->parent(),SLOT(updateDAll_PB()));
return w;
}
else else
return NULL; return NULL;
} }
@ -393,7 +397,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
connect(ui->commentsDialog,SIGNAL(commentsLoaded(int)),this,SLOT(updateCommentsCount(int))); connect(ui->commentsDialog,SIGNAL(commentsLoaded(int)),this,SLOT(updateCommentsCount(int)));
ui->channelPostFiles_TV->setModel(mChannelPostFilesModel = new RsGxsChannelPostFilesModel(this)); ui->channelPostFiles_TV->setModel(mChannelPostFilesModel = new RsGxsChannelPostFilesModel(this));
ui->channelPostFiles_TV->setItemDelegate(new ChannelPostFilesDelegate()); ui->channelPostFiles_TV->setItemDelegate(new ChannelPostFilesDelegate(this));
ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected")); ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected"));
ui->channelPostFiles_TV->setSortingEnabled(true); ui->channelPostFiles_TV->setSortingEnabled(true);
ui->channelPostFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time ui->channelPostFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
@ -403,7 +407,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder))); connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel()); ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate()); ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate(this));
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected")); ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
ui->channelFiles_TV->setSortingEnabled(true); ui->channelFiles_TV->setSortingEnabled(true);
ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
@ -416,6 +420,9 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->postName_LB->hide(); ui->postName_LB->hide();
ui->postTime_LB->hide(); ui->postTime_LB->hide();
ui->postLogo_LB->hide(); ui->postLogo_LB->hide();
ui->postDAll_PB->hide();
connect(ui->postDAll_PB,SIGNAL(clicked()),this,SLOT(download()));
ui->postDetails_TE->setPlaceholderText(tr("No text to display")); ui->postDetails_TE->setPlaceholderText(tr("No text to display"));
@ -671,6 +678,34 @@ void GxsChannelPostsWidgetWithModel::download()
rsFiles->FileRequest(file.mName, file.mHash, file.mSize, destination, RS_FILE_REQ_ANONYMOUS_ROUTING, sources); rsFiles->FileRequest(file.mName, file.mHash, file.mSize, destination, RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
} }
ui->postDAll_PB->hide();
}
void GxsChannelPostsWidgetWithModel::updateDAll_PB()
{
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
size_t newFileToDl = 0;
uint64_t newFileTotalSize = 0;
QString newFilesDetails;
for(auto& file:post.mFiles)
{
FileInfo fileInfo;
if (!rsFiles->FileDetails(file.mHash, RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_SPEC_ONLY, fileInfo)) {
++newFileToDl;
newFileTotalSize += file.mSize;
newFilesDetails += QString::fromUtf8(file.mName.c_str()) + " " + misc::friendlyUnit(file.mSize) + "\n";
}
}
ui->postDAll_PB->setHidden(newFileToDl == 0);
ui->postDAll_PB->setToolTip((newFileToDl == 1 ? tr("Download this file:") : tr("Download All these %1 files:").arg(newFileToDl) ) + "\n"
+ newFilesDetails
+ tr("Totaling: %1").arg(misc::friendlyUnit(newFileTotalSize)));
} }
void GxsChannelPostsWidgetWithModel::editPost() void GxsChannelPostsWidgetWithModel::editPost()
@ -815,6 +850,8 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
RsThread::async([postId]() { rsGxsChannels->markRead(postId, true) ; } ); RsThread::async([postId]() { rsGxsChannels->markRead(postId, true) ; } );
} }
updateDAll_PB();
} }
void GxsChannelPostsWidgetWithModel::updateCommentsCount(int n) void GxsChannelPostsWidgetWithModel::updateCommentsCount(int n)
@ -923,6 +960,8 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete) void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)
{ {
// First, clear all widget
blank();
#ifdef DEBUG_CHANNEL #ifdef DEBUG_CHANNEL
std::cerr << "udateDisplay: groupId()=" << groupId()<< std::endl; std::cerr << "udateDisplay: groupId()=" << groupId()<< std::endl;
#endif #endif
@ -943,7 +982,7 @@ void GxsChannelPostsWidgetWithModel::updateDisplay(bool complete)
} }
if(complete) // need to update the group data, reload the messages etc. if(complete) // need to update the group data, reload the messages etc.
{ {
#warning todo #warning csoler 2020-06-02 : todo
//saveExpandedItems(mSavedExpandedMessages); //saveExpandedItems(mSavedExpandedMessages);
//if(mGroupId != mChannelPostsModel->currentGroupId()) //if(mGroupId != mChannelPostsModel->currentGroupId())
@ -1004,7 +1043,7 @@ QString GxsChannelPostsWidgetWithModel::groupName(bool)
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str()); return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
} }
void GxsChannelPostsWidgetWithModel::groupNameChanged(const QString &name) void GxsChannelPostsWidgetWithModel::groupNameChanged(const QString &/*name*/)
{ {
// if (groupId().isNull()) { // if (groupId().isNull()) {
// ui->nameLabel->setText(tr("No Channel Selected")); // ui->nameLabel->setText(tr("No Channel Selected"));
@ -1080,7 +1119,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
setAutoDownload(autoDownload); setAutoDownload(autoDownload);
#endif #endif
setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags); setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags, group.mMeta.mPop);
if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
{ {
@ -1194,16 +1233,16 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
//ui->fileToolButton->setEnabled(false); //ui->fileToolButton->setEnabled(false);
#endif #endif
setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags); setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags, group.mMeta.mPop);
showPostDetails(); showPostDetails();
} }
void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags) void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags, uint32_t mPop)
{ {
if(IS_GROUP_SUBSCRIBED(flags)) if(IS_GROUP_SUBSCRIBED(flags))
{ {
ui->subscribeToolButton->setText(tr("Unsubscribe")); ui->subscribeToolButton->setText(tr("Subscribed")+ " " + QString::number(mPop));
ui->subscribeToolButton->setSubscribed(true); ui->subscribeToolButton->setSubscribed(true);
ui->subscribeToolButton->setEnabled(true); ui->subscribeToolButton->setEnabled(true);
} }
@ -1267,6 +1306,7 @@ void GxsChannelPostsWidgetWithModel::blank()
ui->postLogo_LB->hide(); ui->postLogo_LB->hide();
ui->postName_LB->hide(); ui->postName_LB->hide();
ui->postTime_LB->hide(); ui->postTime_LB->hide();
ui->postDAll_PB->hide();
groupNameChanged(QString()); groupNameChanged(QString());
} }
@ -1357,7 +1397,7 @@ void GxsChannelPostsWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t& /
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
return; return;
QModelIndex src_index; //QModelIndex src_index;
mChannelPostsModel->setAllMsgReadStatus(read); mChannelPostsModel->setAllMsgReadStatus(read);
} }

View file

@ -143,6 +143,7 @@ private slots:
void showPostDetails(); void showPostDetails();
void updateGroupData(); void updateGroupData();
void download(); void download();
void updateDAll_PB();
void createMsg(); void createMsg();
// void toggleAutoDownload(); // void toggleAutoDownload();
void subscribeGroup(bool subscribe); void subscribeGroup(bool subscribe);
@ -175,7 +176,7 @@ private:
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event); void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
private: private:
void setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags); void setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags, uint32_t mPop);
// QAction *mAutoDownloadAction; // QAction *mAutoDownloadAction;

View file

@ -380,7 +380,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
@ -496,6 +496,17 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="postDAll_PB">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -506,6 +517,7 @@ p, li { white-space: pre-wrap; }
<font> <font>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
<kerning>true</kerning>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
@ -615,13 +627,12 @@ p, li { white-space: pre-wrap; }
<customwidget> <customwidget>
<class>LineEditClear</class> <class>LineEditClear</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header> <header>gui/common/LineEditClear.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>RSTreeView</class> <class>SubscribeToolButton</class>
<extends>QTreeView</extends> <extends>QToolButton</extends>
<header>gui/common/RSTreeView.h</header> <header>gui/common/SubscribeToolButton.h</header>
<container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>GxsIdLabel</class> <class>GxsIdLabel</class>
@ -629,9 +640,10 @@ p, li { white-space: pre-wrap; }
<header>gui/gxs/GxsIdLabel.h</header> <header>gui/gxs/GxsIdLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>SubscribeToolButton</class> <class>RSTreeView</class>
<extends>QToolButton</extends> <extends>QTreeView</extends>
<header>gui/common/SubscribeToolButton.h</header> <header>gui/common/RSTreeView.h</header>
<container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>GxsCommentDialog</class> <class>GxsCommentDialog</class>

View file

@ -91,14 +91,15 @@ void ImHistoryBrowserCreateItemsThread::run()
} }
/** Default constructor */ /** Default constructor */
ImHistoryBrowser::ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit, QWidget *parent) ImHistoryBrowser::ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit,const QString &chatTitle, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{ {
/* Invoke Qt Designer generated QObject setup routine */ /* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
setWindowTitle(tr("%1 's Message History").arg(chatTitle));
ui.headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/images/user/agt_forum64.png")); ui.headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/images/user/agt_forum64.png"));
ui.headerFrame->setHeaderText(tr("Message History")); ui.headerFrame->setHeaderText(windowTitle());
m_chatId = chatId; m_chatId = chatId;
textEdit = edit; textEdit = edit;
@ -231,7 +232,9 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
if (rsHistory->getMessage(msgId, msg) == false) { if (rsHistory->getMessage(msgId, msg) == false) {
return; return;
} }
RsPeerId virtChatId;
if ( rsHistory->chatIdToVirtualPeerId(m_chatId ,virtChatId)
&& virtChatId == msg.chatPeerId)
historyAdd(msg); historyAdd(msg);
return; return;
@ -252,6 +255,11 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
if (type == NOTIFY_TYPE_MOD) { if (type == NOTIFY_TYPE_MOD) {
/* clear history */ /* clear history */
// As no ChatId nor msgId are send via Notify,
// only check if history of this chat is empty before clear our list.
std::list<HistoryMsg> historyMsgs;
rsHistory->getMessages(m_chatId, historyMsgs, 1);
if (historyMsgs.empty())
ui.listWidget->clear(); ui.listWidget->clear();
return; return;
} }

View file

@ -41,7 +41,7 @@ class ImHistoryBrowser : public QDialog
public: public:
/** Default constructor */ /** Default constructor */
ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit, QWidget *parent = 0); ImHistoryBrowser(const ChatId &chatId, QTextEdit *edit,const QString &chatTitle, QWidget *parent = 0);
/** Default destructor */ /** Default destructor */
virtual ~ImHistoryBrowser(); virtual ~ImHistoryBrowser();

View file

@ -187,7 +187,8 @@ ShareManager QPushButton#addButton:hover {
padding: 4px; padding: 4px;
} }
CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#postButton:disabled { CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
CreateGxsChannelMsg QPushButton#postButton:disabled, GxsCreateCommentDialog QPushButton#postButton:disabled {
font: bold; font: bold;
font-size: 15px; font-size: 15px;
color: white; color: white;
@ -203,6 +204,7 @@ CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushB
GxsForumThreadWidget QLabel#forumName GxsForumThreadWidget QLabel#forumName
{ {
font: bold; font: bold;
font-size: 14px;
} }
CreateForumMsg > QToolBar#toolBar, CreateForumV2Msg > QToolBar#toolBar { CreateForumMsg > QToolBar#toolBar, CreateForumV2Msg > QToolBar#toolBar {
@ -241,6 +243,12 @@ ChatLobbyWidget QLabel#lobbyinfo_label
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2); background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
} }
ChatLobbyWidget QLabel#lobbyname_lineEdit
{
font: bold;
font-size: 16px;
}
ChatLobbyWidget QGroupBox#lobbyinfo_groupBox ChatLobbyWidget QGroupBox#lobbyinfo_groupBox
{ {
@ -785,7 +793,8 @@ PostedListWidgetWithModel QComboBox#sortStrategy_CB {
color: #0099cc; color: #0099cc;
} }
PostedListWidgetWithModel QToolButton#submitPostButton { PostedListWidgetWithModel QToolButton#submitPostButton, GxsChannelPostsWidgetWithModel QToolButton#postButton,
GxsForumThreadWidget QToolButton#newthreadButton {
font: bold; font: bold;
} }
@ -891,14 +900,27 @@ GxsGroupDialog QLabel#groupLogo{
border-radius: 3px; border-radius: 3px;
} }
BoardPostDisplayWidget_compact QFrame#mainFrame { GxsChannelGroupItem QFrame#frame, GxsForumGroupItem QFrame#frame,
PostedGroupItem QFrame#frame {
background-color: white; background-color: white;
} }
PostedItem QFrame#mainFrame {
background-color: white;
}
PostedItem > QFrame#mainFrame [new=false]{
background: white;
}
PostedItem QFrame#voteFrame { PostedItem QFrame#voteFrame {
background: #f8f9fa; background: #f8f9fa;
} }
BoardPostDisplayWidget_compact QFrame#mainFrame {
background-color: white;
}
BoardPostDisplayWidget_compact > QFrame#mainFrame [new=false]{ BoardPostDisplayWidget_compact > QFrame#mainFrame [new=false]{
background: white; background: white;
} }
@ -1016,10 +1038,20 @@ MessagesDialog QWidget#messageTreeWidget::item:hover {
color: black; color: black;
} }
GxsForumThreadWidget QWidget#threadTreeWidget {
selection-background-color: #cde8ff;
show-decoration-selected: 1;
}
GxsForumThreadWidget QWidget#threadTreeWidget::item { GxsForumThreadWidget QWidget#threadTreeWidget::item {
padding: 2px; padding: 2px;
} }
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:active ,
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:!active {
background-color: #cde8ff;
}
GxsChannelDialog GroupTreeWidget QTreeWidget#treeWidget::item{ GxsChannelDialog GroupTreeWidget QTreeWidget#treeWidget::item{
/*background-color: #F00000;*/ /*background-color: #F00000;*/
/*padding: 2px*/ /*padding: 2px*/

View file

@ -91,14 +91,14 @@ QMainWindow::separator:horizontal {
width: 5px; width: 5px;
margin-top: 2px; margin-top: 2px;
margin-bottom: 2px; margin-bottom: 2px;
image: url(qss/qdarkstyle/rc/Vsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Vsepartoolbar.png);
} }
QMainWindow::separator:vertical { QMainWindow::separator:vertical {
height: 5px; height: 5px;
margin-left: 2px; margin-left: 2px;
margin-right: 2px; margin-right: 2px;
image: url(qss/qdarkstyle/rc/Hsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Hsepartoolbar.png);
} }
/* QToolTip --------------------------------------------------------------- */ /* QToolTip --------------------------------------------------------------- */
@ -157,47 +157,47 @@ QCheckBox::indicator {
} }
QCheckBox::indicator:unchecked { QCheckBox::indicator:unchecked {
image: url(qss/qdarkstyle/rc/checkbox_unchecked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked.png);
} }
QCheckBox::indicator:unchecked:hover, QCheckBox::indicator:unchecked:hover,
QCheckBox::indicator:unchecked:focus, QCheckBox::indicator:unchecked:focus,
QCheckBox::indicator:unchecked:pressed { QCheckBox::indicator:unchecked:pressed {
border: none; border: none;
image: url(qss/qdarkstyle/rc/checkbox_unchecked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_focus.png);
} }
QCheckBox::indicator:unchecked:disabled { QCheckBox::indicator:unchecked:disabled {
image: url(qss/qdarkstyle/rc/checkbox_unchecked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_disabled.png);
} }
QCheckBox::indicator:checked { QCheckBox::indicator:checked {
image: url(qss/qdarkstyle/rc/checkbox_checked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked.png);
} }
QCheckBox::indicator:checked:hover, QCheckBox::indicator:checked:hover,
QCheckBox::indicator:checked:focus, QCheckBox::indicator:checked:focus,
QCheckBox::indicator:checked:pressed { QCheckBox::indicator:checked:pressed {
border: none; border: none;
image: url(qss/qdarkstyle/rc/checkbox_checked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_focus.png);
} }
QCheckBox::indicator:checked:disabled{ QCheckBox::indicator:checked:disabled{
image: url(qss/qdarkstyle/rc/checkbox_checked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_disabled.png);
} }
QCheckBox::indicator:indeterminate { QCheckBox::indicator:indeterminate {
image: url(qss/qdarkstyle/rc/checkbox_indeterminate.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_indeterminate.png);
} }
QCheckBox::indicator:indeterminate:disabled { QCheckBox::indicator:indeterminate:disabled {
image: url(qss/qdarkstyle/rc/checkbox_indeterminate_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_indeterminate_disabled.png);
} }
QCheckBox::indicator:indeterminate:focus, QCheckBox::indicator:indeterminate:focus,
QCheckBox::indicator:indeterminate:hover, QCheckBox::indicator:indeterminate:hover,
QCheckBox::indicator:indeterminate:pressed { QCheckBox::indicator:indeterminate:pressed {
image: url(qss/qdarkstyle/rc/checkbox_indeterminate_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_indeterminate_focus.png);
} }
/* QGroupBox -------------------------------------------------------------- */ /* QGroupBox -------------------------------------------------------------- */
@ -236,22 +236,22 @@ QGroupBox::indicator:unchecked:hover,
QGroupBox::indicator:unchecked:focus, QGroupBox::indicator:unchecked:focus,
QGroupBox::indicator:unchecked:pressed { QGroupBox::indicator:unchecked:pressed {
border: none; border: none;
image: url(qss/qdarkstyle/rc/checkbox_unchecked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_focus.png);
} }
QGroupBox::indicator:checked:hover, QGroupBox::indicator:checked:hover,
QGroupBox::indicator:checked:focus, QGroupBox::indicator:checked:focus,
QGroupBox::indicator:checked:pressed { QGroupBox::indicator:checked:pressed {
border: none; border: none;
image: url(qss/qdarkstyle/rc/checkbox_checked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_focus.png);
} }
QGroupBox::indicator:checked:disabled { QGroupBox::indicator:checked:disabled {
image: url(qss/qdarkstyle/rc/checkbox_checked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_disabled.png);
} }
QGroupBox::indicator:unchecked:disabled { QGroupBox::indicator:unchecked:disabled {
image: url(qss/qdarkstyle/rc/checkbox_unchecked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_disabled.png);
} }
/* QRadioButton ----------------------------------------------------------- */ /* QRadioButton ----------------------------------------------------------- */
@ -294,7 +294,7 @@ QRadioButton::indicator {
} }
QRadioButton::indicator:unchecked { QRadioButton::indicator:unchecked {
image: url(qss/qdarkstyle/rc/radio_unchecked.png); image: url(%THISPATH%/qdarkstyle/rc/radio_unchecked.png);
} }
QRadioButton::indicator:unchecked:hover, QRadioButton::indicator:unchecked:hover,
@ -302,13 +302,13 @@ QRadioButton::indicator:unchecked:focus,
QRadioButton::indicator:unchecked:pressed { QRadioButton::indicator:unchecked:pressed {
border: none; border: none;
outline: none; outline: none;
image: url(qss/qdarkstyle/rc/radio_unchecked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/radio_unchecked_focus.png);
} }
QRadioButton::indicator:checked { QRadioButton::indicator:checked {
border: none; border: none;
outline: none; outline: none;
image: url(qss/qdarkstyle/rc/radio_checked.png); image: url(%THISPATH%/qdarkstyle/rc/radio_checked.png);
} }
QRadioButton::indicator:checked:hover, QRadioButton::indicator:checked:hover,
@ -316,16 +316,16 @@ QRadioButton::indicator:checked:focus,
QRadioButton::indicator:checked:pressed { QRadioButton::indicator:checked:pressed {
border: none; border: none;
outline: none; outline: none;
image: url(qss/qdarkstyle/rc/radio_checked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/radio_checked_focus.png);
} }
QRadioButton::indicator:checked:disabled { QRadioButton::indicator:checked:disabled {
outline: none; outline: none;
image: url(qss/qdarkstyle/rc/radio_checked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/radio_checked_disabled.png);
} }
QRadioButton::indicator:unchecked:disabled { QRadioButton::indicator:unchecked:disabled {
image: url(qss/qdarkstyle/rc/radio_unchecked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/radio_unchecked_disabled.png);
} }
/* QMenuBar --------------------------------------------------------------- */ /* QMenuBar --------------------------------------------------------------- */
@ -403,42 +403,42 @@ QMenu::indicator {
/* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */ /* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
QMenu::indicator:non-exclusive:unchecked { QMenu::indicator:non-exclusive:unchecked {
image: url(qss/qdarkstyle/rc/checkbox_unchecked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked.png);
} }
QMenu::indicator:non-exclusive:unchecked:selected { QMenu::indicator:non-exclusive:unchecked:selected {
image: url(qss/qdarkstyle/rc/checkbox_unchecked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_disabled.png);
} }
QMenu::indicator:non-exclusive:checked { QMenu::indicator:non-exclusive:checked {
image: url(qss/qdarkstyle/rc/checkbox_checked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked.png);
} }
QMenu::indicator:non-exclusive:checked:selected { QMenu::indicator:non-exclusive:checked:selected {
image: url(qss/qdarkstyle/rc/checkbox_checked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_disabled.png);
} }
/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */ /* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
QMenu::indicator:exclusive:unchecked { QMenu::indicator:exclusive:unchecked {
image: url(qss/qdarkstyle/rc/radio_unchecked.png); image: url(%THISPATH%/qdarkstyle/rc/radio_unchecked.png);
} }
QMenu::indicator:exclusive:unchecked:selected { QMenu::indicator:exclusive:unchecked:selected {
image: url(qss/qdarkstyle/rc/radio_unchecked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/radio_unchecked_disabled.png);
} }
QMenu::indicator:exclusive:checked { QMenu::indicator:exclusive:checked {
image: url(qss/qdarkstyle/rc/radio_checked.png); image: url(%THISPATH%/qdarkstyle/rc/radio_checked.png);
} }
QMenu::indicator:exclusive:checked:selected { QMenu::indicator:exclusive:checked:selected {
image: url(qss/qdarkstyle/rc/radio_checked_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/radio_checked_disabled.png);
} }
QMenu::right-arrow { QMenu::right-arrow {
margin: 5px; margin: 5px;
image: url(qss/qdarkstyle/rc/right_arrow.png) image: url(%THISPATH%/qdarkstyle/rc/right_arrow.png)
} }
/* QAbstractItemView ------------------------------------------------------ */ /* QAbstractItemView ------------------------------------------------------ */
@ -501,7 +501,7 @@ QScrollBar::handle:horizontal:hover {
QScrollBar::add-line:horizontal { QScrollBar::add-line:horizontal {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
border-image: url(qss/qdarkstyle/rc/right_arrow_disabled.png); border-image: url(%THISPATH%/qdarkstyle/rc/right_arrow_disabled.png);
width: 10px; width: 10px;
height: 10px; height: 10px;
subcontrol-position: right; subcontrol-position: right;
@ -510,7 +510,7 @@ QScrollBar::add-line:horizontal {
QScrollBar::sub-line:horizontal { QScrollBar::sub-line:horizontal {
margin: 0px 3px 0px 3px; margin: 0px 3px 0px 3px;
border-image: url(qss/qdarkstyle/rc/left_arrow_disabled.png); border-image: url(%THISPATH%/qdarkstyle/rc/left_arrow_disabled.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: left; subcontrol-position: left;
@ -519,7 +519,7 @@ QScrollBar::sub-line:horizontal {
QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:hover,
QScrollBar::add-line:horizontal:on { QScrollBar::add-line:horizontal:on {
border-image: url(qss/qdarkstyle/rc/right_arrow.png); border-image: url(%THISPATH%/qdarkstyle/rc/right_arrow.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: right; subcontrol-position: right;
@ -528,7 +528,7 @@ QScrollBar::add-line:horizontal:on {
QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:hover,
QScrollBar::sub-line:horizontal:on { QScrollBar::sub-line:horizontal:on {
border-image: url(qss/qdarkstyle/rc/left_arrow.png); border-image: url(%THISPATH%/qdarkstyle/rc/left_arrow.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: left; subcontrol-position: left;
@ -570,7 +570,7 @@ QScrollBar::handle:vertical:hover {
QScrollBar::sub-line:vertical { QScrollBar::sub-line:vertical {
margin: 3px 0px 3px 0px; margin: 3px 0px 3px 0px;
border-image: url(qss/qdarkstyle/rc/up_arrow_disabled.png); border-image: url(%THISPATH%/qdarkstyle/rc/up_arrow_disabled.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: top; subcontrol-position: top;
@ -579,7 +579,7 @@ QScrollBar::sub-line:vertical {
QScrollBar::add-line:vertical { QScrollBar::add-line:vertical {
margin: 3px 0px 3px 0px; margin: 3px 0px 3px 0px;
border-image: url(qss/qdarkstyle/rc/down_arrow_disabled.png); border-image: url(%THISPATH%/qdarkstyle/rc/down_arrow_disabled.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: bottom; subcontrol-position: bottom;
@ -588,7 +588,7 @@ QScrollBar::add-line:vertical {
QScrollBar::sub-line:vertical:hover, QScrollBar::sub-line:vertical:hover,
QScrollBar::sub-line:vertical:on { QScrollBar::sub-line:vertical:on {
border-image: url(qss/qdarkstyle/rc/up_arrow.png); border-image: url(%THISPATH%/qdarkstyle/rc/up_arrow.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: top; subcontrol-position: top;
@ -597,7 +597,7 @@ QScrollBar::sub-line:vertical:on {
QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:hover,
QScrollBar::add-line:vertical:on { QScrollBar::add-line:vertical:on {
border-image: url(qss/qdarkstyle/rc/down_arrow.png); border-image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
height: 10px; height: 10px;
width: 10px; width: 10px;
subcontrol-position: bottom; subcontrol-position: bottom;
@ -654,7 +654,7 @@ QPlainTextEdit:selected {
/* QSizeGrip --------------------------------------------------------------- */ /* QSizeGrip --------------------------------------------------------------- */
QSizeGrip { QSizeGrip {
image: url(qss/qdarkstyle/rc/sizegrip.png); image: url(%THISPATH%/qdarkstyle/rc/sizegrip.png);
width: 12px; width: 12px;
height: 12px; height: 12px;
} }
@ -682,29 +682,29 @@ QToolBar QToolButton{
QToolBar::handle:horizontal { QToolBar::handle:horizontal {
width: 6px; width: 6px;
image: url(qss/qdarkstyle/rc/Hmovetoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Hmovetoolbar.png);
} }
QToolBar::handle:vertical { QToolBar::handle:vertical {
height: 6px; height: 6px;
image: url(qss/qdarkstyle/rc/Vmovetoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Vmovetoolbar.png);
} }
QToolBar::separator:horizontal { QToolBar::separator:horizontal {
width: 3px; width: 3px;
image: url(qss/qdarkstyle/rc/Hsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Hsepartoolbar.png);
} }
QToolBar::separator:vertical { QToolBar::separator:vertical {
height: 3px; height: 3px;
image: url(qss/qdarkstyle/rc/Vsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Vsepartoolbar.png);
} }
QToolButton#qt_toolbar_ext_button { QToolButton#qt_toolbar_ext_button {
background: #32414B; background: #32414B;
border: 0px; border: 0px;
color: #F0F0F0; color: #F0F0F0;
image: url(qss/qdarkstyle/rc/right_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/right_arrow.png);
} }
/* QAbstractSpinBox ------------------------------------------------------- */ /* QAbstractSpinBox ------------------------------------------------------- */
@ -732,13 +732,13 @@ QAbstractSpinBox:up-button {
QAbstractSpinBox::up-arrow, QAbstractSpinBox::up-arrow,
QAbstractSpinBox::up-arrow:disabled, QAbstractSpinBox::up-arrow:disabled,
QAbstractSpinBox::up-arrow:off { QAbstractSpinBox::up-arrow:off {
image: url(qss/qdarkstyle/rc/up_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/up_arrow_disabled.png);
width: 9px; width: 9px;
height: 9px; height: 9px;
} }
QAbstractSpinBox::up-arrow:hover { QAbstractSpinBox::up-arrow:hover {
image: url(qss/qdarkstyle/rc/up_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/up_arrow.png);
} }
QAbstractSpinBox:down-button { QAbstractSpinBox:down-button {
@ -752,13 +752,13 @@ QAbstractSpinBox:down-button {
QAbstractSpinBox::down-arrow, QAbstractSpinBox::down-arrow,
QAbstractSpinBox::down-arrow:disabled, QAbstractSpinBox::down-arrow:disabled,
QAbstractSpinBox::down-arrow:off { QAbstractSpinBox::down-arrow:off {
image: url(qss/qdarkstyle/rc/down_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow_disabled.png);
width: 9px; width: 9px;
height: 9px; height: 9px;
} }
QAbstractSpinBox::down-arrow:hover { QAbstractSpinBox::down-arrow:hover {
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
} }
QAbstractSpinBox:hover{ QAbstractSpinBox:hover{
@ -1028,13 +1028,13 @@ QToolButton::menu-button:checked:hover {
} }
QToolButton::menu-indicator { QToolButton::menu-indicator {
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
top: -8px; /* shift it a bit */ top: -8px; /* shift it a bit */
left: -4px; /* shift it a bit */ left: -4px; /* shift it a bit */
} }
QToolButton::menu-arrow { QToolButton::menu-arrow {
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
} }
QToolButton::menu-arrow:open { QToolButton::menu-arrow:open {
@ -1109,7 +1109,8 @@ QComboBox::item:alternate {
} }
QComboBox::item:checked { QComboBox::item:checked {
font-weight: bold; /*font-weight: bold;*/
background-color: #148CD2;
} }
QComboBox::item:selected { QComboBox::item:selected {
@ -1128,13 +1129,13 @@ QComboBox::drop-down {
} }
QComboBox::down-arrow { QComboBox::down-arrow {
image: url(qss/qdarkstyle/rc/down_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow_disabled.png);
} }
QComboBox::down-arrow:on, QComboBox::down-arrow:on,
QComboBox::down-arrow:hover, QComboBox::down-arrow:hover,
QComboBox::down-arrow:focus { QComboBox::down-arrow:focus {
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
} }
/* QSlider ---------------------------------------------------------------- */ /* QSlider ---------------------------------------------------------------- */
@ -1289,15 +1290,15 @@ QTabBar::close-button {
border: 0; border: 0;
margin: 2px; margin: 2px;
padding: 0; padding: 0;
image: url(qss/qdarkstyle/rc/close.png); image: url(%THISPATH%/qdarkstyle/rc/close.png);
} }
QTabBar::close-button:hover { QTabBar::close-button:hover {
image: url(qss/qdarkstyle/rc/close-hover.png); image: url(%THISPATH%/qdarkstyle/rc/close-hover.png);
} }
QTabBar::close-button:pressed { QTabBar::close-button:pressed {
image: url(qss/qdarkstyle/rc/close-pressed.png); image: url(%THISPATH%/qdarkstyle/rc/close-pressed.png);
} }
/* QTabBar::tab - selected ----------------------------------------------- */ /* QTabBar::tab - selected ----------------------------------------------- */
@ -1486,19 +1487,19 @@ QTabBar::tab:right:!selected:hover {
} }
QTabBar QToolButton::right-arrow:enabled { QTabBar QToolButton::right-arrow:enabled {
image: url(qss/qdarkstyle/rc/right_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/right_arrow.png);
} }
QTabBar QToolButton::left-arrow:enabled { QTabBar QToolButton::left-arrow:enabled {
image: url(qss/qdarkstyle/rc/left_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/left_arrow.png);
} }
QTabBar QToolButton::right-arrow:disabled { QTabBar QToolButton::right-arrow:disabled {
image: url(qss/qdarkstyle/rc/right_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/right_arrow_disabled.png);
} }
QTabBar QToolButton::left-arrow:disabled { QTabBar QToolButton::left-arrow:disabled {
image: url(qss/qdarkstyle/rc/left_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/left_arrow_disabled.png);
} }
QTabBar QToolButton{ QTabBar QToolButton{
@ -1514,8 +1515,8 @@ QDockWidget {
background-color: #19232D; background-color: #19232D;
border: 1px solid #32414B; border: 1px solid #32414B;
border-radius: 4px; border-radius: 4px;
titlebar-close-icon: url(qss/qdarkstyle/rc/close.png); titlebar-close-icon: url(%THISPATH%/qdarkstyle/rc/close.png);
titlebar-normal-icon: url(qss/qdarkstyle/rc/undock.png); titlebar-normal-icon: url(%THISPATH%/qdarkstyle/rc/undock.png);
} }
QDockWidget::title { QDockWidget::title {
@ -1557,39 +1558,39 @@ QDockWidget::float-button:pressed {
QTreeView:branch:selected, QTreeView:branch:selected,
QTreeView:branch:hover { QTreeView:branch:hover {
background: url(qss/qdarkstyle/rc/transparent.png); background: url(%THISPATH%/qdarkstyle/rc/transparent.png);
} }
QTreeView::branch:has-siblings:!adjoins-item { QTreeView::branch:has-siblings:!adjoins-item {
border-image: url(qss/qdarkstyle/rc/transparent.png); border-image: url(%THISPATH%/qdarkstyle/rc/transparent.png);
} }
QTreeView::branch:has-siblings:adjoins-item { QTreeView::branch:has-siblings:adjoins-item {
border-image: url(qss/qdarkstyle/rc/transparent.png); border-image: url(%THISPATH%/qdarkstyle/rc/transparent.png);
} }
QTreeView::branch:!has-children:!has-siblings:adjoins-item { QTreeView::branch:!has-children:!has-siblings:adjoins-item {
border-image: url(qss/qdarkstyle/rc/transparent.png); border-image: url(%THISPATH%/qdarkstyle/rc/transparent.png);
} }
QTreeView::branch:has-children:!has-siblings:closed, QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings { QTreeView::branch:closed:has-children:has-siblings {
image: url(qss/qdarkstyle/rc/branch_closed.png); image: url(%THISPATH%/qdarkstyle/rc/branch_closed.png);
} }
QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings { QTreeView::branch:open:has-children:has-siblings {
image: url(qss/qdarkstyle/rc/branch_open.png); image: url(%THISPATH%/qdarkstyle/rc/branch_open.png);
} }
QTreeView::branch:has-children:!has-siblings:closed:hover, QTreeView::branch:has-children:!has-siblings:closed:hover,
QTreeView::branch:closed:has-children:has-siblings:hover { QTreeView::branch:closed:has-children:has-siblings:hover {
image: url(qss/qdarkstyle/rc/branch_closed-on.png); image: url(%THISPATH%/qdarkstyle/rc/branch_closed-on.png);
} }
QTreeView::branch:open:has-children:!has-siblings:hover, QTreeView::branch:open:has-children:!has-siblings:hover,
QTreeView::branch:open:has-children:has-siblings:hover { QTreeView::branch:open:has-children:has-siblings:hover {
image: url(qss/qdarkstyle/rc/branch_open-on.png); image: url(%THISPATH%/qdarkstyle/rc/branch_open-on.png);
} }
QListView::item:!selected:hover, QListView::item:!selected:hover,
@ -1611,12 +1612,12 @@ QColumnView::item:selected:hover {
QTreeView::indicator:checked, QTreeView::indicator:checked,
QListView::indicator:checked { QListView::indicator:checked {
image: url(qss/qdarkstyle/rc/checkbox_checked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked.png);
} }
QTreeView::indicator:unchecked, QTreeView::indicator:unchecked,
QListView::indicator:unchecked { QListView::indicator:unchecked {
image: url(qss/qdarkstyle/rc/checkbox_unchecked.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked.png);
} }
QTreeView::indicator:checked:hover, QTreeView::indicator:checked:hover,
@ -1625,7 +1626,7 @@ QTreeView::indicator:checked:pressed,
QListView::indicator:checked:hover, QListView::indicator:checked:hover,
QListView::indicator:checked:focus, QListView::indicator:checked:focus,
QListView::indicator:checked:pressed { QListView::indicator:checked:pressed {
image: url(qss/qdarkstyle/rc/checkbox_checked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_checked_focus.png);
} }
QTreeView::indicator:unchecked:hover, QTreeView::indicator:unchecked:hover,
@ -1634,7 +1635,7 @@ QTreeView::indicator:unchecked:pressed,
QListView::indicator:unchecked:hover, QListView::indicator:unchecked:hover,
QListView::indicator:unchecked:focus, QListView::indicator:unchecked:focus,
QListView::indicator:unchecked:pressed { QListView::indicator:unchecked:pressed {
image: url(qss/qdarkstyle/rc/checkbox_unchecked_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_unchecked_focus.png);
} }
QTreeView::indicator:indeterminate:hover, QTreeView::indicator:indeterminate:hover,
@ -1643,12 +1644,12 @@ QTreeView::indicator:indeterminate:pressed,
QListView::indicator:indeterminate:hover, QListView::indicator:indeterminate:hover,
QListView::indicator:indeterminate:focus, QListView::indicator:indeterminate:focus,
QListView::indicator:indeterminate:pressed { QListView::indicator:indeterminate:pressed {
image: url(qss/qdarkstyle/rc/checkbox_indeterminate_focus.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_indeterminate_focus.png);
} }
QTreeView::indicator:indeterminate, QTreeView::indicator:indeterminate,
QListView::indicator:indeterminate { QListView::indicator:indeterminate {
image: url(qss/qdarkstyle/rc/checkbox_indeterminate.png); image: url(%THISPATH%/qdarkstyle/rc/checkbox_indeterminate.png);
} }
QListView, QListView,
@ -1771,7 +1772,7 @@ QHeaderView::down-arrow {
width: 16px; width: 16px;
height: 16px; height: 16px;
border-right: 1px solid #19232D; border-right: 1px solid #19232D;
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
} }
QHeaderView::up-arrow { QHeaderView::up-arrow {
@ -1779,7 +1780,7 @@ QHeaderView::up-arrow {
width: 16px; width: 16px;
height: 16px; height: 16px;
border-right: 1px solid #19232D; border-right: 1px solid #19232D;
image: url(qss/qdarkstyle/rc/up_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/up_arrow.png);
} }
/* QToolBox -------------------------------------------------------------- */ /* QToolBox -------------------------------------------------------------- */
@ -1876,12 +1877,12 @@ QSplitter::separator:hover {
QSplitter::separator:horizontal { QSplitter::separator:horizontal {
width: 5px; width: 5px;
image: url(qss/qdarkstyle/rc/Vsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Vsepartoolbar.png);
} }
QSplitter::separator:vertical { QSplitter::separator:vertical {
height: 5px; height: 5px;
image: url(qss/qdarkstyle/rc/Hsepartoolbar.png); image: url(%THISPATH%/qdarkstyle/rc/Hsepartoolbar.png);
} }
@ -1912,13 +1913,13 @@ QDateEdit::drop-down {
} }
QDateEdit::down-arrow { QDateEdit::down-arrow {
image: url(qss/qdarkstyle/rc/down_arrow_disabled.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow_disabled.png);
} }
QDateEdit::down-arrow:on, QDateEdit::down-arrow:on,
QDateEdit::down-arrow:hover, QDateEdit::down-arrow:hover,
QDateEdit::down-arrow:focus { QDateEdit::down-arrow:focus {
image: url(qss/qdarkstyle/rc/down_arrow.png); image: url(%THISPATH%/qdarkstyle/rc/down_arrow.png);
} }
QDateEdit QAbstractItemView { QDateEdit QAbstractItemView {
@ -1976,10 +1977,6 @@ GxsForumThreadWidget QLabel#forumName
font: bold; font: bold;
} }
GxsForumThreadWidget QWidget#threadTreeWidget::item {
padding: 2px;
}
ForumsDialog, GxsForumThreadWidget ForumsDialog, GxsForumThreadWidget
{ {
qproperty-textColorRead: darkgray; qproperty-textColorRead: darkgray;
@ -1993,6 +1990,20 @@ ForumsDialog, GxsForumThreadWidget
qproperty-backgroundColorFiltered: darkGreen; qproperty-backgroundColorFiltered: darkGreen;
} }
GxsForumThreadWidget QWidget#threadTreeWidget {
selection-background-color: #005599;
show-decoration-selected: 1;
}
GxsForumThreadWidget QWidget#threadTreeWidget::item {
padding: 2px;
}
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:active ,
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:!active {
background-color: #005599;
}
QTreeView [new=true]{ QTreeView [new=true]{
color: #0099cc; color: #0099cc;
@ -2102,14 +2113,15 @@ GxsCreateCommentDialog QPushButton#postButton, GxsGroupDialog QPushButton#create
CreateCircleDialog QPushButton#createButton:hover, CreateLobbyDialog QPushButton#createButton:hover, CreateCircleDialog QPushButton#createButton:hover, CreateLobbyDialog QPushButton#createButton:hover,
IdEditDialog QPushButton#createButton:hover, CreateGxsForumMsg QPushButton#postButton:hover, IdEditDialog QPushButton#createButton:hover, CreateGxsForumMsg QPushButton#postButton:hover,
GxsCreateCommentDialog QPushButton#postButton:hover, , GxsGroupDialog QPushButton#createButton:hover { GxsCreateCommentDialog QPushButton#postButton:hover, GxsGroupDialog QPushButton#createButton:hover {
background: #03b1f3; background: #03b1f3;
border-radius: 4px; border-radius: 4px;
min-width: 4em; min-width: 4em;
padding: 2px; padding: 2px;
} }
CreateGxsForumMsg QPushButton#postButton:disabled { CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
CreateGxsChannelMsg QPushButton#postButton:disabled, GxsCreateCommentDialog QPushButton#postButton:disabled {
font: bold; font: bold;
font-size: 15px; font-size: 15px;
color: white; color: white;

View file

@ -557,6 +557,14 @@ QComboBox:on
selection-background-color: #4a4a4a; selection-background-color: #4a4a4a;
} }
/* Needed to remove indicator - fix #132 */
QComboBox::indicator {
background-color:transparent;
selection-background-color:transparent;
color:transparent;
selection-color:transparent;
}
QComboBox QAbstractItemView QComboBox QAbstractItemView
{ {
background-color: #201F1F; background-color: #201F1F;
@ -1176,10 +1184,20 @@ GxsForumThreadWidget QToolButton#subscribeToolButton:hover {
border-radius: 4px; border-radius: 4px;
} }
GxsForumThreadWidget QWidget#threadTreeWidget {
selection-background-color: #445566;
show-decoration-selected: 1;
}
GxsForumThreadWidget QWidget#threadTreeWidget::item { GxsForumThreadWidget QWidget#threadTreeWidget::item {
padding: 2px; padding: 2px;
} }
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:active ,
GxsForumThreadWidget QWidget#threadTreeWidget::item:selected:!active {
background-color: #445566;
}
GxsChannelPostsWidgetWithModel QToolButton#subscribeToolButton { GxsChannelPostsWidgetWithModel QToolButton#subscribeToolButton {
font: bold; font: bold;
font-size: 14px; font-size: 14px;
@ -1262,7 +1280,8 @@ ShareManager QPushButton#closeButton {
padding: 2px; padding: 2px;
} }
CreateGxsForumMsg QPushButton#postButton:disabled { CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
CreateGxsChannelMsg QPushButton#postButton:disabled, GxsCreateCommentDialog QPushButton#postButton:disabled {
font: bold; font: bold;
font-size: 15px; font-size: 15px;
color: white; color: white;

View file

@ -602,15 +602,15 @@ void RichTextEdit::checkLength(){
if(charRemains >= 0) { if(charRemains >= 0) {
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains); text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
f_info->setStyleSheet("QLabel#f_info { }"); f_info->setStyleSheet("QLabel#f_info { }");
emit textSizeOk(true);
}else{ }else{
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains)); text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
f_info->setStyleSheet("QLabel#f_info {color: red; font: bold; }"); f_info->setStyleSheet("QLabel#f_info {color: red; font: bold; }");
emit textSizeOk(false);
} }
//buttonBox->button(QDialogButtonBox::Ok)->setEnabled(charRemains>=0);
f_info->setText(text); f_info->setText(text);
} }
void RichTextEdit::setPlaceHolderTextPosted() { void RichTextEdit::setPlaceHolderTextPosted() {
f_textedit->setPlaceholderText(tr("Text (optional)")); f_textedit->setPlaceholderText(tr("Text (optional)"));
} }

View file

@ -38,11 +38,13 @@ class RichTextEdit : public QWidget, protected Ui::RichTextEdit {
QTextCursor textCursor() const { return f_textedit->textCursor(); } QTextCursor textCursor() const { return f_textedit->textCursor(); }
void setTextCursor(const QTextCursor& cursor) { f_textedit->setTextCursor(cursor); } void setTextCursor(const QTextCursor& cursor) { f_textedit->setTextCursor(cursor); }
signals:
void textSizeOk(bool);
public slots: public slots:
void setText(const QString &text); void setText(const QString &text);
void setPlaceHolderTextPosted(); void setPlaceHolderTextPosted();
protected slots: protected slots:
void setPlainText(const QString &text) { f_textedit->setPlainText(text); } void setPlainText(const QString &text) { f_textedit->setPlainText(text); }
void setHtml(const QString &text) { f_textedit->setHtml(text); } void setHtml(const QString &text) { f_textedit->setHtml(text); }