mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Add General Font Size Factor
This commit is contained in:
parent
2548ef29fb
commit
9e4903c9b8
@ -22,19 +22,20 @@
|
|||||||
#include "ChatLobbyWidget.h"
|
#include "ChatLobbyWidget.h"
|
||||||
|
|
||||||
#include "notifyqt.h"
|
#include "notifyqt.h"
|
||||||
|
#include "RetroShareLink.h"
|
||||||
#include "chat/ChatLobbyDialog.h"
|
#include "chat/ChatLobbyDialog.h"
|
||||||
#include "chat/ChatLobbyUserNotify.h"
|
#include "chat/ChatLobbyUserNotify.h"
|
||||||
#include "chat/ChatTabWidget.h"
|
#include "chat/ChatTabWidget.h"
|
||||||
#include "chat/CreateLobbyDialog.h"
|
#include "chat/CreateLobbyDialog.h"
|
||||||
|
#include "common/FilesDefs.h"
|
||||||
#include "common/RSTreeWidgetItem.h"
|
#include "common/RSTreeWidgetItem.h"
|
||||||
#include "common/RSElidedItemDelegate.h"
|
#include "common/RSElidedItemDelegate.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gxs/GxsIdDetails.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "Identity/IdEditDialog.h"
|
||||||
#include "gui/Identity/IdEditDialog.h"
|
#include "settings/rsharesettings.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
|
||||||
#include "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
#include "util/misc.h"
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
|
||||||
|
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
@ -206,28 +207,29 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
|
|||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
QString help_str = tr("\
|
int hbH = misc::getFontSizeFactor("HelpButton").height();
|
||||||
<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Chat Rooms</h1> \
|
QString help_str = tr(
|
||||||
<p>Chat rooms work pretty much like IRC. \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Chat Rooms</h1>"
|
||||||
They allow you to talk anonymously with tons of people without the need to make friends.</p> \
|
"<p>Chat rooms work pretty much like IRC."
|
||||||
<p>A chat room can be public (your friends see it) or private (your friends can't see it, unless you \
|
" They allow you to talk anonymously with tons of people without the need to make friends.</p>"
|
||||||
invite them with <img src=\":/icons/png/add.png\" width=%2/>). \
|
"<p>A chat room can be public (your friends see it) or private (your friends can't see it, unless you"
|
||||||
Once you have been invited to a private room, you will be able to see it when your friends \
|
" invite them with <img src=\":/icons/png/add.png\" width=%2/>)."
|
||||||
are using it.</p> \
|
" Once you have been invited to a private room, you will be able to see it when your friends"
|
||||||
<p>The list at left shows \
|
" are using it.</p>"
|
||||||
chat lobbies your friends are participating in. You can either \
|
"<p>The list at left shows"
|
||||||
<ul> \
|
" chat lobbies your friends are participating in. You can either"
|
||||||
<li>Right click to create a new chat room</li> \
|
" <ul>"
|
||||||
<li>Double click a chat room to enter, chat, and show it to your friends</li> \
|
" <li>Right click to create a new chat room</li>"
|
||||||
</ul> \
|
" <li>Double click a chat room to enter, chat, and show it to your friends</li>"
|
||||||
Note: For the chat rooms to work properly, your computer needs be on time. So check your system clock!\
|
" </ul>"
|
||||||
</p> \
|
" Note: For the chat rooms to work properly, your computer needs be on time. So check your system clock!"
|
||||||
"
|
"</p>"
|
||||||
).arg(QString::number(4*W), QString::number(2*W)) ;
|
).arg(QString::number(2*hbH), QString::number(hbH)) ;
|
||||||
|
|
||||||
registerHelpButton(ui.helpButton,help_str,"ChatLobbyDialog") ;
|
registerHelpButton(ui.helpButton,help_str,"ChatLobbyDialog") ;
|
||||||
|
|
||||||
ui.lobbyTreeWidget->setIconSize(QSize(H*1.5,H*1.5));
|
int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height();
|
||||||
|
ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatLobbyWidget::~ChatLobbyWidget()
|
ChatLobbyWidget::~ChatLobbyWidget()
|
||||||
@ -293,87 +295,84 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
|
|||||||
QMenu contextMnu(this);
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
if (item && item->type() == TYPE_FOLDER) {
|
if (item && item->type() == TYPE_FOLDER) {
|
||||||
QAction *action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_CREATE), tr("Create chat room"), this, SLOT(createChatLobby()));
|
QAction *action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_CREATE), tr("Create chat room"), this, SLOT(createChatLobby()));
|
||||||
action->setData(item->data(COLUMN_DATA, ROLE_PRIVACYLEVEL).toInt());
|
action->setData(item->data(COLUMN_DATA, ROLE_PRIVACYLEVEL).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item && item->type() == TYPE_LOBBY)
|
if (item && item->type() == TYPE_LOBBY)
|
||||||
{
|
{
|
||||||
std::list<RsGxsId> own_identities ;
|
std::list<RsGxsId> own_identities ;
|
||||||
rsIdentity->getOwnIds(own_identities) ;
|
rsIdentity->getOwnIds(own_identities) ;
|
||||||
|
|
||||||
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool())
|
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool())
|
||||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_UNSUBSCRIBE), tr("Leave this room"), this, SLOT(unsubscribeItem()));
|
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_UNSUBSCRIBE), tr("Leave this room"), this, SLOT(unsubscribeItem()));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
|
ChatLobbyFlags flags(item->data(COLUMN_DATA, ROLE_FLAGS).toUInt());
|
||||||
|
|
||||||
//ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
bool removed = false ;
|
||||||
ChatLobbyFlags flags(item->data(COLUMN_DATA, ROLE_FLAGS).toUInt());
|
if(flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
|
||||||
|
removed = trimAnonIds(own_identities) ;
|
||||||
|
|
||||||
bool removed = false ;
|
if(own_identities.empty())
|
||||||
if(flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
|
{
|
||||||
removed = trimAnonIds(own_identities) ;
|
if(removed)
|
||||||
|
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Create a non anonymous identity and enter this room"), this, SLOT(createIdentityAndSubscribe()));
|
||||||
|
else
|
||||||
|
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Create an identity and enter this chat room"), this, SLOT(createIdentityAndSubscribe()));
|
||||||
|
}
|
||||||
|
else if(own_identities.size() == 1)
|
||||||
|
{
|
||||||
|
QAction *action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Enter this chat room"), this, SLOT(subscribeChatLobbyAs()));
|
||||||
|
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMenu *mnu = contextMnu.addMenu(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE),tr("Enter this chat room as...")) ;
|
||||||
|
|
||||||
if(own_identities.empty())
|
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
|
||||||
{
|
{
|
||||||
if(removed)
|
RsIdentityDetails idd ;
|
||||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Create a non anonymous identity and enter this room"), this, SLOT(createIdentityAndSubscribe()));
|
rsIdentity->getIdDetails(*it,idd) ;
|
||||||
else
|
|
||||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Create an identity and enter this chat room"), this, SLOT(createIdentityAndSubscribe()));
|
|
||||||
}
|
|
||||||
else if(own_identities.size() == 1)
|
|
||||||
{
|
|
||||||
QAction *action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE), tr("Enter this chat room"), this, SLOT(subscribeChatLobbyAs()));
|
|
||||||
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QMenu *mnu = contextMnu.addMenu(FilesDefs::getIconFromQtResourcePath(IMAGE_SUBSCRIBE),tr("Enter this chat room as...")) ;
|
|
||||||
|
|
||||||
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
|
QPixmap pixmap ;
|
||||||
{
|
|
||||||
RsIdentityDetails idd ;
|
|
||||||
rsIdentity->getIdDetails(*it,idd) ;
|
|
||||||
|
|
||||||
QPixmap pixmap ;
|
if(idd.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idd.mAvatar.mData, idd.mAvatar.mSize, pixmap, GxsIdDetails::SMALL))
|
||||||
|
pixmap = GxsIdDetails::makeDefaultIcon(*it,GxsIdDetails::SMALL) ;
|
||||||
|
|
||||||
if(idd.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idd.mAvatar.mData, idd.mAvatar.mSize, pixmap, GxsIdDetails::SMALL))
|
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(subscribeChatLobbyAs()));
|
||||||
pixmap = GxsIdDetails::makeDefaultIcon(*it,GxsIdDetails::SMALL) ;
|
action->setData(QString::fromStdString((*it).toStdString())) ;
|
||||||
|
}
|
||||||
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(subscribeChatLobbyAs()));
|
}
|
||||||
action->setData(QString::fromStdString((*it).toStdString())) ;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TO_BE_REMOVED
|
#ifdef TO_BE_REMOVED
|
||||||
// This code is not needed anymore because AutoSubscribe is now automatically handled with chat room subscription.
|
// This code is not needed anymore because AutoSubscribe is now automatically handled with chat room subscription.
|
||||||
|
|
||||||
if (item->data(COLUMN_DATA, ROLE_AUTOSUBSCRIBE).toBool())
|
if (item->data(COLUMN_DATA, ROLE_AUTOSUBSCRIBE).toBool())
|
||||||
contextMnu.addAction(QIcon(IMAGE_AUTOSUBSCRIBE), tr("Remove Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
contextMnu.addAction(QIcon(IMAGE_AUTOSUBSCRIBE), tr("Remove Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
||||||
else if(!own_identities.empty())
|
else if(!own_identities.empty())
|
||||||
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink()));
|
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink()));
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMnu.addSeparator();//-------------------------------------------------------------------
|
contextMnu.addSeparator();//-------------------------------------------------------------------
|
||||||
|
|
||||||
showUserCountAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
|
showUserCountAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
|
||||||
showTopicAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
|
showTopicAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
|
||||||
|
|
||||||
QMenu *menu = contextMnu.addMenu(tr("Columns"));
|
QMenu *menu = contextMnu.addMenu(tr("Columns"));
|
||||||
menu->addAction(showUserCountAct);
|
menu->addAction(showUserCountAct);
|
||||||
menu->addAction(showTopicAct);
|
menu->addAction(showTopicAct);
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLobbyWidget::lobbyChanged()
|
void ChatLobbyWidget::lobbyChanged()
|
||||||
{
|
{
|
||||||
updateDisplay();
|
ChatLobbyWidget::updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateItem(QTreeWidget *treeWidget, QTreeWidgetItem *item, ChatLobbyId id, const std::string &name, const std::string &topic, int count, bool subscribed, bool autoSubscribe,ChatLobbyFlags lobby_flags)
|
static void updateItem(QTreeWidget *treeWidget, QTreeWidgetItem *item, ChatLobbyId id, const std::string &name, const std::string &topic, int count, bool subscribed, bool autoSubscribe,ChatLobbyFlags lobby_flags)
|
||||||
@ -607,7 +606,7 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
QTreeWidgetItem *itemLoop = lobby_other_item->child(childIndex);
|
QTreeWidgetItem *itemLoop = lobby_other_item->child(childIndex);
|
||||||
if (itemLoop->type() == TYPE_LOBBY && itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobby.lobby_id) {
|
if (itemLoop->type() == TYPE_LOBBY && itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobby.lobby_id) {
|
||||||
delete(lobby_other_item->takeChild(lobby_other_item->indexOfChild(itemLoop)));
|
delete(lobby_other_item->takeChild(lobby_other_item->indexOfChild(itemLoop)));
|
||||||
childCnt = lobby_other_item->childCount();
|
//childCnt = lobby_other_item->childCount();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,18 +56,18 @@ class ChatLobbyWidget : public RsAutoUpdatePage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
ChatLobbyWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
ChatLobbyWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||||
|
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
~ChatLobbyWidget();
|
~ChatLobbyWidget();
|
||||||
|
|
||||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_CHATLOBBY) ; } //MainPage
|
virtual QIcon iconPixmap() const override { return QIcon(IMAGE_CHATLOBBY) ; } //MainPage
|
||||||
virtual QString pageName() const { return tr("Chats") ; } //MainPage
|
virtual QString pageName() const override { return tr("Chats") ; } //MainPage
|
||||||
virtual QString helpText() const { return ""; } //MainPage
|
virtual QString helpText() const override { return ""; } //MainPage
|
||||||
|
|
||||||
virtual UserNotify *createUserNotify(QObject *parent) override; //MainPage
|
virtual UserNotify *createUserNotify(QObject *parent) override; //MainPage
|
||||||
|
|
||||||
virtual void updateDisplay();
|
virtual void updateDisplay() override; //RsAutoUpdatePage
|
||||||
|
|
||||||
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
|
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
|
||||||
void addChatPage(ChatLobbyDialog *) ;
|
void addChatPage(ChatLobbyDialog *) ;
|
||||||
|
@ -449,7 +449,7 @@ public:
|
|||||||
case COLUMN_SOURCES:
|
case COLUMN_SOURCES:
|
||||||
{
|
{
|
||||||
int active = 0;
|
int active = 0;
|
||||||
QString fileHash = QString::fromStdString(fileInfo.hash.toStdString());
|
//QString fileHash = QString::fromStdString(fileInfo.hash.toStdString());
|
||||||
|
|
||||||
if (fileInfo.downloadStatus != FT_STATE_COMPLETE)
|
if (fileInfo.downloadStatus != FT_STATE_COMPLETE)
|
||||||
for (std::vector<TransferInfo>::const_iterator pit = fileInfo.peers.begin() ; pit != fileInfo.peers.end(); ++pit)
|
for (std::vector<TransferInfo>::const_iterator pit = fileInfo.peers.begin() ; pit != fileInfo.peers.end(); ++pit)
|
||||||
@ -635,27 +635,27 @@ public:
|
|||||||
for(auto it(downHashes.begin());it!=downHashes.end();++it,++i)
|
for(auto it(downHashes.begin());it!=downHashes.end();++it,++i)
|
||||||
{
|
{
|
||||||
FileInfo fileInfo(mDownloads[i]); // we dont update the data itself but only a copy of it....
|
FileInfo fileInfo(mDownloads[i]); // we dont update the data itself but only a copy of it....
|
||||||
int old_size = fileInfo.peers.size() ;
|
int old_peers_size = fileInfo.peers.size() ;
|
||||||
|
|
||||||
rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, fileInfo);
|
rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, fileInfo);
|
||||||
|
|
||||||
int new_size = fileInfo.peers.size() ;
|
int new_size = fileInfo.peers.size() ;
|
||||||
|
|
||||||
if(old_size < new_size)
|
if(old_peers_size < new_size)
|
||||||
{
|
{
|
||||||
beginInsertRows(index(i,0), old_size, new_size-1);
|
beginInsertRows(index(i,0), old_peers_size, new_size-1);
|
||||||
insertRows(old_size, new_size - old_size,index(i,0));
|
insertRows(old_peers_size, new_size - old_peers_size,index(i,0));
|
||||||
#ifdef DEBUG_DOWNLOADLIST
|
#ifdef DEBUG_DOWNLOADLIST
|
||||||
std::cerr << "called insert rows ( " << old_size << ", " << new_size - old_size << ",index(" << index(i,0)<< "))" << std::endl;
|
std::cerr << "called insert rows ( " << old_peers_size << ", " << new_size - old_peers_size << ",index(" << index(i,0)<< "))" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
else if(new_size < old_size)
|
else if(new_size < old_peers_size)
|
||||||
{
|
{
|
||||||
beginRemoveRows(index(i,0), new_size, old_size-1);
|
beginRemoveRows(index(i,0), new_size, old_peers_size-1);
|
||||||
removeRows(new_size, old_size - new_size,index(i,0));
|
removeRows(new_size, old_peers_size - new_size,index(i,0));
|
||||||
#ifdef DEBUG_DOWNLOADLIST
|
#ifdef DEBUG_DOWNLOADLIST
|
||||||
std::cerr << "called remove rows ( " << old_size << ", " << old_size - new_size << ",index(" << index(i,0)<< "))" << std::endl;
|
std::cerr << "called remove rows ( " << old_peers_size << ", " << old_peers_size - new_size << ",index(" << index(i,0)<< "))" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
@ -742,7 +742,7 @@ private:
|
|||||||
class SortByNameItem : public QStandardItem
|
class SortByNameItem : public QStandardItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SortByNameItem(QHeaderView *header) : QStandardItem()
|
explicit SortByNameItem(QHeaderView *header) : QStandardItem()
|
||||||
{
|
{
|
||||||
this->header = header;
|
this->header = header;
|
||||||
}
|
}
|
||||||
@ -780,9 +780,9 @@ private:
|
|||||||
class ProgressItem : public SortByNameItem
|
class ProgressItem : public SortByNameItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProgressItem(QHeaderView *header) : SortByNameItem(header) {}
|
explicit ProgressItem(QHeaderView *header) : SortByNameItem(header) {}
|
||||||
|
|
||||||
virtual bool operator<(const QStandardItem &other) const
|
virtual bool operator<(const QStandardItem &other) const override
|
||||||
{
|
{
|
||||||
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
|
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
|
||||||
|
|
||||||
@ -1077,24 +1077,23 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
int S = static_cast<int>(QFontMetricsF(font()).height());
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
QString help_str = tr(
|
QString help_str = tr(
|
||||||
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> "
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> "
|
||||||
"File Transfer</h1>"
|
" File Transfer</h1>"
|
||||||
"<p>Retroshare brings two ways of transferring files: direct "
|
"<p>Retroshare brings two ways of transferring files: direct "
|
||||||
"transfers from your friends, and distant anonymous tunnelled "
|
" transfers from your friends, and distant anonymous tunnelled "
|
||||||
"transfers. In addition, file transfer is multi-source and "
|
" transfers. In addition, file transfer is multi-source and "
|
||||||
"allows swarming (you can be a source while downloading)</p>"
|
" allows swarming (you can be a source while downloading)</p>"
|
||||||
"<p>You can share files using the "
|
"<p>You can share files using the "
|
||||||
"<img src=\":/images/directoryadd_24x24_shadow.png\" width=%2 />"
|
" <img src=\":/images/directoryadd_24x24_shadow.png\" width=%2 />"
|
||||||
" icon from the left side bar. These files will be listed in "
|
" icon from the left side bar. These files will be listed in "
|
||||||
"the My Files tab. You can decide for each friend group whether"
|
" the My Files tab. You can decide for each friend group whether"
|
||||||
" they can or not see these files in their Friends Files tab</p>"
|
" they can or not see these files in their Friends Files tab</p>"
|
||||||
"<p>The search tab reports files from your friends' file lists,"
|
"<p>The search tab reports files from your friends' file lists,"
|
||||||
" and distant files that can be reached anonymously using the "
|
" and distant files that can be reached anonymously using the "
|
||||||
"multi-hop tunnelling system.</p>")
|
" multi-hop tunnelling system.</p>"
|
||||||
.arg(QString::number(2*S)).arg(QString::number(S)) ;
|
).arg(QString::number(2*H), QString::number(H)) ;
|
||||||
|
|
||||||
|
|
||||||
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
|
||||||
|
|
||||||
@ -1584,7 +1583,6 @@ int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
|||||||
|
|
||||||
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
||||||
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId.toStdString());
|
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId.toStdString());
|
||||||
qlonglong completed = transferInfo.transfered;
|
|
||||||
|
|
||||||
double peerULSpeed = transferInfo.tfRate * 1024.0;
|
double peerULSpeed = transferInfo.tfRate * 1024.0;
|
||||||
|
|
||||||
@ -1602,6 +1600,7 @@ int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
|||||||
peerpinfo.type = FileProgressInfo::UPLOAD_LINE ;
|
peerpinfo.type = FileProgressInfo::UPLOAD_LINE ;
|
||||||
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:nb_chunks ;
|
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty()?0:nb_chunks ;
|
||||||
|
|
||||||
|
qlonglong completed = 0;
|
||||||
if(filled_chunks > 0 && nb_chunks > 0)
|
if(filled_chunks > 0 && nb_chunks > 0)
|
||||||
{
|
{
|
||||||
completed = peerpinfo.cmap.computeProgress(fileInfo.size,chunk_size) ;
|
completed = peerpinfo.cmap.computeProgress(fileInfo.size,chunk_size) ;
|
||||||
@ -1720,9 +1719,6 @@ void TransfersDialog::insertTransfers()
|
|||||||
{
|
{
|
||||||
// Since downloads use an AstractItemModel, we just need to update it, while saving the selected and expanded items.
|
// Since downloads use an AstractItemModel, we just need to update it, while saving the selected and expanded items.
|
||||||
|
|
||||||
std::set<QString> expanded_hashes ;
|
|
||||||
std::set<QString> selected_hashes ;
|
|
||||||
|
|
||||||
DLListModel->update_transfers();
|
DLListModel->update_transfers();
|
||||||
|
|
||||||
// Now show upload hashes. Here we use the "old" way, since the number of uploads is generally not so large.
|
// Now show upload hashes. Here we use the "old" way, since the number of uploads is generally not so large.
|
||||||
@ -1957,16 +1953,16 @@ void TransfersDialog::pasteLink()
|
|||||||
RsCollection col ;
|
RsCollection col ;
|
||||||
RSLinkClipboard::pasteLinks(links,RetroShareLink::TYPE_FILE_TREE);
|
RSLinkClipboard::pasteLinks(links,RetroShareLink::TYPE_FILE_TREE);
|
||||||
|
|
||||||
for(QList<RetroShareLink>::const_iterator it(links.begin());it!=links.end();++it)
|
for(auto &it: links)
|
||||||
{
|
{
|
||||||
auto ft = RsFileTree::fromRadix64((*it).radix().toStdString());
|
auto ft = RsFileTree::fromRadix64(it.radix().toStdString());
|
||||||
col.merge_in(*ft);
|
col.merge_in(*ft);
|
||||||
}
|
}
|
||||||
links.clear();
|
links.clear();
|
||||||
RSLinkClipboard::pasteLinks(links,RetroShareLink::TYPE_FILE);
|
RSLinkClipboard::pasteLinks(links,RetroShareLink::TYPE_FILE);
|
||||||
|
|
||||||
for(QList<RetroShareLink>::const_iterator it(links.begin());it!=links.end();++it)
|
for(auto &it : links)
|
||||||
col.merge_in((*it).name(),(*it).size(),RsFileHash((*it).hash().toStdString())) ;
|
col.merge_in(it.name(),it.size(),RsFileHash(it.hash().toStdString())) ;
|
||||||
|
|
||||||
col.downloadFiles();
|
col.downloadFiles();
|
||||||
}
|
}
|
||||||
@ -1985,7 +1981,7 @@ void TransfersDialog::getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int
|
|||||||
int i, imax = selectedRows.count();
|
int i, imax = selectedRows.count();
|
||||||
for (i = 0; i < imax; ++i) {
|
for (i = 0; i < imax; ++i) {
|
||||||
QModelIndex index = selectedRows.at(i);
|
QModelIndex index = selectedRows.at(i);
|
||||||
if (index.parent().isValid())
|
if (index.parent().isValid() && index.model())
|
||||||
index = index.model()->index(index.parent().row(), COLUMN_ID);
|
index = index.model()->index(index.parent().row(), COLUMN_ID);
|
||||||
|
|
||||||
if (ids) {
|
if (ids) {
|
||||||
|
@ -127,21 +127,21 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
|
|||||||
ui.nicknameLabel->setText(QString::fromUtf8(pd.name.c_str()) + " (" + QString::fromUtf8(pd.location.c_str())+")");
|
ui.nicknameLabel->setText(QString::fromUtf8(pd.name.c_str()) + " (" + QString::fromUtf8(pd.location.c_str())+")");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString hlp_str = tr(
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Network</h1> \
|
QString hlp_str = tr(
|
||||||
<p>The Network tab shows your friend Retroshare nodes: the neighbor Retroshare nodes that are connected to you. \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Network</h1>"
|
||||||
</p> \
|
"<p>The Network tab shows your friend Retroshare nodes: the neighbor Retroshare nodes that are connected to you.</p>"
|
||||||
<p>You can group nodes together to allow a finer level of information access, for instance to only allow \
|
"<p>You can group nodes together to allow a finer level of information access, for instance to only allow"
|
||||||
some nodes to see some of your files.</p> \
|
" some nodes to see some of your files.</p>"
|
||||||
<p>On the right, you will find 3 useful tabs: \
|
"<p>On the right, you will find 3 useful tabs:"
|
||||||
<ul> \
|
" <ul>"
|
||||||
<li>Broadcast sends messages to all connected nodes at once</li> \
|
" <li>Broadcast sends messages to all connected nodes at once</li>"
|
||||||
<li>Local network graph shows the network around you, based on discovery information</li> \
|
" <li>Local network graph shows the network around you, based on discovery information</li>"
|
||||||
<li>Keyring contains node keys you collected, mostly forwarded to you by your friend nodes</li> \
|
" <li>Keyring contains node keys you collected, mostly forwarded to you by your friend nodes</li>"
|
||||||
</ul> </p> \
|
" </ul> </p>"
|
||||||
") ;
|
).arg(QString::number(2*H));
|
||||||
|
|
||||||
registerHelpButton(ui.helpButton, hlp_str,"FriendsDialog") ;
|
registerHelpButton(ui.helpButton, hlp_str,"FriendsDialog") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendsDialog::~FriendsDialog ()
|
FriendsDialog::~FriendsDialog ()
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "retroshare/rsinit.h"
|
#include "retroshare/rsinit.h"
|
||||||
|
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/msgs/MessageComposer.h"
|
#include "gui/msgs/MessageComposer.h"
|
||||||
@ -100,21 +101,20 @@ HomePage::HomePage(QWidget *parent) :
|
|||||||
|
|
||||||
connect(ui->openwebhelp,SIGNAL(clicked()), this,SLOT(openWebHelp())) ;
|
connect(ui->openwebhelp,SIGNAL(clicked()), this,SLOT(openWebHelp())) ;
|
||||||
|
|
||||||
int S = QFontMetricsF(font()).height();
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
QString help_str = tr(
|
QString help_str = tr(
|
||||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>\
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Welcome to Retroshare!</h1>"
|
||||||
<p>You need to <b>make friends</b>! After you create a network of friends or join an existing network,\
|
"<p>You need to <b>make friends</b>! After you create a network of friends or join an existing network,"
|
||||||
you'll be able to exchange files, chat, talk in forums, etc. </p>\
|
" you'll be able to exchange files, chat, talk in forums, etc. </p>"
|
||||||
<div align=center>\
|
"<div align=\"center\"><IMG width=\"%2\" height=\"%3\" src=\":/images/network_map.png\" style=\"display: block; margin-left: auto; margin-right: auto; \"/></div>"
|
||||||
<IMG align=\"center\" width=\"%2\" src=\":/images/network_map.png\"/> \
|
"<p>To do so, copy your Retroshare ID on this page and send it to friends, and add your friends' Retroshare ID.</p>"
|
||||||
</div>\
|
"<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange"
|
||||||
<p>To do so, copy your Retroshare ID on this page and send it to friends, and add your friends' Retroshare ID.</p> \
|
" Retroshare ID with a dedicated Retroshare node, through which"
|
||||||
<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange \
|
" you will be able to anonymously meet other people.</p>"
|
||||||
Retroshare ID with a dedicated Retroshare node, through which\
|
).arg(QString::number(2*H), QString::number(width()*0.5), QString::number(width()*0.5*(337.0/800.0)));//<img> needs height and width defined.
|
||||||
you will be able to anonymously meet other people.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
|
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
||||||
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
|
|
||||||
|
|
||||||
// register a event handler to catch IP updates
|
// register a event handler to catch IP updates
|
||||||
|
|
||||||
mEventHandlerId = 0;
|
mEventHandlerId = 0;
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
|
||||||
@ -249,13 +249,8 @@ void HomePage::updateOwnCert()
|
|||||||
ui->retroshareid->setToolTip(description);
|
ui->retroshareid->setToolTip(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
static void sendMail(const QString &sAddress, const QString &sSubject, const QString &sBody)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
/* search and replace the end of lines with: "%0D%0A" */
|
|
||||||
sBody.replace("\n", "%0D%0A");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QUrl url = QUrl("mailto:" + sAddress);
|
QUrl url = QUrl("mailto:" + sAddress);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
@ -265,7 +260,12 @@ static void sendMail(QString sAddress, QString sSubject, QString sBody)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
urlQuery.addQueryItem("subject", sSubject);
|
urlQuery.addQueryItem("subject", sSubject);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
/* search and replace the end of lines with: "%0D%0A" */
|
||||||
|
urlQuery.addQueryItem("body", QString(sBody).replace("\n", "%0D%0A"));
|
||||||
|
#else
|
||||||
urlQuery.addQueryItem("body", sBody);
|
urlQuery.addQueryItem("body", sBody);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
url.setQuery(urlQuery);
|
url.setQuery(urlQuery);
|
||||||
|
@ -385,20 +385,22 @@ IdDialog::IdDialog(QWidget *parent)
|
|||||||
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
||||||
mStateHelper->setActive(IDDIALOG_REPLIST, false);
|
mStateHelper->setActive(IDDIALOG_REPLIST, false);
|
||||||
|
|
||||||
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
QString hlp_str = tr(
|
QString hlp_str = tr(
|
||||||
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Identities</h1> \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Identities</h1>"
|
||||||
<p>In this tab you can create/edit <b>pseudo-anonymous identities</b>, and <b>circles</b>.</p> \
|
"<p>In this tab you can create/edit <b>pseudo-anonymous identities</b>, and <b>circles</b>.</p>"
|
||||||
<p><b>Identities</b> are used to securely identify your data: sign messages in chat lobbies, forum and channel posts,\
|
"<p><b>Identities</b> are used to securely identify your data: sign messages in chat lobbies, forum and channel posts,"
|
||||||
receive feedback using the Retroshare built-in email system, post comments \
|
" receive feedback using the Retroshare built-in email system, post comments"
|
||||||
after channel posts, chat using secured tunnels, etc.</p> \
|
" after channel posts, chat using secured tunnels, etc.</p>"
|
||||||
<p>Identities can optionally be <b>signed</b> by your Retroshare node's certificate. \
|
"<p>Identities can optionally be <b>signed</b> by your Retroshare node's certificate."
|
||||||
Signed identities are easier to trust but are easily linked to your node's IP address.</p> \
|
" Signed identities are easier to trust but are easily linked to your node's IP address.</p>"
|
||||||
<p><b>Anonymous identities</b> allow you to anonymously interact with other users. They cannot be \
|
"<p><b>Anonymous identities</b> allow you to anonymously interact with other users. They cannot be"
|
||||||
spoofed, but noone can prove who really owns a given identity.</p> \
|
" spoofed, but noone can prove who really owns a given identity.</p>"
|
||||||
<p><b>Circles</b> are groups of identities (anonymous or signed), that are shared at a distance over the network. They can be \
|
"<p><b>Circles</b> are groups of identities (anonymous or signed), that are shared at a distance over the network. They can be"
|
||||||
used to restrict the visibility to forums, channels, etc. </p> \
|
" used to restrict the visibility to forums, channels, etc. </p>"
|
||||||
<p>An <b>circle</b> can be restricted to another circle, thereby limiting its visibility to members of that circle \
|
"<p>An <b>circle</b> can be restricted to another circle, thereby limiting its visibility to members of that circle"
|
||||||
or even self-restricted, meaning that it is only visible to invited members.</p>") ;
|
" or even self-restricted, meaning that it is only visible to invited members.</p>"
|
||||||
|
).arg(QString::number(2*H));
|
||||||
|
|
||||||
registerHelpButton(ui->helpButton, hlp_str,"PeopleDialog") ;
|
registerHelpButton(ui->helpButton, hlp_str,"PeopleDialog") ;
|
||||||
|
|
||||||
|
@ -18,12 +18,14 @@
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <retroshare-gui/mainpage.h>
|
#include <retroshare-gui/mainpage.h>
|
||||||
|
|
||||||
#include "common/FloatingHelpBrowser.h"
|
#include "common/FloatingHelpBrowser.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
|
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
|
||||||
{
|
{
|
||||||
@ -44,13 +46,13 @@ UserNotify *MainPage::getUserNotify()
|
|||||||
|
|
||||||
void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name)
|
void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name)
|
||||||
{
|
{
|
||||||
mHelpCodeName = code_name ;
|
mHelpCodeName = code_name ;
|
||||||
|
|
||||||
if (mHelpBrowser == NULL)
|
if (mHelpBrowser == nullptr)
|
||||||
mHelpBrowser = new FloatingHelpBrowser(this, button) ;
|
mHelpBrowser = new FloatingHelpBrowser(this, button) ;
|
||||||
|
|
||||||
float S = QFontMetricsF(button->font()).height() ;
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
button->setIconSize(QSize(S,S)) ;
|
button->setIconSize(QSize(H, H)) ;//Square Icon
|
||||||
|
|
||||||
mHelpBrowser->setHelpText(help_html_text) ;
|
mHelpBrowser->setHelpText(help_html_text) ;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <retroshare/rsplugin.h>
|
#include <retroshare/rsplugin.h>
|
||||||
#include <retroshare/rsposted.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "feeds/BoardsCommentsItem.h"
|
#include "feeds/BoardsCommentsItem.h"
|
||||||
#include "feeds/ChatMsgItem.h"
|
#include "feeds/ChatMsgItem.h"
|
||||||
@ -111,22 +112,23 @@ NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed),
|
|||||||
connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
|
||||||
ui->feedOptionsButton->hide(); // (csoler) Hidden until we repare the system to display a specific settings page.
|
ui->feedOptionsButton->hide(); // (csoler) Hidden until we repare the system to display a specific settings page.
|
||||||
|
|
||||||
QString hlp_str = tr(
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
" <h1><img width=\"32\" src=\":/icons/help_64.png\"> Activity Feed</h1> \
|
QString hlp_str = tr(
|
||||||
<p>The Activity Feed displays the last events on your network, sorted by the time you received them. \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Activity Feed</h1>"
|
||||||
This gives you a summary of the activity of your friends. \
|
"<p>The Activity Feed displays the last events on your network, sorted by the time you received them."
|
||||||
You can configure which events to show by pressing on <b>Options</b>. </p> \
|
" This gives you a summary of the activity of your friends."
|
||||||
<p>The various events shown are: \
|
" You can configure which events to show by pressing on <b>Options</b>. </p>"
|
||||||
<ul> \
|
"<p>The various events shown are:"
|
||||||
<li>Connection attempts (useful to make friends with new people and control who's trying to reach you)</li> \
|
" <ul>"
|
||||||
<li>Channel, Forum and Board posts</li> \
|
" <li>Connection attempts (useful to make friends with new people and control who's trying to reach you)</li>"
|
||||||
<li>Circle membership requests and invites</li> \
|
" <li>Channel, Forum and Board posts</li>"
|
||||||
<li>New Channels, Forums and Boards you can subscribe to</li> \
|
" <li>Circle membership requests and invites</li>"
|
||||||
<li>Channel and Board comments</li> \
|
" <li>New Channels, Forums and Boards you can subscribe to</li>"
|
||||||
<li>New Mail messages</li> \
|
" <li>Channel and Board comments</li>"
|
||||||
<li>Private messages from your friends</li> \
|
" <li>New Mail messages</li>"
|
||||||
</ul> </p> \
|
" <li>Private messages from your friends</li>"
|
||||||
") ;
|
" </ul> </p>"
|
||||||
|
).arg(QString::number(2*H));
|
||||||
|
|
||||||
registerHelpButton(ui->helpButton,hlp_str,"NewFeed") ;
|
registerHelpButton(ui->helpButton,hlp_str,"NewFeed") ;
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
#include "util/misc.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
#include <retroshare/rsposted.h>
|
#include <retroshare/rsposted.h>
|
||||||
@ -95,14 +96,19 @@ UserNotify *PostedDialog::createUserNotify(QObject *parent)
|
|||||||
|
|
||||||
QString PostedDialog::getHelpString() const
|
QString PostedDialog::getHelpString() const
|
||||||
{
|
{
|
||||||
QString hlp_str = tr("<h1><img width=\"32\" src=\":/icons/help_64.png\"> Boards</h1> \
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
<p>The Boards service allows you to share images, blog posts & internet links, that spread among Retroshare nodes like forums and \
|
|
||||||
channels</p> \
|
QString hlp_str = tr(
|
||||||
<p>Posts can be commented by subscribed users. A promotion system also gives the opportunity to \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Boards</h1>"
|
||||||
enlight important links.</p> \
|
"<p>The Boards service allows you to share images, blog posts & internet links, that spread among Retroshare nodes like forums and"
|
||||||
<p>There is no restriction on which links are shared. Be careful when clicking on them.</p>\
|
" channels</p>"
|
||||||
<p>Boards are kept for %1 days, and sync-ed over the last %2 days, unless you change this.</p>\
|
"<p>Posts can be commented by subscribed users. A promotion system also gives the opportunity to"
|
||||||
").arg(QString::number(rsPosted->getDefaultStoragePeriod()/86400)).arg(QString::number(rsPosted->getDefaultSyncPeriod()/86400));
|
" enlight important links.</p>"
|
||||||
|
"<p>There is no restriction on which links are shared. Be careful when clicking on them.</p>"
|
||||||
|
"<p>Boards are kept for %2 days, and sync-ed over the last %3 days, unless you change this.</p>"
|
||||||
|
).arg( QString::number(2*H)
|
||||||
|
, QString::number(rsPosted->getDefaultStoragePeriod()/86400)
|
||||||
|
, QString::number(rsPosted->getDefaultSyncPeriod()/86400));
|
||||||
|
|
||||||
return hlp_str ;
|
return hlp_str ;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
// class GxsChannelGroupInfoData : public RsUserdata
|
// class GxsChannelGroupInfoData : public RsUserdata
|
||||||
// {
|
// {
|
||||||
@ -90,8 +91,8 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
|||||||
|
|
||||||
const RsGxsChannelSearchResultEvent*f = dynamic_cast<const RsGxsChannelSearchResultEvent*>(event.get());
|
const RsGxsChannelSearchResultEvent*f = dynamic_cast<const RsGxsChannelSearchResultEvent*>(event.get());
|
||||||
|
|
||||||
if(nullptr != f)
|
if(nullptr != f)
|
||||||
for(auto it:f->mSearchResultsMap)
|
for(auto &it:f->mSearchResultsMap)
|
||||||
updateSearchResults(it.first);
|
updateSearchResults(it.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,18 +103,23 @@ GxsChannelDialog::~GxsChannelDialog()
|
|||||||
|
|
||||||
QString GxsChannelDialog::getHelpString() const
|
QString GxsChannelDialog::getHelpString() const
|
||||||
{
|
{
|
||||||
QString hlp_str = tr("<h1><img width=\"32\" src=\":/icons/help_64.png\"> Channels</h1> \
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
<p>Channels allow you to post data (e.g. movies, music) that will spread in the network</p> \
|
|
||||||
<p>You can see the channels your friends are subscribed to, and you automatically forward subscribed channels to \
|
QString hlp_str = tr(
|
||||||
your friends. This promotes good channels in the network.</p>\
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Channels</h1>"
|
||||||
<p>Only the channel's creator can post on that channel. Other peers \
|
"<p>Channels allow you to post data (e.g. movies, music) that will spread in the network</p>"
|
||||||
in the network can only read from it, unless the channel is private. You can however share \
|
"<p>You can see the channels your friends are subscribed to, and you automatically forward subscribed channels to"
|
||||||
the posting rights or the reading rights with friend Retroshare nodes.</p>\
|
" your friends. This promotes good channels in the network.</p>"
|
||||||
<p>Channels can be made anonymous, or attached to a Retroshare identity so that readers can contact you if needed.\
|
"<p>Only the channel's creator can post on that channel. Other peers"
|
||||||
Enable \"Allow Comments\" if you want to let users comment on your posts.</p>\
|
" in the network can only read from it, unless the channel is private. You can however share"
|
||||||
<p>Channel posts are kept for %1 days, and sync-ed over the last %2 days, unless you change this.</p>\
|
" the posting rights or the reading rights with friend Retroshare nodes.</p>"
|
||||||
<p>UI Tip: use Control + mouse wheel to control image size in the thumbnail view.</p>\
|
"<p>Channels can be made anonymous, or attached to a Retroshare identity so that readers can contact you if needed."
|
||||||
").arg(QString::number(rsGxsChannels->getDefaultStoragePeriod()/86400)).arg(QString::number(rsGxsChannels->getDefaultSyncPeriod()/86400));
|
" Enable \"Allow Comments\" if you want to let users comment on your posts.</p>"
|
||||||
|
"<p>Channel posts are kept for %2 days, and sync-ed over the last %3 days, unless you change this.</p>"
|
||||||
|
"<p>UI Tip: use Control + mouse wheel to control image size in the thumbnail view.</p>"
|
||||||
|
).arg( QString::number(2*H)
|
||||||
|
, QString::number(rsGxsChannels->getDefaultStoragePeriod()/86400)
|
||||||
|
, QString::number(rsGxsChannels->getDefaultSyncPeriod()/86400));
|
||||||
|
|
||||||
return hlp_str ;
|
return hlp_str ;
|
||||||
}
|
}
|
||||||
@ -260,11 +266,13 @@ void GxsChannelDialog::groupTreeCustomActions(RsGxsGroupId grpId, int subscribeF
|
|||||||
|
|
||||||
if (isSubscribed)
|
if (isSubscribed)
|
||||||
{
|
{
|
||||||
QAction *action = autoDownload ? (new QAction(FilesDefs::getIconFromQtResourcePath(":/images/redled.png"), tr("Disable Auto-Download"), this))
|
{
|
||||||
: (new QAction(FilesDefs::getIconFromQtResourcePath(":/images/start.png"),tr("Enable Auto-Download"), this));
|
QAction *action = autoDownload ? (new QAction(FilesDefs::getIconFromQtResourcePath(":/images/redled.png"), tr("Disable Auto-Download"), this))
|
||||||
|
: (new QAction(FilesDefs::getIconFromQtResourcePath(":/images/start.png"),tr("Enable Auto-Download"), this));
|
||||||
|
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(toggleAutoDownload()));
|
connect(action, SIGNAL(triggered()), this, SLOT(toggleAutoDownload()));
|
||||||
actions.append(action);
|
actions.append(action);
|
||||||
|
}
|
||||||
|
|
||||||
std::string dl_directory;
|
std::string dl_directory;
|
||||||
rsGxsChannels->getChannelDownloadDirectory(grpId,dl_directory) ;
|
rsGxsChannels->getChannelDownloadDirectory(grpId,dl_directory) ;
|
||||||
@ -282,20 +290,20 @@ void GxsChannelDialog::groupTreeCustomActions(RsGxsGroupId grpId, int subscribeF
|
|||||||
|
|
||||||
for(std::list<SharedDirInfo>::const_iterator it(lst.begin());it!=lst.end();++it)
|
for(std::list<SharedDirInfo>::const_iterator it(lst.begin());it!=lst.end();++it)
|
||||||
{
|
{
|
||||||
QAction *action = NULL;
|
QAction *fileAction = NULL;
|
||||||
|
|
||||||
if(dl_directory == it->filename)
|
if(dl_directory == it->filename)
|
||||||
{
|
{
|
||||||
action = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/start.png"),QString::fromUtf8(it->filename.c_str()),NULL) ;
|
fileAction = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/start.png"),QString::fromUtf8(it->filename.c_str()),NULL) ;
|
||||||
found = true ;
|
found = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
action = new QAction(QString::fromUtf8(it->filename.c_str()),NULL) ;
|
fileAction = new QAction(QString::fromUtf8(it->filename.c_str()),NULL) ;
|
||||||
|
|
||||||
connect(action,SIGNAL(triggered()),this,SLOT(setDownloadDirectory())) ;
|
connect(fileAction,SIGNAL(triggered()),this,SLOT(setDownloadDirectory())) ;
|
||||||
action->setData(QString::fromUtf8(it->filename.c_str())) ;
|
fileAction->setData(QString::fromUtf8(it->filename.c_str())) ;
|
||||||
|
|
||||||
mnu->addAction(action) ;
|
mnu->addAction(fileAction) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found && !dl_directory.empty())
|
if(!found && !dl_directory.empty())
|
||||||
@ -368,17 +376,17 @@ bool GxsChannelDialog::getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo
|
|||||||
{
|
{
|
||||||
std::vector<RsGxsChannelGroup> groups;
|
std::vector<RsGxsChannelGroup> groups;
|
||||||
|
|
||||||
// request all group infos at once
|
// request all group infos at once
|
||||||
|
|
||||||
if(! rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>(),groups))
|
if(! rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>(),groups))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Save groups to fill icons and description */
|
/* Save groups to fill icons and description */
|
||||||
|
|
||||||
for (auto& group: groups)
|
for (auto& group: groups)
|
||||||
groupInfo.push_back(new RsGxsChannelGroup(group));
|
groupInfo.push_back(new RsGxsChannelGroup(group));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
#include "CreateGxsForumMsg.h"
|
#include "CreateGxsForumMsg.h"
|
||||||
#include "GxsForumUserNotify.h"
|
#include "GxsForumUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
|
||||||
#include "util/qtthreadsutils.h"
|
|
||||||
#include "gui/common/GroupTreeWidget.h"
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
|
|
||||||
class GxsForumGroupInfoData : public RsUserdata
|
class GxsForumGroupInfoData : public RsUserdata
|
||||||
{
|
{
|
||||||
@ -110,13 +111,17 @@ bool GxsForumsDialog::getGroupStatistics(const RsGxsGroupId& groupId,GxsGroupSta
|
|||||||
|
|
||||||
QString GxsForumsDialog::getHelpString() const
|
QString GxsForumsDialog::getHelpString() const
|
||||||
{
|
{
|
||||||
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
|
|
||||||
QString hlp_str = tr(
|
QString hlp_str = tr(
|
||||||
"<h1><img width=\"32\" src=\":/icons/help_64.png\"> Forums</h1> \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Forums</h1>"
|
||||||
<p>Retroshare Forums look like internet forums, but they work in a decentralized way</p> \
|
"<p>Retroshare Forums look like internet forums, but they work in a decentralized way</p>"
|
||||||
<p>You see forums your friends are subscribed to, and you forward subscribed forums to \
|
"<p>You see forums your friends are subscribed to, and you forward subscribed forums to"
|
||||||
your friends. This automatically promotes interesting forums in the network.</p> \
|
" your friends. This automatically promotes interesting forums in the network.</p>"
|
||||||
<p>Forum messages are kept for %1 days and sync-ed over the last %2 days, unless you configure it otherwise.</p>\
|
"<p>Forum messages are kept for %2 days and sync-ed over the last %3 days, unless you configure it otherwise.</p>"
|
||||||
").arg(QString::number(rsGxsForums->getDefaultStoragePeriod()/86400)).arg(QString::number(rsGxsForums->getDefaultSyncPeriod()/86400));
|
).arg( QString::number(2*H)
|
||||||
|
, QString::number(rsGxsForums->getDefaultStoragePeriod()/86400)
|
||||||
|
, QString::number(rsGxsForums->getDefaultSyncPeriod()/86400));
|
||||||
|
|
||||||
return hlp_str ;
|
return hlp_str ;
|
||||||
}
|
}
|
||||||
@ -233,9 +238,11 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *grou
|
|||||||
groupItemInfo.description = QString::fromUtf8(forumGroupData->mDescription.c_str());
|
groupItemInfo.description = QString::fromUtf8(forumGroupData->mDescription.c_str());
|
||||||
|
|
||||||
if (!groupData->mMeta.mCircleId.isNull() )
|
if (!groupData->mMeta.mCircleId.isNull() )
|
||||||
|
{
|
||||||
if (details.mRestrictedCircleId == details.mCircleId)
|
if (details.mRestrictedCircleId == details.mCircleId)
|
||||||
groupItemInfo.icon = FilesDefs::getIconFromQtResourcePath(":icons/png/forums-red.png");
|
groupItemInfo.icon = FilesDefs::getIconFromQtResourcePath(":icons/png/forums-red.png");
|
||||||
else
|
else
|
||||||
groupItemInfo.icon = FilesDefs::getIconFromQtResourcePath(":icons/png/forums-signed.png");
|
groupItemInfo.icon = FilesDefs::getIconFromQtResourcePath(":icons/png/forums-signed.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +44,10 @@
|
|||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
|
||||||
#include "util/DateTime.h"
|
#include "util/DateTime.h"
|
||||||
#include "util/RsProtectedTimer.h"
|
#include "util/misc.h"
|
||||||
#include "util/QtVersion.h"
|
#include "util/QtVersion.h"
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
|
#include "util/RsProtectedTimer.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
@ -254,17 +255,17 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
ui.tabWidget->hideCloseButton(0);
|
ui.tabWidget->hideCloseButton(0);
|
||||||
ui.tabWidget->setHideTabBarWithOneTab(true);
|
ui.tabWidget->setHideTabBarWithOneTab(true);
|
||||||
|
|
||||||
int S = QFontMetricsF(font()).height();
|
int H = misc::getFontSizeFactor("HelpButton").height();
|
||||||
QString help_str = tr(
|
QString help_str = tr(
|
||||||
" <h1><img width=\"%1\" src=\":/icons/help_64.png\"> Messages</h1> \
|
"<h1><img width=\"%1\" src=\":/icons/help_64.png\"> Messages</h1>"
|
||||||
<p>Retroshare has its own internal email system. You can send/receive emails to/from connected friend nodes.</p> \
|
"<p>Retroshare has its own internal email system. You can send/receive emails to/from connected friend nodes.</p>"
|
||||||
<p>It is also possible to send messages to other people's Identities using the global routing system. These messages \
|
"<p>It is also possible to send messages to other people's Identities using the global routing system. These messages"
|
||||||
are always encrypted and signed, and are relayed by intermediate nodes until they reach their final destination. </p>\
|
" are always encrypted and signed, and are relayed by intermediate nodes until they reach their final destination. </p>"
|
||||||
<p>Distant messages stay into your Outbox until an acknowledgement of receipt has been received.</p>\
|
"<p>Distant messages stay into your Outbox until an acknowledgement of receipt has been received.</p>"
|
||||||
<p>Generally, you may use messages to recommend files to your friends by pasting file links, \
|
"<p>Generally, you may use messages to recommend files to your friends by pasting file links,"
|
||||||
or recommend friend nodes to other friend nodes, in order to strengthen your network, or send feedback \
|
" or recommend friend nodes to other friend nodes, in order to strengthen your network, or send feedback"
|
||||||
to a channel's owner.</p> \
|
" to a channel's owner.</p>"
|
||||||
").arg(QString::number(2*S), QString::number(S)) ;
|
).arg(QString::number(2*H)) ;
|
||||||
|
|
||||||
registerHelpButton(ui.helpButton,help_str,"MessagesDialog") ;
|
registerHelpButton(ui.helpButton,help_str,"MessagesDialog") ;
|
||||||
|
|
||||||
|
@ -19,17 +19,20 @@
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <QString>
|
#include "misc.h"
|
||||||
|
|
||||||
|
#include "gui/common/FilesDefs.h"
|
||||||
|
#include "util/rsdebug.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QByteArray>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QByteArray>
|
|
||||||
#include <QBuffer>
|
|
||||||
#include <time.h>
|
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include "misc.h"
|
#include <time.h>
|
||||||
#include "util/rsdebug.h"
|
|
||||||
#include "gui/common/FilesDefs.h"
|
|
||||||
|
|
||||||
// return best userfriendly storage unit (B, KiB, MiB, GiB, TiB)
|
// return best userfriendly storage unit (B, KiB, MiB, GiB, TiB)
|
||||||
// use Binary prefix standards from IEC 60027-2
|
// use Binary prefix standards from IEC 60027-2
|
||||||
@ -67,46 +70,44 @@ QString misc::fingerPrintStyleSplit(const QString& in)
|
|||||||
bool misc::isPreviewable(QString extension)
|
bool misc::isPreviewable(QString extension)
|
||||||
{
|
{
|
||||||
extension = extension.toUpper();
|
extension = extension.toUpper();
|
||||||
if(extension == "AVI") return true;
|
|
||||||
if(extension == "MP3") return true;
|
|
||||||
if(extension == "OGG") return true;
|
|
||||||
if(extension == "OGM") return true;
|
|
||||||
if(extension == "WMV") return true;
|
|
||||||
if(extension == "WMA") return true;
|
|
||||||
if(extension == "MPEG") return true;
|
|
||||||
if(extension == "MPG") return true;
|
|
||||||
if(extension == "ASF") return true;
|
|
||||||
if(extension == "QT") return true;
|
|
||||||
if(extension == "RM") return true;
|
|
||||||
if(extension == "RMVB") return true;
|
|
||||||
if(extension == "RMV") return true;
|
|
||||||
if(extension == "SWF") return true;
|
|
||||||
if(extension == "FLV") return true;
|
|
||||||
if(extension == "WAV") return true;
|
|
||||||
if(extension == "MOV") return true;
|
|
||||||
if(extension == "VOB") return true;
|
|
||||||
if(extension == "MID") return true;
|
|
||||||
if(extension == "AC3") return true;
|
|
||||||
if(extension == "MP4") return true;
|
|
||||||
if(extension == "MP2") return true;
|
|
||||||
if(extension == "AVI") return true;
|
|
||||||
if(extension == "FLAC") return true;
|
|
||||||
if(extension == "AU") return true;
|
|
||||||
if(extension == "MPE") return true;
|
|
||||||
if(extension == "MOV") return true;
|
|
||||||
if(extension == "MKV") return true;
|
|
||||||
if(extension == "AIF") return true;
|
|
||||||
if(extension == "AIFF") return true;
|
|
||||||
if(extension == "AIFC") return true;
|
|
||||||
if(extension == "RA") return true;
|
|
||||||
if(extension == "RAM") return true;
|
|
||||||
if(extension == "M4P") return true;
|
|
||||||
if(extension == "M4A") return true;
|
|
||||||
if(extension == "3GP") return true;
|
if(extension == "3GP") return true;
|
||||||
if(extension == "AAC") return true;
|
if(extension == "AAC") return true;
|
||||||
if(extension == "SWA") return true;
|
if(extension == "AC3") return true;
|
||||||
|
if(extension == "AIF") return true;
|
||||||
|
if(extension == "AIFC") return true;
|
||||||
|
if(extension == "AIFF") return true;
|
||||||
|
if(extension == "ASF") return true;
|
||||||
|
if(extension == "AU") return true;
|
||||||
|
if(extension == "AVI") return true;
|
||||||
|
if(extension == "FLAC") return true;
|
||||||
|
if(extension == "FLV") return true;
|
||||||
|
if(extension == "M4P") return true;
|
||||||
|
if(extension == "M4A") return true;
|
||||||
|
if(extension == "MOV") return true;
|
||||||
|
if(extension == "MID") return true;
|
||||||
|
if(extension == "MKV") return true;
|
||||||
|
if(extension == "MP2") return true;
|
||||||
|
if(extension == "MP3") return true;
|
||||||
|
if(extension == "MP4") return true;
|
||||||
if(extension == "MPC") return true;
|
if(extension == "MPC") return true;
|
||||||
|
if(extension == "MPE") return true;
|
||||||
|
if(extension == "MPEG") return true;
|
||||||
|
if(extension == "MPG") return true;
|
||||||
if(extension == "MPP") return true;
|
if(extension == "MPP") return true;
|
||||||
|
if(extension == "OGG") return true;
|
||||||
|
if(extension == "OGM") return true;
|
||||||
|
if(extension == "QT") return true;
|
||||||
|
if(extension == "RA") return true;
|
||||||
|
if(extension == "RAM") return true;
|
||||||
|
if(extension == "RM") return true;
|
||||||
|
if(extension == "RMV") return true;
|
||||||
|
if(extension == "RMVB") return true;
|
||||||
|
if(extension == "SWA") return true;
|
||||||
|
if(extension == "SWF") return true;
|
||||||
|
if(extension == "VOB") return true;
|
||||||
|
if(extension == "WAV") return true;
|
||||||
|
if(extension == "WMA") return true;
|
||||||
|
if(extension == "WMV") return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +228,6 @@ QString misc::userFriendlyUnit(double count, unsigned int decimal, double factor
|
|||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString output;
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 5; ++i) {
|
for (i = 0; i < 5; ++i) {
|
||||||
if (count < factor) {
|
if (count < factor) {
|
||||||
@ -434,3 +433,12 @@ void misc::clearLayout(QLayout * layout) {
|
|||||||
//delete item;//Auto deleted by Qt.
|
//delete item;//Auto deleted by Qt.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSizeF misc::getFontSizeFactor(const QString &group, const qreal defaultFactor /*= 1.0*/)
|
||||||
|
{
|
||||||
|
static qreal appFontWidth = QFontMetrics(QApplication::font()).maxWidth();
|
||||||
|
static qreal appFontHeight = QFontMetrics(QApplication::font()).height();
|
||||||
|
qreal factor = Settings->valueFromGroup("FontHeighFactor",group,defaultFactor).toReal();
|
||||||
|
return QSizeF(appFontWidth*factor,appFontHeight*factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -22,14 +22,15 @@
|
|||||||
#ifndef MISC_H
|
#ifndef MISC_H
|
||||||
#define MISC_H
|
#define MISC_H
|
||||||
|
|
||||||
#include <stdexcept>
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QLayout>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QLayout>
|
|
||||||
|
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include <stdexcept>
|
||||||
|
|
||||||
/* Miscellaneaous functions that can be useful */
|
/* Miscellaneaous functions that can be useful */
|
||||||
class misc : public QObject
|
class misc : public QObject
|
||||||
@ -165,15 +166,15 @@ class misc : public QObject
|
|||||||
static QPixmap getOpenThumbnailedPicture(QWidget *parent, const QString &caption, int width, int height);
|
static QPixmap getOpenThumbnailedPicture(QWidget *parent, const QString &caption, int width, int height);
|
||||||
static bool getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type
|
static bool getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type
|
||||||
, const QString &caption, const QString &filter
|
, const QString &caption, const QString &filter
|
||||||
, QString &file, QFileDialog::Options options = 0);
|
, QString &file, QFileDialog::Options options = QFileDialog::Options());
|
||||||
static bool getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type
|
static bool getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type
|
||||||
, const QString &caption, const QString &filter
|
, const QString &caption, const QString &filter
|
||||||
, QStringList &files, QFileDialog::Options options = 0);
|
, QStringList &files, QFileDialog::Options options = QFileDialog::Options());
|
||||||
|
|
||||||
static bool getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
|
static bool getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
|
||||||
, const QString &caption , const QString &filter
|
, const QString &caption , const QString &filter
|
||||||
, QString &file, QString *selectedFilter = NULL
|
, QString &file, QString *selectedFilter = NULL
|
||||||
, QFileDialog::Options options = 0);
|
, QFileDialog::Options options = QFileDialog::Options());
|
||||||
|
|
||||||
static QFont getFont(bool *ok
|
static QFont getFont(bool *ok
|
||||||
, const QFont &initial
|
, const QFont &initial
|
||||||
@ -187,6 +188,9 @@ class misc : public QObject
|
|||||||
//Clear QLayout
|
//Clear QLayout
|
||||||
static void clearLayout(QLayout *layout);
|
static void clearLayout(QLayout *layout);
|
||||||
|
|
||||||
|
static QSizeF getFontSizeFactor(const QString &group, const qreal defaultFactor = 1.0);
|
||||||
|
static QSizeF getFontSizeFactor() {return getFontSizeFactor("Main");}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Trick to get a portable sleep() function
|
// Trick to get a portable sleep() function
|
||||||
@ -201,7 +205,7 @@ class SleeperThread : public QThread{
|
|||||||
template<class T> class SignalsBlocker
|
template<class T> class SignalsBlocker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignalsBlocker(T *blocked) : blocked(blocked), previous(blocked->blockSignals(true)) {}
|
explicit SignalsBlocker(T *blocked) : blocked(blocked), previous(blocked->blockSignals(true)) {}
|
||||||
~SignalsBlocker() { blocked->blockSignals(previous); }
|
~SignalsBlocker() { blocked->blockSignals(previous); }
|
||||||
|
|
||||||
T *operator->() { return blocked; }
|
T *operator->() { return blocked; }
|
||||||
|
Loading…
Reference in New Issue
Block a user