Merge branch 'RetroShare:master' into picturepreview-fileattachments-forums

This commit is contained in:
defnax 2025-07-08 14:41:11 +02:00 committed by GitHub
commit d3071e8fe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
150 changed files with 3691 additions and 1771 deletions

5
.gitmodules vendored
View file

@ -36,3 +36,8 @@
[submodule "retroshare-webui"]
path = retroshare-webui
url = https://github.com/RetroShare/RSNewWebUI.git
branch = master
[submodule "supportlibs/librnp"]
path = supportlibs/librnp
url = https://github.com/rnpgp/rnp.git
branch = main

View file

@ -7,6 +7,9 @@ RetroShare is a decentralized, private, secure, cross-platform, communication
toolkit.
RetroShare provides file sharing, chat, messages, forums, channels and more.
|===============================================================================
| Developer Documentation | image:https://deepwiki.com/badge.svg[link="https://deepwiki.com/RetroShare/RetroShare",title="Ask DeepWiki"]
|===============================================================================
.Build Status
|===============================================================================
|GNU/Linux (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"]

View file

@ -25,9 +25,6 @@ CONFIG += c++14
TEMPLATE = subdirs
SUBDIRS += openpgpsdk
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
SUBDIRS += jsonapi-generator
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
@ -36,7 +33,7 @@ rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
SUBDIRS += libbitdht
libbitdht.file = libbitdht/src/libbitdht.pro
libretroshare.depends += openpgpsdk libbitdht
libretroshare.depends += libbitdht
SUBDIRS += libretroshare
libretroshare.file = libretroshare/src/libretroshare.pro

View file

@ -2,13 +2,15 @@
## Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/)
Qt 5.15 is not available as install package.
Use default options. And add Qt Script support.
Download Qt 5.15.x from here: [Qt 5.15.17](https://download.qt.io/archive/qt/5.15/5.15.17/single/qt-everywhere-opensource-src-5.15.17.tar.xz)
Instruction howto Build Qt 5.15.x on macOS: [macOS Building](https://doc.qt.io/archives/qt-5.15/macos-building.html)
## Set the Environment Variables
Add to the PATH environment variable by editing your *~/.profile* file.
export PATH="/users/$USER/Qt/5.14.1/clang_64/bin:$PATH"
export PATH="/users/$USER/Qt/5.15.17/clang_64/bin:$PATH"
Depends on which version of Qt you use.
@ -32,11 +34,9 @@ In GitHub Desktop -> Clone Repository -> URL
## ***Get XCode & MacOSX SDK***
Install XCode following this guide: [XCode](http://guide.macports.org/#installing.xcode)
To identify the correct version of Xcode to install, you need to know which OS you are running. Go to the [x] menu -> "About This Mac" and read the macOS version number.
If you are running the macOS Catalina >= 10.15, you can install Xcode directly from App Store using the instructions below.
If you are running macOS Ventura 13.5 or later, you can install Xcode directly from App Store using the instructions below.
You can find older versions of Xcode at [Apple Developer Downloads](https://developer.apple.com/downloads/). Find the appropriate .xip file for your macOS version
@ -53,27 +53,12 @@ Install XCode command line developer tools:
Start XCode to get it updated and to able C compiler to create executables.
Get Your MacOSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
## ***Choose if you use MacPort or HomeBrew***
Older MacOSX SDK is available from here: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs)
### MacPort Installation
Install MacPort following this guide: [MacPort](http://guide.macports.org/#installing.xcode)
#### Install libraries
$ sudo port -v selfupdate
$ sudo port install openssl
$ sudo port install miniupnpc
For VOIP Plugin:
$ sudo port install speex-devel
$ sudo port install opencv
$ sudo port install ffmpeg
### HOMEBREW Installation
Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
@ -85,6 +70,13 @@ Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
$ brew install rapidjson
$ brew install sqlcipher
For RNP lib:
$ brew install bzip2
$ brew install zlib
$ brew install json-c
$ brew install botan@2
#### Install CMake
$ brew install cmake

View file

@ -2,7 +2,7 @@
APP="RetroShare"
RSVERSION="0.6.7a"
QTVERSION="Qt-5.14.1"
QTVERSION="Qt-5.15.11"
# Install the 7z to create dmg archives.
#brew list p7zip || brew install p7zip
@ -21,6 +21,7 @@ rm -rf qrc
/usr/libexec/PlistBuddy -c "Delete :CFBundleGetInfoString" retroshare.app/Contents/Info.plist
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $RSVERSION" retroshare.app/Contents/Info.plist
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $RSVERSION" retroshare.app/Contents/Info.plist
/usr/libexec/PlistBuddy -c "Delete :NSRequiresAquaSystemAppearance" retroshare.app/Contents/Info.plist
# This automatically creates retroshare.dmg

View file

@ -1,10 +1,11 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=RetroShare
Comment=Securely share files with your friends
Comment=Securely communicate with your friends
Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false
Type=Application
Categories=Network;P2P;
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P
MimeType=x-scheme-handler/retroshare;

View file

@ -18,6 +18,8 @@ if errorlevel 1 goto error_env
if not "%ParamNoupdate%"=="1" (
:: Install needed things
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson"
:: rnp
%EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-json-c mingw-w64-%RsMSYS2Architecture%-libbotan"
:: Webui
if "%ParamWebui%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-doxygen"

View file

@ -105,6 +105,7 @@ copy "%RsBuildPath%\retroshare-nogui\src\%RsBuildConfig%\retroshare*-nogui.exe"
copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite%
copy "%RsBuildPath%\supportlibs\cmark\build\src\libcmark.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" copy "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" (
copy "%RsBuildPath%\retroshare-friendserver\src\%RsBuildConfig%\retroshare-friendserver.exe" "%RsDeployPath%" %Quite%
)

View file

@ -16,7 +16,7 @@ if "%~1"=="clean" (
goto exit
)
set MSYS2Version=20231026
set MSYS2Version=20241208
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%

View file

@ -13,12 +13,18 @@ LIBMICROHTTPD_VERSION=0.9.75
FFMPEG_VERSION=4.4
RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.19
#RNP_VERSION=0.17.1
# libaries for rnp
JSON_C_VERSION=0.18
BOTAN_VERSION=2.19.5
DOWNLOAD_PATH?=download
BUILD_PATH=build
LIBS_PATH?=libs
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian copylibs
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian jsonc botan copylibs
#rnp
download: \
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \
@ -363,6 +369,57 @@ $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION): $(DOWNLOAD_PATH)/xapian-core-$(XAPI
rm -r -f xapian-core-$(XAPIAN_VERSION)
mv $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION)
jsonc: $(BUILD_PATH)/json-c-$(JSON_C_VERSION)
$(BUILD_PATH)/json-c-$(JSON_C_VERSION):
# prepare
rm -r -f $(BUILD_PATH)/json-c-*
[ -d "json-c-$(JSON_C_VERSION)" ] || git clone https://github.com/json-c/json-c.git --depth=1 --branch json-c-$(JSON_C_VERSION) "json-c-$(JSON_C_VERSION)"
# build
mkdir -p json-c-$(JSON_C_VERSION)/build
cd json-c-$(JSON_C_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_BUILD_TYPE="release" -DBUILD_SHARED_LIBS=off -DBUILD_STATIC_LIBS=on -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT" -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DCMAKE_INSTALL_PREFIX="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp"
cd json-c-$(JSON_C_VERSION)/build && make install
# cleanup
rm -r -f json-c-$(JSON_C_VERSION)
mv $(BUILD_PATH)/json-c-$(JSON_C_VERSION).tmp $(BUILD_PATH)/json-c-$(JSON_C_VERSION)
botan: $(BUILD_PATH)/botan-$(BOTAN_VERSION)
$(BUILD_PATH)/botan-$(BOTAN_VERSION):
# prepare
pacman --needed --noconfirm -S python3
rm -r -f $(BUILD_PATH)/botan-*
[ -d "botan-$(BOTAN_VERSION)" ] || git clone https://github.com/randombit/botan.git --depth=1 --branch $(BOTAN_VERSION) "botan-$(BOTAN_VERSION)"
# build
if [ $(MSYSTEM) = "MINGW32" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_32 --disable-shared-library --enable-static-library --extra-cxxflags="-D__MINGW_USE_VC2005_COMPAT" --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
if [ $(MSYSTEM) = "MINGW64" ] ; then cd botan-$(BOTAN_VERSION) && ./configure.py --os=mingw --cpu=x86_64 --disable-shared-library --enable-static-library --prefix="`pwd`/../$(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp" ; fi
cd botan-$(BOTAN_VERSION) && make install
# cleanup
rm -r -f botan-$(BOTAN_VERSION)
mv $(BUILD_PATH)/botan-$(BOTAN_VERSION).tmp $(BUILD_PATH)/botan-$(BOTAN_VERSION)
rnp: $(BUILD_PATH)/rnp-$(RNP_VERSION)
$(BUILD_PATH)/rnp-$(RNP_VERSION):
# prepare
rm -r -f $(BUILD_PATH)/rnp-*
[ -d "rnp-$(RNP_VERSION)" ] || git clone https://github.com/rnpgp/rnp.git --depth=1 --branch v$(RNP_VERSION) --recurse-submodules --shallow-submodules "rnp-$(RNP_VERSION)"
# build
mkdir -p rnp-$(RNP_VERSION)/build
cd rnp-$(RNP_VERSION)/build && cmake .. -G"MSYS Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX="`pwd`/install" -DBUILD_SHARED_LIBS=yes -DBUILD_TESTING=off -DCMAKE_CXX_FLAGS="-D__MINGW_USE_VC2005_COMPAT -D__STDC_FORMAT_MACROS" -DBZIP2_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/include" -DBZIP2_LIBRARY_RELEASE="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/lib/libbz2.a" -DBZIP2_LIBRARIES="`pwd`/../../$(BUILD_PATH)/bzip2-$(BZIP2_VERSION)/lib/libbz2.a" -DZLIB_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/zlib-$(ZLIB_VERSION)/include" -DZLIB_LIBRARY="`pwd`/../../$(BUILD_PATH)/zlib-$(ZLIB_VERSION)/lib/libz.a" -DJSON-C_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION)/include/json-c" -DJSON-C_LIBRARY="`pwd`/../../$(BUILD_PATH)/json-c-$(JSON_C_VERSION)/lib/libjson-c.a" -DBOTAN_INCLUDE_DIR="`pwd`/../../$(BUILD_PATH)/botan-$(BOTAN_VERSION)/include/botan-`echo $(BOTAN_VERSION) | cut -c1-1`" -DBOTAN_LIBRARY="`pwd`/../../$(BUILD_PATH)/botan-$(BOTAN_VERSION)/lib/libbotan-`echo $(BOTAN_VERSION) | cut -c1-1`.a"
cmake --build rnp-$(RNP_VERSION)/build
# copy files
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp
cp -r rnp-$(RNP_VERSION)/include/rnp/* $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp/
cp -r rnp-$(RNP_VERSION)/build/src/lib/rnp/* $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/include/rnp/
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/lib
cp -r rnp-$(RNP_VERSION)/build/src/lib/librnp.dll.a $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/lib/
mkdir -p $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/bin
cp -r rnp-$(RNP_VERSION)/build/src/lib/librnp.dll $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp/bin/
# cleanup
rm -r -f rnp-$(RNP_VERSION)
mv $(BUILD_PATH)/rnp-$(RNP_VERSION).tmp $(BUILD_PATH)/rnp-$(RNP_VERSION)
copylibs:
rm -r -f $(LIBS_PATH) ; \
mkdir -p $(LIBS_PATH) ; \

View file

@ -96,6 +96,7 @@ copy nul "%RsDeployPath%\portable" %Quite%
echo copy binaries
copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare*.exe" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" copy "%RsBuildPath%\libretroshare\src\lib\retroshare.dll" "%RsDeployPath%" %Quite%
if exist "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" copy "%RsBuildPath%\supportlibs\librnp\Build\src\lib\librnp.dll" "%RsDeployPath%" %Quite%
if "%ParamService%"=="1" (
copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite%

View file

@ -16,13 +16,13 @@ if "%~1"=="clean" (
goto exit
)
set MSYS2Version=20231026
set MSYS2Version=20241208
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%
set MSYS2UnpackPath=%EnvMSYS2Path%\msys64
set CMakeInstall=cmake-3.19.0-win32-x86.zip
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
set CMakeInstall=cmake-3.31.3-windows-i386.zip
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.31.3/%CMakeInstall%
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" (

View file

@ -19,9 +19,9 @@ set MinGitInstallPath=%EnvToolsPath%\MinGit
set DoxygenInstall=doxygen-1.9.6.windows.x64.bin.zip
set DoxygenUrl=https://github.com/doxygen/doxygen/releases/download/Release_1_9_6/%DoxygenInstall%
set DoxygenInstallPath=%EnvToolsPath%\doxygen
set CMakeVersion=cmake-3.19.0-win32-x86
set CMakeVersion=cmake-3.31.3-windows-i386
set CMakeInstall=%CMakeVersion%.zip
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.31.3/%CMakeInstall%
set CMakeInstallPath=%EnvToolsPath%\cmake
set TorProjectUrl=https://www.torproject.org
set TorDownloadIndexUrl=%TorProjectUrl%/download/tor

View file

@ -247,6 +247,7 @@ Section $(Section_Main) Section_Main
; External binaries
File "${EXTERNAL_LIB_DIR}\bin\miniupnpc.dll"
File "${RELEASEDIR}\supportlibs\librnp\Build\src\lib\librnp.dll"
!if ${ARCHITECTURE} == "x86"
File "${EXTERNAL_LIB_DIR}\bin\libcrypto-1_1.dll"
File "${EXTERNAL_LIB_DIR}\bin\libssl-1_1.dll"

View file

@ -7,5 +7,5 @@ Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false
Type=Application
Categories=Application;Network;P2P;Feed;Chat;InstantMessaging
Categories=Network;Email;InstantMessaging;Chat;Feed;FileTransfer;P2P
MimeType=x-scheme-handler/retroshare;

@ -1 +1 @@
Subproject commit 402f32eda026c3ec3e429b5fb842e87ebd985d73
Subproject commit ac83e00ea7a26cd6cf57cefef745d6dcfd07e5da

@ -1 +1 @@
Subproject commit b41667912751a453e8e5d4733215a0609277a26f
Subproject commit 178aa8ebcef47e3271d5a5ca5c07e45d3b71c81d

View file

@ -129,6 +129,8 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *n
settingsChanged();
feedTreeItemActivated(NULL);
mFontSizeHandler.registerFontSize(ui->feedTreeWidget);
}
FeedReaderDialog::~FeedReaderDialog()

View file

@ -23,6 +23,7 @@
#include <retroshare-gui/mainpage.h>
#include "interface/rsFeedReader.h"
#include "util/FontSizeHandler.h"
namespace Ui {
class FeedReaderDialog;
@ -98,6 +99,8 @@ private:
RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify;
FontSizeHandler mFontSizeHandler;
/** Qt Designer generated object */
Ui::FeedReaderDialog *ui;
};

View file

@ -57,10 +57,10 @@
<item row="0" column="0">
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">

View file

@ -154,6 +154,8 @@ FeedReaderMessageWidget::FeedReaderMessageWidget(uint32_t feedId, RsFeedReader *
ui->msgTreeWidget->installEventFilter(this);
setFeedId(feedId);
mFontSizeHandler.registerFontSize(ui->msgTreeWidget);
}
FeedReaderMessageWidget::~FeedReaderMessageWidget()

View file

@ -24,6 +24,7 @@
#include <QWidget>
#include "interface/rsFeedReader.h"
#include "util/FontSizeHandler.h"
namespace Ui {
class FeedReaderMessageWidget;
@ -107,6 +108,8 @@ private:
RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify;
FontSizeHandler mFontSizeHandler;
Ui::FeedReaderMessageWidget *ui;
};

View file

@ -8,7 +8,11 @@
#include "pgp/pgpkeyutil.h"
#include "pgp/rscertificate.h"
#ifdef USE_OPENPGPSDK
#include "pgp/openpgpsdkhandler.h"
#else
#include "pgp/rnppgphandler.h"
#endif
#include "friendserver.h"
#include "friend_server/fsitem.h"
@ -393,7 +397,11 @@ FriendServer::FriendServer(const std::string& base_dir,const std::string& listen
std::string pgp_private_keyring_path = RsDirUtil::makePath(base_dir,"pgp_private_keyring") ; // not used.
std::string pgp_trustdb_path = RsDirUtil::makePath(base_dir,"pgp_trustdb") ; // not used.
#ifdef USE_OPENPGPSDK
mPgpHandler = new OpenPGPSDKHandler(pgp_public_keyring_path,pgp_private_keyring_path,pgp_trustdb_path,pgp_lock_path);
#else
mPgpHandler = new RNPPGPHandler(pgp_public_keyring_path,pgp_private_keyring_path,pgp_trustdb_path,pgp_lock_path);
#endif
// Random bias. Should be cryptographically safe.

View file

@ -230,6 +230,8 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height();
ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH));
mFontSizeHandler.registerFontSize(ui.lobbyTreeWidget);
}
ChatLobbyWidget::~ChatLobbyWidget()
@ -420,7 +422,7 @@ static void updateItem(QTreeWidget *treeWidget, QTreeWidgetItem *item, ChatLobby
if(lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)
{
tooltipstr += QObject::tr("\nSecurity: no anonymous IDs") ;
QColor foreground = QColor(0, 128, 0); // green
QColor foreground = QColor(16, 157, 0); // green
for (int column = 0; column < COLUMN_COUNT; ++column)
item->setData(column, Qt::ForegroundRole, foreground);
}

View file

@ -25,6 +25,7 @@
#include "chat/ChatLobbyUserNotify.h"
#include "gui/gxs/GxsIdChooser.h"
#include "util/FontSizeHandler.h"
#include <retroshare/rsmsgs.h>
@ -146,6 +147,8 @@ private:
QAbstractButton* myInviteYesButton;
GxsIdChooser* myInviteIdChooser;
FontSizeHandler mFontSizeHandler;
/* UI - from Designer */
Ui::ChatLobbyWidget ui;
};

View file

@ -73,7 +73,7 @@
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -191,11 +191,6 @@
</item>
<item>
<widget class="RSTreeWidget" name="lobbyTreeWidget">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>16</width>
@ -464,7 +459,7 @@
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>

View file

@ -38,6 +38,7 @@
#include "gui/common/RSTreeWidgetItem.h"
#include "util/QtVersion.h"
#include "util/qtthreadsutils.h"
#include "util/misc.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rsturtle.h>
@ -201,10 +202,6 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder);
QFontMetricsF fontMetrics(ui.searchResultWidget->font());
int iconHeight = fontMetrics.height() * 1.4;
ui.searchResultWidget->setIconSize(QSize(iconHeight, iconHeight));
/* Set initial size the splitter */
QList<int> sizes;
sizes << 250 << width(); // Qt calculates the right sizes
@ -239,6 +236,8 @@ SearchDialog::SearchDialog(QWidget *parent)
RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this );
}, mEventHandlerId, RsEventType::FILE_TRANSFER );
mFontSizeHandler.registerFontSize(ui.searchSummaryWidget);
mFontSizeHandler.registerFontSize(ui.searchResultWidget, 1.4f);
}
SearchDialog::~SearchDialog()
@ -1041,7 +1040,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter );
child->setText(SR_SEARCH_ID_COL, sid_hexa);
setIconAndType(child, QString::fromUtf8(dir.name.c_str()));
@ -1066,7 +1065,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter );
child->setText(SR_SEARCH_ID_COL, sid_hexa);
child->setText(SR_TYPE_COL, tr("Folder"));
@ -1135,7 +1134,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
child->setText(SR_SOURCES_COL, QString::number(1));
child->setData(SR_SOURCES_COL, ROLE_SORT, 1);
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
child->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter );
child->setText(SR_SEARCH_ID_COL, sid_hexa);
child->setText(SR_TYPE_COL, tr("Folder"));
@ -1327,9 +1326,11 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
item->setText(SR_SIZE_COL, QString::number(file.size));
item->setData(SR_SIZE_COL, ROLE_SORT, (qulonglong) file.size);
item->setText(SR_AGE_COL, QString::number(file.mtime));
item->setData(SR_AGE_COL, ROLE_SORT, file.mtime);
item->setText(SR_AGE_COL, QString::number(file.mtime));
item->setData(SR_AGE_COL, ROLE_SORT, file.mtime);
item->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
item->setTextAlignment( SR_AGE_COL, Qt::AlignCenter );
int friendSource = 0;
int anonymousSource = 0;
if(searchType == FRIEND_SEARCH)
@ -1348,7 +1349,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
item->setText(SR_SOURCES_COL,modifiedResult);
item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) );
item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes);
item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight | Qt::AlignVCenter );
item->setText(SR_SEARCH_ID_COL, sid_hexa);
QColor foreground;

View file

@ -25,6 +25,7 @@
#include "retroshare/rsevents.h"
#include "ui_SearchDialog.h"
#include "retroshare-gui/mainpage.h"
#include "util/FontSizeHandler.h"
class AdvancedSearchDialog;
class RSTreeWidgetItemCompareRole;
@ -173,6 +174,8 @@ private:
QAction *collViewAct;
QAction *collOpenAct;
FontSizeHandler mFontSizeHandler;
/** Qt Designer generated object */
Ui::SearchDialog ui;

View file

@ -23,10 +23,10 @@
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
@ -399,8 +399,8 @@ border-image: url(:/images/closepressed.png)
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -102,7 +102,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
@ -132,10 +132,10 @@
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="headerBFrame_GL">
<property name="leftMargin">
@ -401,8 +401,8 @@
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -27,11 +27,13 @@
#include "util/misc.h"
#include "gui/notifyqt.h"
#include "gui/common/FilesDefs.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/connect/ConnectFriendWizard.h"
#include "gui/connect/ConfCertDialog.h"
#include <gui/QuickStartWizard.h>
#include "gui/connect/FriendRecommendDialog.h"
#include "settings/rsharesettings.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QUrlQuery>
@ -135,6 +137,8 @@ HomePage::HomePage(QWidget *parent) :
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
updateOwnCert();
updateHomeLogo();
}
void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
@ -377,3 +381,18 @@ void HomePage::openWebHelp()
{
QDesktopServices::openUrl(QUrl(QString("https://retrosharedocs.readthedocs.io/en/latest/")));
}
void HomePage::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateHomeLogo();
}
}
void HomePage::updateHomeLogo()
{
if (Settings->getSheetName() == ":Standard_Dark")
ui->label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/logo/logo_web_nobackground_black.png"));
else
ui->label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":images/logo/logo_web_nobackground.png"));
}

View file

@ -51,6 +51,8 @@ public:
void getOwnCert(QString& invite,QString& description) const;
RetroshareInviteFlags currentInviteFlags() const ;
virtual void showEvent(QShowEvent *) override;
private slots:
#ifdef DEAD_CODE
void certContextMenu(QPoint);
@ -63,7 +65,8 @@ private slots:
void addFriend();
void webMail();
void openWebHelp() ;
void recommendFriends();
void recommendFriends();
void updateHomeLogo();
private:
Ui::HomePage *ui;

View file

@ -43,7 +43,6 @@
<property name="font">
<font>
<family>Courier New</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -88,7 +87,6 @@
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -107,7 +105,7 @@
<string>...</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
@ -233,11 +231,6 @@
</item>
<item row="1" column="0" colspan="5">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Open Source cross-platform,
private and secure decentralized communication platform.
@ -317,11 +310,6 @@ private and secure decentralized communication platform.
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -405,11 +393,6 @@ private and secure decentralized communication platform.
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Do you need help with Retroshare?</string>
</property>
@ -424,8 +407,8 @@ private and secure decentralized communication platform.
</layout>
</widget>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

File diff suppressed because it is too large Load diff

View file

@ -22,8 +22,10 @@
#define IDENTITYDIALOG_H
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "util/FontSizeHandler.h"
#include <retroshare/rsidentity.h>
#include "retroshare/rsidentity.h"
#include "IdentityListModel.h"
#include <QTimer>
@ -34,7 +36,11 @@ class IdDialog;
}
class UIStateHelper;
class QStyledItemDelegate;
class QTreeWidgetItem;
class RsIdentityListModel;
class IdListSortFilterProxyModel;
class QItemSelection;
class IdDialog : public MainPage
{
@ -58,6 +64,7 @@ protected:
void loadIdentity(RsGxsIdGroup id_data);
void loadCircles(const std::list<RsGroupMetaData>& circle_metas);
void updateIdListRequest();
//void requestCircleGroupData(const RsGxsCircleId& circle_id);
bool getItemCircleId(QTreeWidgetItem *item,RsGxsCircleId& id) ;
@ -66,13 +73,13 @@ protected:
private slots:
void updateIdList();
void updateCircles();
void createExternalCircle();
void updateIdList();
void updateCircles();
void createExternalCircle();
void showEditExistingCircle();
void updateCirclesDisplay();
void toggleAutoBanIdentities(bool b);
void sortColumn(int col,Qt::SortOrder so);
void acceptCircleSubscription() ;
void cancelCircleSubscription() ;
@ -86,17 +93,20 @@ private slots:
void removeIdentity();
void editIdentity();
void chatIdentity();
void chatIdentityItem(QTreeWidgetItem* item);
void sendMsg();
void chatIdentityItem(const QModelIndex &indx);
void chatIdentity(const RsGxsId& toGxsId);
void sendMsg();
void copyRetroshareLink();
void on_closeInfoFrameButton_Invite_clicked();
void updateSelection();
void updateSelection(const QItemSelection &new_sel, const QItemSelection &old_sel);
void modifyReputation();
/** Create the context popup menu and it's submenus */
void IdListCustomPopupMenu( QPoint point );
void headerContextMenuRequested(QPoint);
void toggleColumnVisible();
void CircleListCustomPopupMenu(QPoint point) ;
#ifdef SUSPENDED
@ -117,7 +127,12 @@ private:
void processSettings(bool load);
QString createUsageString(const RsIdentityUsage& u) const;
void requestIdData(std::list<RsGxsGroupId> &ids);
void saveExpandedPathsAndSelection_idTreeView(std::set<QStringList> &expanded, std::set<QStringList> &selected);
void restoreExpandedPathsAndSelection_idTreeView(const std::set<QStringList>& expanded, const std::set<QStringList>& selelected);
void recursSaveExpandedItems_idTreeView(const QModelIndex& index, const QStringList& parent_path, std::set<QStringList>& expanded, std::set<QStringList>& selected);
void recursRestoreExpandedItems_idTreeView(const QModelIndex& index,const QStringList& parent_path,const std::set<QStringList>& expanded,const std::set<QStringList>& selected);
void requestIdData(std::list<RsGxsGroupId> &ids);
bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept);
void insertIdList(uint32_t token);
void filterIds();
@ -134,20 +149,32 @@ private:
private:
UIStateHelper *mStateHelper;
QTreeWidgetItem *contactsItem;
QTreeWidgetItem *allItem;
QTreeWidgetItem *ownItem;
QTreeWidgetItem *mExternalBelongingCircleItem;
QTreeWidgetItem *mExternalOtherCircleItem;
QTreeWidgetItem *mMyCircleItem;
RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ;
void saveExpandedCircleItems(std::vector<bool> &expanded_root_items, std::set<RsGxsCircleId>& expanded_circle_items) const;
int mLastSortColumn;
Qt::SortOrder mLastSortOrder;
void saveExpandedCircleItems(std::vector<bool> &expanded_root_items, std::set<RsGxsCircleId>& expanded_circle_items) const;
void restoreExpandedCircleItems(const std::vector<bool>& expanded_root_items,const std::set<RsGxsCircleId>& expanded_circle_items);
RsGxsGroupId mId;
void applyWhileKeepingTree(std::function<void()> predicate);
RsGxsId getSelectedIdentity() const;
std::list<RsGxsId> getSelectedIdentities() const;
RsGxsGroupId mId;
RsGxsGroupId mIdToNavigate;
int filter;
bool mColumnSizeAlreadySet; // remembers if we already did some size set. If not, automatically stretch to content.
QStyledItemDelegate *mElidedLabelDelegate;
QStyledItemDelegate *mReputationDelegate;
RsIdentityListModel *mIdListModel;
IdListSortFilterProxyModel *mProxyModel;
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId_identity;
@ -157,6 +184,8 @@ private:
bool needUpdateIdsOnNextShow;
bool needUpdateCirclesOnNextShow;
FontSizeHandler mFontSizeHandler;
/* UI - Designer */
Ui::IdDialog *ui;
};

View file

@ -127,7 +127,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<iconset resource="../images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
@ -154,10 +154,10 @@
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="leftMargin">
@ -173,7 +173,11 @@
<number>1</number>
</property>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
<widget class="LineEditClear" name="filterLineEdit">
<property name="placeholderText">
<string>Search...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_New">
@ -211,18 +215,13 @@
</widget>
</item>
<item>
<widget class="RSTreeWidget" name="idTreeWidget">
<widget class="QTreeView" name="idTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -241,39 +240,9 @@
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
<attribute name="headerCascadingSectionResizes">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Persons</string>
</property>
</column>
<column>
<property name="text">
<string>Identity ID</string>
</property>
</column>
<column>
<property name="text">
<string>Owned by</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
<property name="toolTip">
<string>Votes</string>
</property>
<property name="textAlignment">
<set>AlignLeading|AlignVCenter</set>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flag-green.png</normaloff>:/icons/flag-green.png</iconset>
</property>
</column>
</widget>
</item>
</layout>
@ -301,15 +270,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<height>716</height>
<width>535</width>
<height>784</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
<number>3</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_2">
@ -334,10 +303,10 @@
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string extracomment="Click here to change your avatar">Your Avatar</string>
@ -478,6 +447,265 @@
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="ElidedLabel" name="headerTextLabel_Person">
<property name="font">
<font>
<pointsize>22</pointsize>
</font>
</property>
<property name="text">
<string>People</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="detailsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>299</height>
</size>
</property>
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>9</number>
</property>
<item row="9" column="1">
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="toolTip">
<string>Auto-Ban all identities signed by the same node</string>
</property>
<property name="text">
<string>Auto-Ban profile</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="banoption_label">
<property name="text">
<string>Ban-option:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Type">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_KeyId">
<property name="text">
<string>Identity ID :</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_LastUsed">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="Line" name="line_IdInfo">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_GpgId">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_PublishTS">
<property name="text">
<string>Created on :</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="neighborNodesOpinion_LB">
<property name="text">
<string>Friend votes:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_Type">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" rowspan="2">
<widget class="QLabel" name="label_YourOpinion">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1" rowspan="2">
<widget class="RSComboBox" name="ownOpinion_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;You can change the thresholds and the time of inactivity to delete identities in preferences -&amp;gt; people. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Neutral</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
</property>
</item>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_GpgName">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_PublishTS">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="overallOpinion_LB">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Overall:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QFrame" name="info_Frame_Invite">
<property name="sizePolicy">
@ -690,276 +918,6 @@ border-image: url(:/images/closepressed.png)
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="detailsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>299</height>
</size>
</property>
<property name="title">
<string>Identity info</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_LastUsed">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_Nickname">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_GpgName">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="toolTip">
<string>Auto-Ban all identities signed by the same node</string>
</property>
<property name="text">
<string>Auto-Ban profile</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_PublishTS">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0" rowspan="2">
<widget class="QLabel" name="label_YourOpinion">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Type">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="overallOpinion_LB">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Overall:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_PublishTS">
<property name="text">
<string>Created on :</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_GpgId">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="banoption_label">
<property name="text">
<string>Ban-option:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_KeyId">
<property name="text">
<string>Identity ID :</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="Line" name="line_IdInfo">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_Type">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="8" column="1" rowspan="2">
<widget class="RSComboBox" name="ownOpinion_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;You can change the thresholds and the time of inactivity to delete identities in preferences -&amp;gt; people. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Neutral</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
</property>
</item>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="neighborNodesOpinion_LB">
<property name="text">
<string>Friend votes:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="ElidedLabel" name="headerTextLabel_Person">
<property name="font">
<font>
<pointsize>22</pointsize>
</font>
</property>
<property name="text">
<string>People</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -1029,11 +987,6 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -1094,23 +1047,19 @@ border-image: url(:/images/closepressed.png)
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
@ -1121,8 +1070,8 @@ border-image: url(:/images/closepressed.png)
<tabstop>idTreeWidget</tabstop>
</tabstops>
<resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,968 @@
/*******************************************************************************
* retroshare-gui/src/gui/msgs/RsFriendListModel.cpp *
* *
* Copyright 2019 by Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <list>
#include <QApplication>
#include <QDateTime>
#include <QFontMetrics>
#include <QModelIndex>
#include <QTreeView>
#include <QPainter>
#include <QIcon>
#include "gui/common/AvatarDefs.h"
#include "util/qtthreadsutils.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "gui/gxs/GxsIdDetails.h"
#include "retroshare/rsexpr.h"
#include "IdentityListModel.h"
//#define DEBUG_MODEL
//#define DEBUG_MODEL_INDEX
std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
const QString RsIdentityListModel::FilterString("filtered");
const uint32_t MAX_INTERNAL_DATA_UPDATE_DELAY = 300 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
const uint32_t MAX_NODE_UPDATE_DELAY = 10 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
static const uint32_t ID_DETAILS_UPDATE_DELAY = 5; // update each node every 5 secs.
RsIdentityListModel::RsIdentityListModel(QObject *parent)
: QAbstractItemModel(parent)
, mLastInternalDataUpdate(0), mLastNodeUpdate(0)
{
mFontSize = QApplication::font().pointSize();
mFilterStrings.clear();
mIdentityUpdateTimer = new QTimer();
connect(mIdentityUpdateTimer,SIGNAL(timeout()),this,SLOT(timerUpdate()));
}
void RsIdentityListModel::timerUpdate()
{
emit dataChanged(index(0,0,QModelIndex()),index(2,0,QModelIndex()));
}
RsIdentityListModel::EntryIndex::EntryIndex()
: type(ENTRY_TYPE_INVALID),category_index(0),identity_index(0)
{
}
// The index encodes the whole hierarchy of parents. This allows to very efficiently compute indices of the parent of an index.
//
// On 32 bits and 64 bits architectures the format is the following:
//
// 0x [2 bits] 00000 [24 bits] [2 bits]
// | | |
// | | +-------------- type (0=top level, 1=category, 2=identity)
// | +----------------------- identity index
// +-------------------------------------- category index
//
bool RsIdentityListModel::convertIndexToInternalId(const EntryIndex& e,quintptr& id)
{
// the internal id is set to the place in the table of items. We simply shift to allow 0 to mean something special.
if(e.type == ENTRY_TYPE_INVALID)
{
RsErr() << "ERROR: asked for the internal id of an invalid EntryIndex" ;
id = 0;
return true;
}
if(bool(e.identity_index >> 24))
{
RsErr() << "Cannot encode more than 2^24 identities. Somthing's wrong. e.identity_index = " << std::hex << e.identity_index << std::dec ;
id = 0;
return false;
}
id = ((0x3 & (uint32_t)e.category_index) << 30) + ((uint32_t)e.identity_index << 2) + (0x3 & (uint32_t)e.type);
return true;
}
bool RsIdentityListModel::convertInternalIdToIndex(quintptr ref,EntryIndex& e)
{
// Compatible with ref=0 since it will cause type=TOP_LEVEL
e.type = static_cast<RsIdentityListModel::EntryType>((ref >> 0) & 0x3) ;// 2 bits
e.identity_index = (ref >> 2) & 0xffffff;// 24 bits
e.category_index = (ref >> 30) & 0x3 ;// 2 bits
return true;
}
static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
{
int avatarWidth = avatar.width();
int avatarHeight = avatar.height();
QPixmap pixmap(avatar);
int overlaySize = (avatarWidth > avatarHeight) ? (avatarWidth/2.5) : (avatarHeight/2.5);
int overlayX = avatarWidth - overlaySize;
int overlayY = avatarHeight - overlaySize;
QPainter painter(&pixmap);
painter.drawPixmap(overlayX, overlayY, overlaySize, overlaySize, overlay);
QIcon icon;
icon.addPixmap(pixmap);
return icon;
}
void RsIdentityListModel::preMods()
{
emit layoutAboutToBeChanged();
}
void RsIdentityListModel::postMods()
{
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,columnCount()-1,(void*)NULL));
emit layoutChanged();
}
int RsIdentityListModel::rowCount(const QModelIndex& parent) const
{
if(parent.column() >= COLUMN_THREAD_NB_COLUMNS)
return 0;
EntryIndex index;
if(!parent.isValid() || !convertInternalIdToIndex(parent.internalId(),index))
return mCategories.size();
switch(index.type)
{
case ENTRY_TYPE_CATEGORY: return mCategories[index.category_index].child_identity_indices.size();
case ENTRY_TYPE_TOP_LEVEL: return mCategories.size();
default:
return 0;
}
}
int RsIdentityListModel::columnCount(const QModelIndex &/*parent*/) const
{
return COLUMN_THREAD_NB_COLUMNS ;
}
bool RsIdentityListModel::hasChildren(const QModelIndex &parent) const
{
if(!parent.isValid())
return true;
EntryIndex parent_index ;
convertInternalIdToIndex(parent.internalId(),parent_index);
if(parent_index.type == ENTRY_TYPE_TOP_LEVEL)
return true;
if(parent_index.type == ENTRY_TYPE_IDENTITY)
return false;
if(parent_index.type == ENTRY_TYPE_CATEGORY)
return !mCategories[parent_index.category_index].child_identity_indices.empty();
return false;
}
RsIdentityListModel::EntryIndex RsIdentityListModel::EntryIndex::parent() const
{
EntryIndex i(*this);
switch(type)
{
case ENTRY_TYPE_CATEGORY: i.type = ENTRY_TYPE_TOP_LEVEL;
i.category_index = 0;
i.identity_index = 0;
break;
case ENTRY_TYPE_IDENTITY: i.type = ENTRY_TYPE_CATEGORY;
i.identity_index = 0;
break;
case ENTRY_TYPE_TOP_LEVEL:
std::cerr << "ERROR: calling parent() on entryindex with no parent!" << std::endl;
default:
//Can be when request root index.
break;
}
return i;
}
RsIdentityListModel::EntryIndex RsIdentityListModel::EntryIndex::child(int row) const
{
EntryIndex i;
switch(type)
{
case ENTRY_TYPE_TOP_LEVEL:
i.type = ENTRY_TYPE_CATEGORY;
i.category_index = row;
i.identity_index = 0;
break;
case ENTRY_TYPE_CATEGORY: i.type = ENTRY_TYPE_IDENTITY;
i.category_index = category_index;
i.identity_index = row;
break;
case ENTRY_TYPE_IDENTITY: i = EntryIndex();
std::cerr << "ERROR: calling child() on entryindex with no children!" << std::endl;
default:
break;
}
return i;
}
uint32_t RsIdentityListModel::EntryIndex::parentRow() const
{
switch(type)
{
default:
case ENTRY_TYPE_TOP_LEVEL: return -1;
case ENTRY_TYPE_CATEGORY : return -1;
case ENTRY_TYPE_IDENTITY : return category_index;
}
}
QModelIndex RsIdentityListModel::index(int row, int column, const QModelIndex& parent) const
{
if(row < 0 || column < 0 || column >= columnCount(parent) || row >= rowCount(parent))
return QModelIndex();
EntryIndex parent_index ;
convertInternalIdToIndex(parent.internalId(),parent_index);
#ifdef DEBUG_MODEL_INDEX
RsDbg() << "Index row=" << row << " col=" << column << " parent=" << parent << std::endl;
#endif
quintptr ref;
EntryIndex new_index = parent_index.child(row);
convertIndexToInternalId(new_index,ref);
#ifdef DEBUG_MODEL_INDEX
RsDbg() << " returning " << createIndex(row,column,ref) << std::endl;
#endif
return createIndex(row,column,ref);
}
QModelIndex RsIdentityListModel::parent(const QModelIndex& index) const
{
if(!index.isValid())
return QModelIndex();
EntryIndex I ;
convertInternalIdToIndex(index.internalId(),I);
EntryIndex p = I.parent();
if(p.type == ENTRY_TYPE_TOP_LEVEL)
return QModelIndex();
quintptr i;
convertIndexToInternalId(p,i);
return createIndex(I.parentRow(),0,i);
}
Qt::ItemFlags RsIdentityListModel::flags(const QModelIndex& index) const
{
if (!index.isValid())
return Qt::ItemFlags();
return QAbstractItemModel::flags(index);
}
QVariant RsIdentityListModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
{
if(role == Qt::DisplayRole)
switch(section)
{
case COLUMN_THREAD_NAME: return tr("Name");
case COLUMN_THREAD_ID: return tr("Id");
case COLUMN_THREAD_REPUTATION: return QVariant();
case COLUMN_THREAD_OWNER_ID: return tr("Owner Id");
case COLUMN_THREAD_OWNER_NAME: return tr("Owner");
default:
return QVariant();
}
if(role == Qt::DecorationRole && section == COLUMN_THREAD_REPUTATION)
return QIcon(":/icons/flag-green.png");
return QVariant();
}
QVariant RsIdentityListModel::data(const QModelIndex &index, int role) const
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "calling data(" << index << ") role=" << role << std::endl;
#endif
if(!index.isValid())
return QVariant();
quintptr ref = (index.isValid())?index.internalId():0 ;
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "data(" << index << ")" ;
#endif
if(!ref)
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << " [empty]" << std::endl;
#endif
return QVariant() ;
}
EntryIndex entry;
if(!convertInternalIdToIndex(ref,entry))
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "Bad pointer: " << (void*)ref << std::endl;
#endif
return QVariant() ;
}
switch(role)
{
case Qt::SizeHintRole: return sizeHintRole(entry,index.column()) ;
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
case Qt::FontRole: return fontRole(entry,index.column()) ;
case Qt::ForegroundRole: return foregroundRole(entry,index.column()) ;
case Qt::DecorationRole: return decorationRole(entry,index.column()) ;
case FilterRole: return filterRole(entry,index.column()) ;
case SortRole: return sortRole(entry,index.column()) ;
case TreePathRole: return treePathRole(entry,index.column()) ;
default:
return QVariant();
}
}
bool RsIdentityListModel::passesFilter(const EntryIndex& e,int /*column*/) const
{
QString s ;
if(mFilterStrings.empty() || e.type != ENTRY_TYPE_IDENTITY)
return true;
auto passes_strings = [&](const QString& s) -> bool {
bool res = true;
for(auto iter(mFilterStrings.begin()); iter != mFilterStrings.end(); ++iter)
res = res && s.contains(*iter,Qt::CaseInsensitive);
return res;
};
if((mFilterType & FilterType::FILTER_TYPE_ID) && passes_strings(displayRole(e,COLUMN_THREAD_ID ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_NAME) && passes_strings(displayRole(e,COLUMN_THREAD_NAME ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_OWNER_ID) && passes_strings(displayRole(e,COLUMN_THREAD_OWNER_ID ).toString())) return true;
if((mFilterType & FilterType::FILTER_TYPE_OWNER_NAME) && passes_strings(displayRole(e,COLUMN_THREAD_OWNER_NAME).toString())) return true;
return false;
}
QVariant RsIdentityListModel::filterRole(const EntryIndex& e,int column) const
{
if(passesFilter(e,column))
return QVariant(FilterString);
return QVariant(QString());
}
uint32_t RsIdentityListModel::updateFilterStatus(ForumModelIndex /*i*/,int /*column*/,const QStringList& /*strings*/)
{
return 0;
}
void RsIdentityListModel::setFilter(uint8_t filter_type, const QStringList& strings)
{
#ifdef DEBUG_MODEL
std::cerr << "Setting filter to filter_type=" << int(filter_type) << " and strings to " ;
foreach(const QString& str,strings)
std::cerr << "\"" << str.toStdString() << "\" " ;
std::cerr << std::endl;
#endif
preMods();
mFilterType = filter_type;
mFilterStrings = strings;
postMods();
}
QVariant RsIdentityListModel::toolTipRole(const EntryIndex& fmpe,int /*column*/) const
{
switch(fmpe.type)
{
case ENTRY_TYPE_IDENTITY:
{
auto id_info = getIdentityInfo(fmpe);
if(!id_info)
return QVariant();
if(id_info->flags & RS_IDENTITY_FLAGS_IS_DEPRECATED)
return QVariant( tr("\nThis identity has a insecure fingerprint (It's probably quite old).\nYou should get rid of it now and use a new one.\nThese identities are not supported anymore.") ) ;
if(rsIdentity->isOwnId(id_info->id))
return QVariant(tr("This identity is owned by you"));
if(id_info->owner.isNull())
return QVariant("Anonymous identity");
else
{
RsPeerDetails dd;
if(rsPeers->getGPGDetails(id_info->owner,dd))
return QVariant(tr("Identity owned by profile")+" \""+ QString::fromUtf8(dd.name.c_str()) +"\" ("+QString::fromStdString(id_info->owner.toStdString()));
else
return QVariant(tr("Identity possibly owned by unknown profile")+" \""+ QString::fromUtf8(dd.name.c_str()) +"\" ("+QString::fromStdString(id_info->owner.toStdString()));
}
}
break;
case ENTRY_TYPE_CATEGORY: ; // fallthrough
default:
return QVariant();
}
}
QVariant RsIdentityListModel::sizeHintRole(const EntryIndex& e,int col) const
{
float x_factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
float y_factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
if(e.type == ENTRY_TYPE_IDENTITY)
y_factor *= 1.0;
if(e.type == ENTRY_TYPE_CATEGORY)
y_factor *= 1.5;
std::cerr << "sizeHintRole()" << std::endl;
switch(col)
{
default:
case COLUMN_THREAD_REPUTATION: return QVariant( QSize(x_factor * 14 , y_factor*14*1.1f ));
case COLUMN_THREAD_NAME:
case COLUMN_THREAD_ID:
case COLUMN_THREAD_OWNER_NAME:
case COLUMN_THREAD_OWNER_ID: return QFontMetricsF(QApplication::font()).boundingRect(displayRole(e,col).toString()).size();
}
}
QString RsIdentityListModel::indexIdentifier(QModelIndex index)
{
quintptr ref = (index.isValid())?index.internalId():0 ;
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "data(" << index << ")" ;
#endif
if(!ref)
{
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << " [empty]" << std::endl;
#endif
return QString();
}
EntryIndex entry;
if(!convertInternalIdToIndex(ref,entry))
return QString();
return treePathRole(entry,0).toString();
}
QVariant RsIdentityListModel::treePathRole(const EntryIndex& entry,int /*column*/) const
{
if(entry.type == ENTRY_TYPE_CATEGORY)
return QString::number((int)entry.category_index);
else
return QString::fromStdString(mIdentities[mCategories[entry.category_index].child_identity_indices[entry.identity_index]].id.toStdString());
}
QVariant RsIdentityListModel::sortRole(const EntryIndex& entry,int column) const
{
switch(column)
{
case COLUMN_THREAD_REPUTATION: return decorationRole(entry,column);
case COLUMN_THREAD_ID:
case COLUMN_THREAD_OWNER_ID:
case COLUMN_THREAD_OWNER_NAME:
case COLUMN_THREAD_NAME: [[__fallthrough__]];
default:
return displayRole(entry,column);
}
}
QModelIndex RsIdentityListModel::getIndexOfIdentity(const RsGxsId& id) const
{
for(uint i=0;i<mCategories.size();++i)
for(uint j=0;j<mCategories[i].child_identity_indices.size();++j)
if(mIdentities[mCategories[i].child_identity_indices[j]].id == id)
{
EntryIndex e;
e.category_index = i;
e.identity_index = j;
e.type = ENTRY_TYPE_IDENTITY;
quintptr idx;
convertIndexToInternalId(e,idx);
return createIndex(j,0,idx);
}
return QModelIndex();
}
QModelIndex RsIdentityListModel::getIndexOfCategory(Category id) const
{
EntryIndex e;
e.category_index = id;
e.type = ENTRY_TYPE_CATEGORY;
quintptr idx;
convertIndexToInternalId(e,idx);
return createIndex((int)id,0,idx);
}
QVariant RsIdentityListModel::foregroundRole(const EntryIndex& e, int /*col*/) const
{
auto it = getIdentityInfo(e);
if(!it)
return QVariant();
if(it->flags & RS_IDENTITY_FLAGS_IS_DEPRECATED)
return QVariant(QColor(Qt::red));
return QVariant();
}
QVariant RsIdentityListModel::fontRole(const EntryIndex& e, int /*col*/) const
{
QFont f;
f.setPointSize(mFontSize);
auto it = getIdentityInfo(e);
if(it)
{
RsGxsId id(it->id);
if(rsIdentity->isOwnId(id))
f.setBold(true);
}
return QVariant(f);
}
void RsIdentityListModel::setFontSize(int s)
{
if(s != mFontSize)
{
mFontSize = s;
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}
}
#ifdef DEBUG_MODEL_INDEX
std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
#endif
#ifdef TODO
int status = onlineRole(e,col).toInt();
switch (status)
{
case RS_STATUS_INACTIVE:
{
QFont font ;
QTreeView* myParent = dynamic_cast<QTreeView*>(QAbstractItemModel::parent());
if (myParent)
font = myParent->font();
font.setBold(true);
return QVariant(font);
}
default:
return QVariant();
}
#endif
QVariant RsIdentityListModel::displayRole(const EntryIndex& e, int col) const
{
#ifdef DEBUG_MODEL_INDEX
std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": ";
#endif
switch(e.type)
{
case ENTRY_TYPE_CATEGORY:
{
const HierarchicalCategoryInformation *cat = getCategoryInfo(e);
if(!cat)
return QVariant();
switch(col)
{
case COLUMN_THREAD_NAME:
#ifdef DEBUG_MODEL_INDEX
std::cerr << group->group_info.name.c_str() ;
#endif
if(!cat->child_identity_indices.empty())
return QVariant(cat->category_name+" (" + QString::number(cat->child_identity_indices.size()) + ")");
else
return QVariant(cat->category_name);
default:
return QVariant();
}
}
break;
case ENTRY_TYPE_IDENTITY:
{
const HierarchicalIdentityInformation *idinfo = getIdentityInfo(e);
const QString loading_string = "["+tr("Loading...")+"]";
#ifdef DEBUG_MODEL_INDEX
std::cerr << profile->profile_info.name.c_str() ;
#endif
if(col == COLUMN_THREAD_ID) return QVariant(QString::fromStdString(idinfo->id.toStdString()) );
if(col == COLUMN_THREAD_REPUTATION) return QVariant();
if(idinfo->nickname.empty())
return loading_string;
switch(col)
{
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(idinfo->nickname.c_str()));
case COLUMN_THREAD_OWNER_NAME: if(idinfo->owner.isNull())
return QVariant();
else
return QVariant(QString::fromStdString(rsPeers->getGPGName(idinfo->owner)) );
case COLUMN_THREAD_OWNER_ID: if(idinfo->owner.isNull())
return QVariant();
else
return QVariant(QString::fromStdString(idinfo->owner.toStdString()) );
default:
return QVariant();
}
}
break;
default: //ENTRY_TYPE
return QVariant();
}
}
// This function makes sure that the internal data gets updated. They are situations where the notification system cannot
// send the information about changes, such as when the computer is put on sleep.
void RsIdentityListModel::checkInternalData(bool force)
{
rstime_t now = time(NULL);
if( (mLastInternalDataUpdate + MAX_INTERNAL_DATA_UPDATE_DELAY < now) || force)
updateIdentityList();
}
const RsIdentityListModel::HierarchicalCategoryInformation *RsIdentityListModel::getCategoryInfo(const EntryIndex& e) const
{
if(e.category_index >= mCategories.size())
return NULL ;
else
return &mCategories[e.category_index];
}
const RsIdentityListModel::HierarchicalIdentityInformation *RsIdentityListModel::getIdentityInfo(const EntryIndex& e) const
{
// First look into the relevant group, then for the correct profile in this group.
if(e.type != ENTRY_TYPE_IDENTITY)
return nullptr ;
if(e.category_index >= mCategories.size())
return nullptr ;
if(e.identity_index < mCategories[e.category_index].child_identity_indices.size())
{
auto& it(mIdentities[mCategories[e.category_index].child_identity_indices[e.identity_index]]);
rstime_t now = time(nullptr);
if(now > it.last_update_TS + ID_DETAILS_UPDATE_DELAY)
{
RsIdentityDetails det;
if(rsIdentity->getIdDetails(it.id,det))
{
it.nickname = det.mNickname;
it.owner = det.mPgpId;
it.flags = det.mFlags;
it.last_update_TS = now;
}
}
return &it;
}
else
{
RsErr() << "Inconsistent identity index!" ;
return nullptr;
}
}
QVariant RsIdentityListModel::decorationRole(const EntryIndex& entry,int col) const
{
switch(entry.type)
{
case ENTRY_TYPE_CATEGORY:
return QVariant();
case ENTRY_TYPE_IDENTITY:
{
const HierarchicalIdentityInformation *hn = getIdentityInfo(entry);
if(!hn)
return QVariant();
if(col == COLUMN_THREAD_REPUTATION)
return QVariant( static_cast<uint8_t>(rsReputations->overallReputationLevel(hn->id)) );
else if(col == COLUMN_THREAD_NAME)
{
QPixmap sslAvatar;
RsIdentityDetails details ;
if(!rsIdentity->getIdDetails(hn->id, details))
{
mIdentityUpdateTimer->stop();
mIdentityUpdateTimer->setSingleShot(true);
mIdentityUpdateTimer->start(500);
return QVariant();
}
else if(details.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(details.mAvatar.mData, details.mAvatar.mSize, sslAvatar,GxsIdDetails::LARGE))
return QVariant(QIcon(GxsIdDetails::makeDefaultIcon(hn->id,GxsIdDetails::SMALL)));
else
return QVariant(QIcon(sslAvatar));
}
else
return QVariant();
}
break;
default:
return QVariant();
}
}
void RsIdentityListModel::clear()
{
preMods();
mIdentities.clear();
mCategories.clear();
mCategories.resize(3);
mCategories[0].category_name = tr("My own identities");
mCategories[1].category_name = tr("My contacts");
mCategories[2].category_name = tr("All");
postMods();
emit friendListChanged();
}
void RsIdentityListModel::debug_dump() const
{
std::cerr << "==== IdentityListModel Debug dump ====" << std::endl;
std::cerr << "Invalid index : " << QModelIndex() << std::endl;
EntryIndex top_level;
top_level.type = ENTRY_TYPE_TOP_LEVEL;
quintptr id;
convertIndexToInternalId(top_level,id);
std::cerr << "Top level index: " << createIndex(0,0,id) << std::endl;
EntryIndex tei;
convertInternalIdToIndex(0,tei);
std::cerr << "Top level entry index: " << tei << std::endl;
for(uint32_t j=0;j<mCategories.size();++j)
{
std::cerr << mCategories[j].category_name.toStdString() << " (" << mCategories[j].child_identity_indices.size() << ")" << std::endl;
const auto& hg(mCategories[j].child_identity_indices);
for(uint32_t i=0;i<hg.size();++i)
{
auto idx = getIndexOfIdentity(mIdentities[hg[i]].id);
auto parent = idx.parent();
EntryIndex index;
EntryIndex index_parent;
convertInternalIdToIndex(idx.internalId(),index);
convertInternalIdToIndex(parent.internalId(),index_parent);
std::cerr << " " << mIdentities[hg[i]].id << " index = " << idx << " parent = " << idx.parent() << " EntryIndex: " << index << " Parent index: " << index_parent << std::endl;
}
}
std::cerr << "====================================" << std::endl;
}
RsGxsId RsIdentityListModel::getIdentity(const QModelIndex& i) const
{
if(!i.isValid())
return RsGxsId();
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e) || e.type != ENTRY_TYPE_IDENTITY)
return RsGxsId();
const HierarchicalIdentityInformation *gnode = getIdentityInfo(e);
if(gnode)
return gnode->id;
else
return RsGxsId();
}
RsIdentityListModel::EntryType RsIdentityListModel::getType(const QModelIndex& i) const
{
if(!i.isValid())
return ENTRY_TYPE_TOP_LEVEL;
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e))
return ENTRY_TYPE_TOP_LEVEL;
return e.type;
}
int RsIdentityListModel::getCategory(const QModelIndex& i) const
{
if(!i.isValid())
return CATEGORY_ALL;
EntryIndex e;
if(!convertInternalIdToIndex(i.internalId(),e))
return CATEGORY_ALL;
return e.category_index;
}
void RsIdentityListModel::setIdentities(const std::list<RsGroupMetaData>& identities_meta)
{
preMods();
beginResetModel();
clear();
for(auto id:identities_meta)
{
HierarchicalIdentityInformation idinfo;
idinfo.id = RsGxsId(id.mGroupId);
idinfo.last_update_TS = 0;// forces update
if(rsIdentity->isOwnId(idinfo.id))
mCategories[CATEGORY_OWN].child_identity_indices.push_back(mIdentities.size());
else if(rsIdentity->isARegularContact(RsGxsId(id.mGroupId)))
mCategories[CATEGORY_CTS].child_identity_indices.push_back(mIdentities.size());
else
mCategories[CATEGORY_ALL].child_identity_indices.push_back(mIdentities.size());
mIdentities.push_back(idinfo);
}
if (mCategories.size()>0)
{
beginInsertRows(QModelIndex(),0,mCategories.size()-1);
endInsertRows();
}
endResetModel();
postMods();
mLastInternalDataUpdate = time(NULL);
}
void RsIdentityListModel::updateIdentityList()
{
std::cerr << "Updating identity list" << std::endl;
std::list<RsGroupMetaData> ids ;
if(!rsIdentity->getIdentitiesSummaries(ids))
{
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve identity metadata." << std::endl;
return;
}
setIdentities(ids) ;
debug_dump();
}
void RsIdentityListModel::collapseItem(const QModelIndex& index)
{
if(getType(index) != ENTRY_TYPE_CATEGORY)
return;
EntryIndex entry;
if(!convertInternalIdToIndex(index.internalId(),entry))
return;
mExpandedCategories[entry.category_index] = false;
// apparently we cannot be subtle here.
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}
void RsIdentityListModel::expandItem(const QModelIndex& index)
{
if(getType(index) != ENTRY_TYPE_CATEGORY)
return;
EntryIndex entry;
if(!convertInternalIdToIndex(index.internalId(),entry))
return;
mExpandedCategories[entry.category_index] = true;
// apparently we cannot be subtle here.
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}

View file

@ -0,0 +1,252 @@
/*******************************************************************************
* retroshare-gui/src/gui/msgs/RsFriendListModel.h *
* *
* Copyright 2019 by Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#pragma once
#include <QModelIndex>
#include <QColor>
#include "retroshare/rsstatus.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"
typedef uint32_t ForumModelIndex;
// This class is the item model used by Qt to display the information
class QTimer;
class RsIdentityListModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit RsIdentityListModel(QObject *parent = NULL);
~RsIdentityListModel(){}
enum Columns {
COLUMN_THREAD_NAME = 0x00,
COLUMN_THREAD_ID = 0x01,
COLUMN_THREAD_OWNER_NAME = 0x02,
COLUMN_THREAD_OWNER_ID = 0x03,
COLUMN_THREAD_REPUTATION = 0x04,
COLUMN_THREAD_NB_COLUMNS = 0x05
};
enum Roles{ SortRole = Qt::UserRole+1,
StatusRole = Qt::UserRole+2,
UnreadRole = Qt::UserRole+3,
FilterRole = Qt::UserRole+4,
TreePathRole = Qt::UserRole+5,
};
enum FilterType{ FILTER_TYPE_NONE = 0x00,
FILTER_TYPE_ID = 0x01,
FILTER_TYPE_NAME = 0x02,
FILTER_TYPE_OWNER_NAME = 0x04,
FILTER_TYPE_OWNER_ID = 0x08
};
enum EntryType{ ENTRY_TYPE_TOP_LEVEL = 0x00,
ENTRY_TYPE_CATEGORY = 0x01,
ENTRY_TYPE_IDENTITY = 0x02,
ENTRY_TYPE_INVALID = 0x03
};
enum Category{ CATEGORY_OWN = 0x00,
CATEGORY_CTS = 0x01,
CATEGORY_ALL = 0x02
};
struct HierarchicalCategoryInformation
{
QString category_name;
std::vector<uint32_t> child_identity_indices; // index in the array of hierarchical profiles
};
// This stores all the info that is useful avoiding a call to the more expensive getIdDetails()
//
struct HierarchicalIdentityInformation
{
rstime_t last_update_TS;
RsGxsId id;
RsPgpId owner;
uint32_t flags;
std::string nickname;
};
// This structure encodes the position of a node in the hierarchy. The type tells which of the index fields are valid.
struct EntryIndex
{
public:
EntryIndex();
EntryType type; // type of the entry (group,profile,location)
friend std::ostream& operator<<(std::ostream& o, const EntryIndex& e)
{
o << "[" ;
switch(e.type)
{
case RsIdentityListModel::ENTRY_TYPE_INVALID: o << "Invalid," ; break;
case RsIdentityListModel::ENTRY_TYPE_CATEGORY: o << "Category," ; break;
case RsIdentityListModel::ENTRY_TYPE_IDENTITY: o << "Identity," ; break;
case RsIdentityListModel::ENTRY_TYPE_TOP_LEVEL: o << "Toplevel," ; break;
}
o << " CI: " << e.category_index << ", ";
o << " II: " << e.identity_index << "]";
return o;
}
// Indices w.r.t. parent. The set of indices entirely determines the position of the entry in the hierarchy.
// An index of 0xff means "undefined"
uint16_t category_index; // index of the category in the mCategory array
uint16_t identity_index; // index of the identity in its own category
EntryIndex parent() const;
EntryIndex child(int row) const;
uint32_t parentRow() const;
};
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
QModelIndex getIndexOfIdentity(const RsGxsId& id) const;
QModelIndex getIndexOfCategory(Category id) const;
void updateIdentityList();
int count() const { return mIdentities.size() ; } // total number of identities
static const QString FilterString ;
// This method will asynchroneously update the data
EntryType getType(const QModelIndex&) const;
RsGxsId getIdentity(const QModelIndex&) const;
int getCategory(const QModelIndex&) const;
void setFontSize(int s);
void setFilter(uint8_t filter_type, const QStringList& strings) ;
void expandItem(const QModelIndex&) ;
void collapseItem(const QModelIndex&) ;
// Overloaded methods from QAbstractItemModel
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void clear() ;
QString indexIdentifier(QModelIndex i);
/* Color definitions (for standard see default.qss) */
QColor mTextColorGroup;
QColor mTextColorStatus[RS_STATUS_COUNT];
void setIdentities(const std::list<RsGroupMetaData>& identities_meta);
private:
const HierarchicalCategoryInformation *getCategoryInfo (const EntryIndex&) const;
const HierarchicalIdentityInformation *getIdentityInfo(const EntryIndex&) const;
void checkIdentity(HierarchicalIdentityInformation& node);
QVariant sizeHintRole (const EntryIndex& e, int col) const;
QVariant displayRole (const EntryIndex& e, int col) const;
QVariant decorationRole(const EntryIndex& e, int col) const;
QVariant toolTipRole (const EntryIndex& e, int col) const;
QVariant statusRole (const EntryIndex& e, int col) const;
QVariant sortRole (const EntryIndex& e, int col) const;
QVariant fontRole (const EntryIndex& e, int col) const;
QVariant foregroundRole(const EntryIndex& e, int col) const;
QVariant textColorRole (const EntryIndex& e, int col) const;
QVariant filterRole (const EntryIndex& e, int col) const;
QVariant treePathRole (const EntryIndex& entry,int column) const;
/*!
* \brief debug_dump
* Dumps the hierarchy of posts in the terminal, to allow checking whether the internal representation is correct.
*/
public slots:
void checkInternalData(bool force);
void debug_dump() const;
void timerUpdate();
signals:
void dataLoaded(); // emitted after the messages have been set. Can be used to updated the UI.
void friendListChanged(); // emitted after the messages have been set. Can be used to updated the UI.
void dataAboutToLoad();
private:
bool passesFilter(const EntryIndex &e, int column) const;
void preMods() ;
void postMods() ;
void *getParentRef(void *ref,int& row) const;
void *getChildRef(void *ref,int row) const;
int getChildrenCount(void *ref) const;
static bool convertIndexToInternalId(const EntryIndex& e,quintptr& ref);
static bool convertInternalIdToIndex(quintptr ref, EntryIndex& e);
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
QStringList mFilterStrings;
uint8_t mFilterType;
int mFontSize;
rstime_t mLastInternalDataUpdate;
rstime_t mLastNodeUpdate;;
// The 3 vectors below store thehierarchical information for groups, profiles and locations,
// meaning which is the child/parent of which. The actual group/profile/node data are also stored in the
// structure.
mutable std::vector<HierarchicalCategoryInformation> mCategories;
mutable std::vector<HierarchicalIdentityInformation> mIdentities;
// The top level list contains all nodes to display, which type depends on the option to display groups or not.
// Idices in the list may be profile indices or group indices. In the former case the profile child index refers to
// the inde in the mProfiles tab, whereas in the the later case, the child index refers to the index of the profile in the
// group it belows to.
std::vector<EntryIndex> mTopLevel;
// keeps track of expanded/collapsed items, so as to only show icon for collapsed profiles
std::vector<bool> mExpandedCategories;
// List of identities for which getIdDetails() failed, to be requested again.
mutable QTimer *mIdentityUpdateTimer;
};

View file

@ -360,6 +360,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged();
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);
}
/** Destructor. */
@ -564,6 +566,11 @@ void MainWindow::addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()) ;
ui->listWidget->addItem(item) ;
#if defined(Q_OS_DARWIN)
QFont f = ui->toolBarPage->font();
action->setFont(f);
#endif
if (notify)
{
QPair<QAction*, QListWidgetItem*> pair = QPair<QAction*, QListWidgetItem*>( action, item);
@ -1022,6 +1029,7 @@ void SetForegroundWindowInternal(HWND hWnd)
/* Show the dialog. */
raiseWindow();
/* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(page);
}

View file

@ -27,6 +27,7 @@
#include "gui/common/rwindow.h"
#include "gui/common/RSComboBox.h"
#include "util/FontSizeHandler.h"
namespace Ui {
class MainWindow;
@ -371,6 +372,8 @@ private:
void setIdle(bool Idle);
bool isIdle;
FontSizeHandler mFontSizeHandler;
Ui::MainWindow *ui ;
};

View file

@ -33,11 +33,6 @@
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@ -157,7 +152,7 @@
</action>
<action name="actionOptions">
<property name="icon">
<iconset resource="images.qrc">
<iconset>
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
</property>
<property name="text">

View file

@ -70,8 +70,8 @@
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>

View file

@ -22,7 +22,6 @@
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
@ -103,7 +102,6 @@
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
@ -114,7 +112,7 @@
</widget>
</item>
<item>
<widget class="AvatarWidget" name="avatarWidget" native="true">
<widget class="AvatarWidget" name="avatarWidget">
<property name="minimumSize">
<size>
<width>24</width>
@ -134,7 +132,6 @@
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
@ -150,7 +147,6 @@
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
@ -163,7 +159,6 @@
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
@ -209,17 +204,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AvatarWidget</class>
<extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>AvatarWidget</class>
<extends>QWidget</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AspectRatioPixmapLabel</class>
<extends>QLabel</extends>

View file

@ -44,10 +44,10 @@
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<property name="leftMargin">
@ -262,7 +262,6 @@
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>

View file

@ -54,7 +54,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;
&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; }
&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:'.AppleSystemUIFont'; font-size:13pt; 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>
</property>
<property name="textInteractionFlags">
@ -355,10 +355,10 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
@ -576,37 +576,10 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeView</class>
@ -614,15 +587,42 @@ p, li { white-space: pre-wrap; }
<header>gui/common/RSTreeView.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>SubscribeToolButton</class>
<extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="Posted_images.qrc"/>
<include location="../icons.qrc"/>
<include location="Posted_images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -88,11 +88,16 @@ class RSHumanReadableAgeDelegate: public RSHumanReadableDelegate
public:
virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const
{
painter->save();
QStyleOptionViewItem opt(option) ;
setPainterOptions(painter,opt,index) ;
if(index.data().toLongLong() > 0) // no date is present.
painter->drawText(opt.rect, Qt::AlignCenter, misc::timeRelativeToNow(index.data().toLongLong())) ;
if(index.data().toLongLong() > 0) { // no date is present.
painter->setFont(opt.font);
painter->drawText(opt.rect, opt.displayAlignment, misc::timeRelativeToNow(index.data().toLongLong())) ;
}
painter->restore();
}
};
@ -101,10 +106,14 @@ class RSHumanReadableSizeDelegate: public RSHumanReadableDelegate
public:
virtual void paint(QPainter *painter,const QStyleOptionViewItem & option, const QModelIndex & index) const
{
painter->save();
QStyleOptionViewItem opt(option) ;
setPainterOptions(painter,opt,index) ;
painter->drawText(opt.rect, Qt::AlignRight, misc::friendlyUnit(index.data().toULongLong()));
painter->setFont(opt.font);
painter->drawText(opt.rect, opt.displayAlignment, misc::friendlyUnit(index.data().toULongLong()));
painter->restore();
}
};

View file

@ -1920,7 +1920,9 @@ static void processList(const QStringList &list, const QString &textSingular, co
void RSLinkClipboard::copyLinks(const QList<RetroShareLink>& links)
{
QString res ;
for (int i = 0; i < links.size(); ++i)
if(links.size() == 1)
res += links[0].toString();
else for(int i = 0; i < links.size(); ++i)
res += links[i].toString() + "\n" ;
QApplication::clipboard()->setText(res) ;
@ -2036,4 +2038,3 @@ void RSLinkClipboard::parseText(QString text, QList<RetroShareLink> &links,Retro
pos += rx.matchedLength();
}
}

View file

@ -161,7 +161,7 @@ void StartDialog::notSecureWarning()
QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your Keychain. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#else
// this handles all linux systems at once.
QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your Gnome Keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
QMessageBox::warning ( this, tr("Warning"), tr("The password to your SSL certificate (your node) will be stored encrypted in your desktop's keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#endif
#endif
}

View file

@ -345,8 +345,8 @@ The current identities/locations will not be affected.</string>
<string>&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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'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;a href=&quot;Create new Profile...&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;New Profile/Node&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:13pt; 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;a href=&quot;Create new Profile...&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:14pt; text-decoration: underline; color:#366fe0;&quot;&gt;New Profile/Node&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -370,8 +370,8 @@ p, li { white-space: pre-wrap; }
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -208,6 +208,8 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(unsubscribeButton, SIGNAL(clicked()), this , SLOT(leaveLobby()));
getChatWidget()->addTitleBarWidget(unsubscribeButton) ;
mFontSizeHandler.registerFontSize(ui.participantsList);
}
void ChatLobbyDialog::leaveLobby()

View file

@ -26,6 +26,7 @@
#include "gui/common/RSTreeWidgetItem.h"
#include "ChatDialog.h"
#include "PopupChatWindow.h"
#include "util/FontSizeHandler.h"
// Q_DECLARE_METATYPE(RsGxsId)
// Q_DECLARE_METATYPE(QList<RsGxsId>)
@ -115,6 +116,8 @@ private:
bool mWindowedSetted;
PopupChatWindow* mPCWindow;
FontSizeHandler mFontSizeHandler;
/** Qt Designer generated object */
Ui::ChatLobbyDialog ui;

View file

@ -80,10 +80,10 @@
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrame_HL">
<property name="leftMargin">

View file

@ -162,12 +162,14 @@ static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
void RsFriendListModel::setDisplayStatusString(bool b)
{
preMods();
mDisplayStatusString = b;
postMods();
}
void RsFriendListModel::setDisplayStatusIcon(bool b)
{
preMods();
mDisplayStatusIcon = b;
postMods();
}
@ -302,10 +304,10 @@ uint32_t RsFriendListModel::EntryIndex::parentRow(uint32_t nb_groups) const
switch(type)
{
default:
case ENTRY_TYPE_UNKNOWN : return 0;
case ENTRY_TYPE_GROUP : return group_index;
case ENTRY_TYPE_PROFILE : return (group_index==UNDEFINED_GROUP_INDEX_VALUE)?(profile_index+nb_groups):profile_index;
case ENTRY_TYPE_NODE : return node_index;
case ENTRY_TYPE_UNKNOWN : return -1;
case ENTRY_TYPE_GROUP : return -1;
case ENTRY_TYPE_PROFILE : return (group_index==UNDEFINED_GROUP_INDEX_VALUE)?(-1):group_index;
case ENTRY_TYPE_NODE : return (group_index==UNDEFINED_GROUP_INDEX_VALUE)?(profile_index+nb_groups):profile_index;
}
}

View file

@ -135,6 +135,8 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
mEventHandlerId_peers = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }) ;}, mEventHandlerId_peers, RsEventType::PEER_CONNECTION );
mFontSizeHandler.registerFontSize(ui->friendList);
}
void FriendSelectionWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)

View file

@ -26,6 +26,7 @@
#include "retroshare/rsevents.h"
#include <gui/gxs/RsGxsUpdateBroadcastPage.h>
#include "util/FontSizeHandler.h"
namespace Ui {
class FriendSelectionWidget;
@ -178,6 +179,8 @@ private:
std::set<std::string> mPreSelectedIds; // because loading of GxsIds is asynchroneous we keep selected Ids from the client in a list here and use it to initialize after loading them.
FontSizeHandler mFontSizeHandler;
RsEventsHandlerId_t mEventHandlerId_identities;
RsEventsHandlerId_t mEventHandlerId_peers;
};

View file

@ -38,11 +38,6 @@
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -71,7 +66,7 @@
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>

View file

@ -148,7 +148,19 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
connect(ui->distantSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(distantSearch())) ;
ui->treeWidget->setIconSize(QSize(H*1.8,H*1.8));
mFontSizeHandler.registerFontSize(ui->treeWidget, 1.8f, [this] (QAbstractItemView*, int fontSize) {
// Set new font size on all items
QTreeWidgetItemIterator it(ui->treeWidget);
while (*it) {
QTreeWidgetItem *item = *it;
QFont font = item->font(GTW_COLUMN_NAME);
font.setPointSize(fontSize);
item->setFont(GTW_COLUMN_NAME, font);
++it;
}
});
}
GroupTreeWidget::~GroupTreeWidget()
@ -254,8 +266,8 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
RSTreeWidgetItem *item = new RSTreeWidgetItem();
ui->treeWidget->addTopLevelItem(item);
// To get StyleSheet for Items
ui->treeWidget->style()->unpolish(ui->treeWidget);
ui->treeWidget->style()->polish(ui->treeWidget);
// ui->treeWidget->style()->unpolish(ui->treeWidget);
// ui->treeWidget->style()->polish(ui->treeWidget);
item->setText(GTW_COLUMN_NAME, name);
item->setData(GTW_COLUMN_DATA, ROLE_NAME, name);
@ -390,7 +402,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
if (item == NULL) {
item = new RSTreeWidgetItem(compareRole);
item->setData(GTW_COLUMN_DATA, ROLE_ID, itemInfo.id);
item->setFont(GTW_COLUMN_DATA, ui->treeWidget->font());
item->setFont(GTW_COLUMN_NAME, ui->treeWidget->font());
//static_cast<RSTreeWidgetItem*>(item)->setNoDataAsLast(true); //Uncomment this to sort data with QVariant() always at end.
categoryItem->addChild(item);
}

View file

@ -25,6 +25,7 @@
#include <QTreeWidgetItem>
#include <QDateTime>
#include "util/FontSizeHandler.h"
class QToolButton;
class RshareSettings;
@ -163,6 +164,7 @@ private:
// Compare role used for each column
RSTreeWidgetItemCompareRole *compareRole;
FontSizeHandler mFontSizeHandler;
Ui::GroupTreeWidget *ui;
};

View file

@ -35,10 +35,10 @@
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
@ -70,11 +70,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>

View file

@ -273,6 +273,8 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)),Qt::QueuedConnection);
connect(h, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(headerContextMenuRequested(QPoint)));
mFontSizeHandler.registerFontSize(ui->peerTreeWidget,1.5f);
// #ifdef RS_DIRECT_CHAT
// connect(ui->peerTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(chatNode()));
// #endif

View file

@ -29,6 +29,7 @@
#include "FriendListModel.h"
#include "retroshare/rsstatus.h"
#include "util/FontSizeHandler.h"
namespace Ui {
class NewFriendList;
@ -104,6 +105,7 @@ private:
Ui::NewFriendList *ui;
RsFriendListModel *mModel;
QAction *mActionSortByState;
FontSizeHandler mFontSizeHandler;
void applyWhileKeepingTree(std::function<void()> predicate);

View file

@ -29,10 +29,10 @@
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrame_HL">
<property name="spacing">
@ -58,11 +58,6 @@
</item>
<item>
<widget class="QTreeView" name="peerTreeWidget">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>755</width>
<height>157</height>
<width>836</width>
<height>160</height>
</rect>
</property>
<layout class="QGridLayout" name="ChannelsCommentsItem_GL">
@ -35,10 +35,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<property name="topMargin">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>618</width>
<height>176</height>
<height>189</height>
</rect>
</property>
<property name="font">
@ -134,10 +134,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<item row="0" column="0">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1092</width>
<height>231</height>
<height>255</height>
</rect>
</property>
<layout class="QGridLayout" name="GxsChannelPostItem_GL">
@ -41,10 +41,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="feedFrame_VL">
<item>

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>618</width>
<height>108</height>
<height>128</height>
</rect>
</property>
<layout class="QGridLayout" name="GxsCircleItem_GL">
@ -126,10 +126,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="feedFrame_HL">
<item>
@ -317,7 +317,7 @@
<string>Revoke</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property>
</widget>

View file

@ -126,10 +126,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="feedFrame_VL">
<item>

View file

@ -99,10 +99,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<item row="0" column="0" rowspan="2">

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>180</height>
<width>777</width>
<height>234</height>
</rect>
</property>
<layout class="QGridLayout" name="MsgItem_GL">
@ -35,10 +35,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<item row="0" column="0">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>476</width>
<height>283</height>
<height>328</height>
</rect>
</property>
<property name="autoFillBackground">
@ -38,10 +38,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_gL">
<property name="verticalSpacing">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>618</width>
<height>161</height>
<height>195</height>
</rect>
</property>
<layout class="QGridLayout" name="PostedGroupItem_GL">
@ -126,10 +126,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<item row="0" column="0">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>763</width>
<height>185</height>
<height>205</height>
</rect>
</property>
<layout class="QGridLayout" name="SecurityIpItem_GL">
@ -38,10 +38,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<property name="verticalSpacing">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1015</width>
<height>246</height>
<height>326</height>
</rect>
</property>
<layout class="QGridLayout" name="SecurityItem_GL">
@ -35,10 +35,10 @@
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="feedFrame_GL">
<property name="verticalSpacing">

View file

@ -29,10 +29,10 @@
<item row="0" column="0">
<widget class="QFrame" name="gradFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gradFrame_GL">
<item row="1" column="0">

View file

@ -85,23 +85,27 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
{
Q_ASSERT(index.isValid());
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt(option);
initStyleOption(&opt, index);
// disable default icon
opt.icon = QIcon();
// draw default item
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter, 0);
const QRect r = option.rect;
const QRect r = option.rect;
// get pixmap
unsigned int icon_index = qvariant_cast<unsigned int>(index.data(Qt::DecorationRole));
auto v = index.data(Qt::DecorationRole);
if(!v.canConvert(QVariant::Int))
return;
unsigned int icon_index = qvariant_cast<unsigned int>(v);
if(icon_index > mMaxLevelToDisplay)
return ;
QIcon icon = GxsIdDetails::getReputationIcon(
RsReputationLevel(icon_index), 0xff );
QIcon icon = GxsIdDetails::getReputationIcon( RsReputationLevel(icon_index), 0xff );
QPixmap pix = icon.pixmap(r.size());
@ -110,6 +114,12 @@ void ReputationItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
painter->drawPixmap(r.topLeft() + p, pix);
}
QSize ReputationItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex & /*index*/) const
{
int s = 1.5*QFontMetricsF(option.font).height();
return QSize(s,s);
}
/* The global object */
GxsIdDetails *GxsIdDetails::mInstance = NULL ;

View file

@ -52,7 +52,8 @@ public:
ReputationItemDelegate(RsReputationLevel max_level_to_display) :
mMaxLevelToDisplay(static_cast<uint32_t>(max_level_to_display)) {}
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex & /*index*/) const override;
private:
uint32_t mMaxLevelToDisplay ;

View file

@ -191,8 +191,8 @@
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;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:10pt; font-weight:600;&quot;&gt;Attachments:&lt;/span&gt;&lt;/p&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;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Use Drag and Drop / Add Files button, to Hash new files.&lt;/span&gt;&lt;/p&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;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Copy/Paste RetroShare links from your shares&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;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:''; font-size:;&quot;&gt; Use Drag and Drop / Add Files button, to Hash new files.&lt;/span&gt;&lt;/p&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;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:''; font-size:;&quot;&gt; Copy/Paste RetroShare links from your shares&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -515,8 +515,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>63</width>
<height>24</height>
<width>98</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -611,6 +611,11 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>ChannelPostThumbnailView</class>
<extends>QWidget</extends>
@ -629,15 +634,10 @@ p, li { white-space: pre-wrap; }
<header>util/RichTextEdit.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -29,10 +29,10 @@
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
@ -402,7 +402,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;
&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; }
&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:'.AppleSystemUIFont'; font-size:13pt; 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>
</property>
<property name="textInteractionFlags">

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>640</width>
<height>465</height>
<height>551</height>
</rect>
</property>
<property name="windowTitle">
@ -34,7 +34,14 @@
<number>0</number>
</property>
<item>
<widget class="HeaderFrame" name="headerFrame"/>
<widget class="HeaderFrame" name="headerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="gradFrame">
@ -132,17 +139,12 @@
</item>
<item row="3" column="0">
<widget class="MimeTextEdit" name="forumMessage">
<property name="font">
<font>
<family>MS Sans Serif</family>
</font>
</property>
<property name="html">
<string>&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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8.25pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:''; font-size:; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -155,10 +157,10 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrame_HL">
<property name="spacing">
@ -382,6 +384,11 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
@ -399,15 +406,10 @@ p, li { white-space: pre-wrap; }
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -46,6 +46,7 @@ RsGxsForumModel::RsGxsForumModel(QObject *parent)
: QAbstractItemModel(parent), mUseChildTS(false),mFilteringEnabled(false),mTreeMode(TREE_MODE_TREE)
{
initEmptyHierarchy(mPosts);
mFont = QApplication::font();
}
void RsGxsForumModel::preMods()
@ -399,7 +400,7 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const
if(role == Qt::FontRole)
{
QFont font ;
QFont font = mFont;
font.setBold( (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_HAS_UNREAD_CHILDREN) || IS_MSG_UNREAD(fmpe.mMsgStatus));
return QVariant(font);
}
@ -533,6 +534,15 @@ void RsGxsForumModel::setFilter(int column,const QStringList& strings,uint32_t&
postMods();
}
void RsGxsForumModel::setFont(const QFont &font)
{
preMods();
mFont = font;
postMods();
}
QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int /*column*/) const
{
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING)
@ -562,7 +572,7 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column
if(!GxsIdDetails::MakeIdDesc(fmpe.mAuthorId, true, str, icons, comment,GxsIdDetails::ICON_TYPE_AVATAR))
return QVariant();
int S = QFontMetricsF(QApplication::font()).height();
int S = QFontMetricsF(mFont).height();
QImage pix( (*icons.begin()).pixmap(QSize(5*S,5*S)).toImage());
QString embeddedImage;
@ -599,7 +609,7 @@ QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int /*c
QVariant RsGxsForumModel::sizeHintRole(int col) const
{
float factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
float factor = QFontMetricsF(mFont).height()/14.0f ;
switch(col)
{
@ -650,7 +660,7 @@ QVariant RsGxsForumModel::displayRole(const ForumModelPostEntry& fmpe,int col) c
case COLUMN_THREAD_TITLE: if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_REDACTED)
return QVariant(tr("[ ... Redacted message ... ]"));
// else if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
// return QVariant( QString("<img src=\":/icons/pinned_64.png\" height=%1/>").arg(QFontMetricsF(QFont()).height())
// return QVariant( QString("<img src=\":/icons/pinned_64.png\" height=%1/>").arg(QFontMetricsF(mFont).height())
// + QString::fromUtf8(fmpe.mTitle.c_str()));
else
return QVariant(QString::fromUtf8(fmpe.mTitle.c_str()));

View file

@ -22,6 +22,7 @@
#include "retroshare/rsgxsifacetypes.h"
#include <QModelIndex>
#include <QColor>
#include <QFont>
struct ForumModelPostEntry: public ForumPostEntry
{
@ -76,6 +77,7 @@ public:
QModelIndex getIndexOfMessage(const RsGxsMessageId& mid) const;
static const QString FilterString ;
void setFont(const QFont &font);
std::vector<std::pair<rstime_t,RsGxsMessageId> > getPostVersions(const RsGxsMessageId& mid) const;
@ -185,6 +187,7 @@ private:
QColor mBackgroundColorPinned;
QColor mBackgroundColorFiltered;
QFont mFont;
friend class const_iterator;
};

View file

@ -321,10 +321,6 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
float f = QFontMetricsF(font()).height()/14.0f ;
QFontMetricsF fontMetrics(ui->threadTreeWidget->font());
int iconHeight = fontMetrics.height() * 1.4;
ui->threadTreeWidget->setIconSize(QSize(iconHeight, iconHeight));
/* Set header resize modes and initial section sizes */
QHeaderView * ttheader = ui->threadTreeWidget->header () ;
@ -380,6 +376,10 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
[this](std::shared_ptr<const RsEvent> event)
{ RsQThreadUtils::postToObject([=](){ handleEvent_main_thread(event); }, this ); },
mEventHandlerId, RsEventType::GXS_FORUMS );
mFontSizeHandler.registerFontSize(ui->threadTreeWidget, 1.4f, [this](QAbstractItemView *view, int) {
mThreadModel->setFont(view->font());
});
}
void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)

View file

@ -26,6 +26,7 @@
#include "gui/gxs/GxsMessageFrameWidget.h"
#include <retroshare/rsgxsforums.h>
#include "gui/gxs/GxsIdDetails.h"
#include "util/FontSizeHandler.h"
class QSortFilterProxyModel;
class QTreeWidgetItem;
@ -234,6 +235,8 @@ private:
QSortFilterProxyModel *mThreadProxyModel;
QList<RsGxsMessageId> mSavedExpandedMessages;
FontSizeHandler mFontSizeHandler;
Ui::GxsForumThreadWidget *ui;
RsEventsHandlerId_t mEventHandlerId;
};

View file

@ -48,10 +48,10 @@
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="leftMargin">
@ -578,10 +578,9 @@
</widget>
<customwidgets>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
@ -589,9 +588,15 @@
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>SubscribeToolButton</class>
<extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
@ -609,11 +614,6 @@
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>SubscribeToolButton</class>
<extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>

View file

@ -208,6 +208,7 @@
<file>images/logo/logo_info.png</file>
<file>images/logo/logo_splash.png</file>
<file>images/logo/logo_web_nobackground.png</file>
<file>images/logo/logo_web_nobackground_black.png</file>
<file>images/mail-signed.png</file>
<file>images/mail-signature-unknown.png</file>
<file>images/mailforward24-hover.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -299,7 +299,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
QFontDatabase db;
foreach(int size, db.standardSizes())
ui.comboSize->addItem(QString::number(size));
ui.comboSize->addItem(QString::number(size), size);
QStyleOptionComboBox opt; QSize sh;
opt.initFrom(ui.comboSize);
@ -408,6 +408,10 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(true);
mMessageFontSizeHandler.registerFontSize(ui.msgText, [this, db] (QWidget*, int fontSize) {
ui.comboSize->setCurrentIndex(ui.comboSize->findData(fontSize));
});
#if QT_VERSION < 0x040700
// embedded images are not supported before QT 4.7.0
ui.imagebtn->setVisible(false);

View file

@ -28,6 +28,7 @@
#include "ui_MessageComposer.h"
#include "gui/msgs/MessageInterface.h"
#include "util/FontSizeHandler.h"
class QAction;
struct RsIdentityDetails;
@ -267,6 +268,8 @@ private:
bool has_gxs;
bool mAlreadySent; // prevents a Qt bug that calls the same action twice.
MessageFontSizeHandler mMessageFontSizeHandler;
/** Qt Designer generated object */
Ui::MessageComposer ui;

View file

@ -349,10 +349,10 @@
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="leftMargin">
@ -1400,6 +1400,11 @@ border-image: url(:/images/closepressed.png)
</action>
</widget>
<customwidgets>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
@ -1411,21 +1416,16 @@ border-image: url(:/images/closepressed.png)
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>RSComboBox</class>
<extends>QComboBox</extends>
<header>gui/common/RSComboBox.h</header>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>

View file

@ -57,6 +57,7 @@ RsMessageModel::RsMessageModel(QObject *parent)
mQuickViewFilter = QUICK_VIEW_ALL;
mFilterType = FILTER_TYPE_NONE;
mFilterStrings.clear();
mFont = QApplication::font();
}
void RsMessageModel::preMods()
@ -209,6 +210,8 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
std::cerr << "calling data(" << index << ") role=" << role << std::endl;
#endif
int coln = index.column();
if(!index.isValid())
return QVariant();
@ -246,11 +249,19 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
if(role == Qt::FontRole)
{
QFont font ;
QFont font = mFont;
font.setBold(fmpe.msgflags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER));
return QVariant(font);
}
if (role == Qt::TextAlignmentRole)
{
if((coln == COLUMN_THREAD_ATTACHMENT))
return int( Qt::AlignHCenter | Qt::AlignVCenter);
else
return QVariant();
}
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << " [ok]" << std::endl;
@ -394,6 +405,15 @@ void RsMessageModel::setFilter(FilterType filter_type, const QStringList& string
emit dataChanged(createIndex(0,0),createIndex(rowCount()-1,RsMessageModel::columnCount()-1));
}
void RsMessageModel::setFont(const QFont &font)
{
mFont = font;
if (rowCount() > 0) {
emit dataChanged(createIndex(0,0), createIndex(rowCount() - 1, RsMessageModel::columnCount() - 1));
}
}
QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
{
if(column == COLUMN_THREAD_AUTHOR || column == COLUMN_THREAD_TO)
@ -430,7 +450,7 @@ QVariant RsMessageModel::backgroundRole(const Rs::Msgs::MsgInfoSummary &/*fmpe*/
QVariant RsMessageModel::sizeHintRole(int col) const
{
float factor = QFontMetricsF(QApplication::font()).height()/14.0f ;
float factor = QFontMetricsF(mFont).height()/14.0f ;
switch(col)
{

View file

@ -22,6 +22,7 @@
#include <QModelIndex>
#include <QColor>
#include <QFont>
#include "retroshare/rsmsgs.h"
@ -104,6 +105,7 @@ public:
void setQuickViewFilter(QuickViewFilter fn) ;
void setFilter(FilterType filter_type, const QStringList& strings) ;
void setFont(const QFont &font);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
@ -184,6 +186,7 @@ private:
QuickViewFilter mQuickViewFilter ;
QStringList mFilterStrings;
FilterType mFilterType;
QFont mFont;
std::vector<Rs::Msgs::MsgInfoSummary> mMessages;
std::map<std::string,uint32_t> mMessagesMap;

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>698</width>
<width>738</width>
<height>539</height>
</rect>
</property>
@ -59,11 +59,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
@ -211,11 +206,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Tags:</string>
</property>
@ -232,11 +222,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Subject:</string>
</property>
@ -253,11 +238,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Cc:</string>
</property>
@ -277,11 +257,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Bcc:</string>
</property>
@ -298,11 +273,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>To:</string>
</property>
@ -321,7 +291,6 @@
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -373,11 +342,6 @@
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
@ -416,11 +380,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>From:</string>
</property>
@ -860,8 +819,8 @@
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>

View file

@ -306,6 +306,23 @@ MessagesDialog::MessagesDialog(QWidget *parent)
mTagEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [this,event]() { handleTagEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_TAG );
mFontSizeHandler.registerFontSize(ui.listWidget, 1.5f, [this] (QAbstractItemView*, int fontSize) {
// Set new font size on all items
QList<int> rows;
rows << ROW_INBOX << ROW_OUTBOX << ROW_DRAFTBOX;
foreach (int row, rows) {
QListWidgetItem *item = ui.listWidget->item(row);
QFont font = item->font();
font.setPointSize(fontSize);
item->setFont(font);
}
});
mFontSizeHandler.registerFontSize(ui.quickViewWidget, 1.5f);
mFontSizeHandler.registerFontSize(ui.messageTreeWidget, 1.5f, [this] (QAbstractItemView *view, int) {
mMessageModel->setFont(view->font());
});
}
void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
@ -511,7 +528,7 @@ void MessagesDialog::fillQuickView()
ui.quickViewWidget->clear();
// add static items
item = new QListWidgetItem(tr("Stared"), ui.quickViewWidget);
item = new QListWidgetItem(tr("Starred"), ui.quickViewWidget);
item->setIcon(FilesDefs::getIconFromQtResourcePath(IMAGE_STAR_ON));
item->setData(ROLE_QUICKVIEW_TYPE, QUICKVIEW_TYPE_STATIC);
item->setData(ROLE_QUICKVIEW_ID, QUICKVIEW_STATIC_ID_STARRED);
@ -1296,7 +1313,7 @@ void MessagesDialog::updateMessageSummaryList()
/* calculating the new messages */
std::list<MsgInfoSummary> msgList;
rsMail->getMessageSummaries(mMessageModel->currentBox(),msgList);
rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_ALL,msgList);
QMap<int, int> tagCount;

View file

@ -25,6 +25,7 @@
#include <retroshare/rsevents.h>
#include <retroshare-gui/mainpage.h>
#include "util/FontSizeHandler.h"
#include "ui_MessagesDialog.h"
@ -166,6 +167,8 @@ private:
RsEventsHandlerId_t mEventHandlerId;
RsEventsHandlerId_t mTagEventHandlerId;
FontSizeHandler mFontSizeHandler;
};
#endif

View file

@ -139,11 +139,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -253,11 +248,6 @@
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
</widget>
</item>
</layout>
@ -375,11 +365,6 @@
<enum>Qt::Vertical</enum>
</property>
<widget class="RSTreeView" name="messageTreeWidget">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -466,7 +451,7 @@
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTabWidget</class>

View file

@ -231,7 +231,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox
--------------------------------------------------------------------------- */
QGroupBox {
font-weight: bold;
border: 1px solid #C9CDD0;
border: 1px solid #C0C4C8;
border-radius: 4px;
padding: 2px;
margin-top: 6px;
@ -1234,7 +1234,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox
--------------------------------------------------------------------------- */
QComboBox {
border: 1px solid #C9CDD0;
border: 1px solid #C0C4C8;
border-radius: 4px;
selection-background-color: #9FCBFF;
padding-left: 4px;
@ -1250,7 +1250,7 @@ QComboBox {
}
QComboBox QAbstractItemView {
border: 1px solid #C9CDD0;
border: 1px solid #C0C4C8;
border-radius: 0;
background-color: #FAFAFA;
selection-background-color: #9FCBFF;
@ -1263,7 +1263,7 @@ QComboBox QAbstractItemView:hover {
QComboBox QAbstractItemView:selected {
background: #9FCBFF;
color: #C9CDD0;
color: #C0C4C8;
}
QComboBox QAbstractItemView:alternate {
@ -1301,6 +1301,18 @@ QComboBox::indicator:alternate {
background: #FAFAFA;
}
QComboBox::item {
/* Remove to fix #282, #285 and MR #288*/
/*&:checked {
font-weight: bold;
}
&:selected {
border: 0px solid transparent;
}
*/
}
QComboBox::item:alternate {
background: #FAFAFA;
}
@ -1433,14 +1445,14 @@ QLineEdit {
padding-left: 4px;
padding-right: 4px;
border-style: solid;
border: 1px solid #C9CDD0;
border: 1px solid #C0C4C8;
border-radius: 4px;
color: #19232D;
}
QLineEdit:disabled {
background-color: #FAFAFA;
color: #788D9C;
color: #9DA9B5;
}
QLineEdit:hover {
@ -2151,12 +2163,12 @@ QSplitter::handle:hover {
}
QSplitter::handle:horizontal {
width: 5px;
width: 2px;
image: url(":/standard_light/rc/line_vertical.png");
}
QSplitter::handle:vertical {
height: 5px;
height: 2px;
image: url(":/standard_light/rc/line_horizontal.png");
}
@ -2350,51 +2362,6 @@ QFrame#titleBarFrame QTextEdit {
background: white;
}
/**** Special Page tweak ****/
/* ConnectFriendWizard */
ConnectFriendWizard QPlainTextEdit#friendCertEdit {
border: none;
background: white;
color: black;
}
ConnectFriendWizard QFrame#friendFrame {
border: 2px solid #0099cc;
border-radius: 6px;
background: white;
}
ConnectFriendWizard QWizardPage#ConclusionPage > QGroupBox#peerDetailsFrame {
border: 2px solid #039bd5;
border-radius:6px;
background: white;
color: black;
padding: 12 12px;
}
ConnectFriendWizard QGroupBox::title#peerDetailsFrame
{
padding: 4 12px;
background: transparent;
padding: 4 12px;
background: #039bd5;
color: white;
}
/* GetStartedDialog */
GetStartedDialog QTextEdit {
border: 1px solid #B8B6B1;
border-radius: 6px;
background: white;
color: black;
}
/* HomePage */
HomePage QLabel#userCertLabel {
@ -2509,7 +2476,7 @@ GxsGroupDialog QLabel#groupLogo{
/* Settings */
PluginItem > QFrame#pluginFrame {
PluginItem QFrame#pluginFrame {
border: 2px solid #A8B8D1;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FCFDFE, stop: 1 #E2E8EF);
border-radius: 0px
@ -2521,7 +2488,7 @@ PluginItem QLabel#infoLabel {
/* Feeds */
AttachFileItem > QFrame#frame {
AttachFileItem QFrame#frame {
border: 2px solid black;
background: white;
}
@ -2627,88 +2594,78 @@ BoardPostDisplayWidget_card QLabel#siteBoldLabel {
color: #787c7e;
}
/* GenCertDialog
Change colors here because GUI is not started yet so no user StyleSheet loads */
/* MessengerWindow */
MessengerWindow QFrame#messengerframetop{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #9BDBF9, stop:1 #1592CD);
border: 0px;
GenCertDialog QFrame#profileframe{
border-image: url(:/images/logo/background.png) 0 0 0 0 stretch stretch;
border-width: 0px;
}
/*************** Optional ***************/
/**** WikiPoos ****/
WikiEditDialog QPushButton#pushButton_History {
color: white;
background: #5bb62b;
border-radius: 4px;
max-height: 20px;
min-width: 4em;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
}
WikiEditDialog QPushButton#pushButton_History:hover {
background: #57af29;
}
/**** The Wire ****/
WireGroupItem QFrame#wire_frame:hover {
background-color: #7ecbfb;
}
WireGroupItem QFrame#wire_frame > QLabel {
GenCertDialog QFrame#profileframe QCheckBox,
GenCertDialog QFrame#profileframe QLabel {
background: transparent;
}
PulseTopLevel QFrame#plainFrame,
PulseViewGroup QFrame#plainFrame,
PulseReply QFrame#plainFrame {
border: 2px solid #c4cfd6;
background: white;
GenCertDialog QLabel#info_Label:enabled {
color: black;
border: 1px solid #DCDC41;
border-radius: 6px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
PulseAddDialog QTextEdit#textEdit_Pulse {
border: 2px solid #c4cfd6;
GenCertDialog QGroupBox#groupBox,
GenCertDialog QGroupBox#profile_groupBox {
background: rgba(0,0,0,10%);
}
GenCertDialog QGroupBox#profile_groupBox QComboBox,
GenCertDialog QGroupBox#profile_groupBox QSpinBox,
GenCertDialog QGroupBox#profile_groupBox QLineEdit,
GenCertDialog QComboBox#genPGPuser {
border: 2px solid #0099cc;
border-radius: 6px;
background: white;
color: black;
}
PulseReply #line_replyLine,
PulseMessage #line{
color: #c4cfd6;
GenCertDialog QPushButton#genButton {
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
GenCertDialog QPushButton#genButton:disabled {
border-image: url(:/images/btn_27.png) 4;
color: black;
}
PulseReply QLabel#label_groupName{
color: #5b7083;
/* StartDialog
To get the same style for all user and not use last connected one. */
StartDialog QFrame#loginframe{
border-image: url(:/images/logo/background_lessblue.png) 0 0 0 0 stretch stretch;
border-width: 0px;
}
PulseReplySeperator QFrame#frame {
border: 2px solid #CCCCCC;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);
border-radius: 10px}
StartDialog QFrame#loginframe QCheckBox,
StartDialog QFrame#loginframe QLabel {
background: transparent;
}
StartDialog QGroupBox#profilGBox {
background: rgba(0,0,0,10%);
border-radius: 3px;
border-width: 0px;
}
QLabel#label_masthead{
border: 2px solid #CCCCCC;
border-radius: 4px;
StartDialog QPushButton#loadButton {
background: transparent;
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
/**** PhotoShare ****/
AlbumItem QFrame#albumFrame {
border: 2px solid #CCCCCC;
border-radius: 10px
}
PhotoItem QFrame#photoFrame {
border: 2px solid #CCCCCC;
border-radius: 10px
}
PhotoItem QWidget:hover {
background-color: #7ecbfb;
StartDialog QPushButton#loadButton:hover {
background: transparent;
border-image: url(:/images/btn_blue_hover.png) 4;
}

View file

@ -141,88 +141,6 @@ QLabel#newLabel:enabled {
}
/* StartDialog
To get the same style for all user and not use last connected one. */
StartDialog QFrame#loginframe{
border-image: url(:/images/logo/background_lessblue.png) 0 0 0 0 stretch stretch;
border-width: 0px;
}
StartDialog QFrame#loginframe QCheckBox,
StartDialog QFrame#loginframe QLabel {
background: transparent;
}
StartDialog QGroupBox#profilGBox {
background: rgba(0,0,0,10%);
border-radius: 3px;
border-width: 0px;
}
StartDialog QGroupBox#profilGBox * {
background-color: white;
color: black;
}
StartDialog QPushButton#loadButton {
background: transparent;
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
StartDialog QPushButton#loadButton:hover {
background: transparent;
border-image: url(:/images/btn_blue_hover.png) 4;
}
/* GenCertDialog
Change colors here because GUI is not started yet so no user StyleSheet loads */
GenCertDialog QFrame#profileframe{
border-image: url(:/images/logo/background.png) 0 0 0 0 stretch stretch;
border-width: 0px;
}
GenCertDialog QFrame#profileframe QCheckBox,
GenCertDialog QFrame#profileframe QLabel {
background: transparent;
}
GenCertDialog QLabel#info_Label:enabled {
color: black;
border: 1px solid #DCDC41;
border-radius: 6px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
GenCertDialog QGroupBox#groupBox,
GenCertDialog QGroupBox#profile_groupBox {
background: rgba(0,0,0,10%);
}
GenCertDialog QGroupBox#profile_groupBox QComboBox,
GenCertDialog QGroupBox#profile_groupBox QSpinBox,
GenCertDialog QGroupBox#profile_groupBox QLineEdit,
GenCertDialog QComboBox#genPGPuser {
border: 2px solid #0099cc;
border-radius: 6px;
background: white;
color: black;
}
GenCertDialog QPushButton#genButton {
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
GenCertDialog QPushButton#genButton:disabled {
border-image: url(:/images/btn_27.png) 4;
color: black;
}
/* AvatarWidget */
AvatarWidget{border-width: 10px;}
@ -418,3 +336,27 @@ OpModeStatus[opMode="Minimal"] {
[WrongValue="true"] {
background-color: #FF8080;
}
GenCertDialog QPushButton#genButton {
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
GenCertDialog QPushButton#genButton:disabled {
border-image: url(:/images/btn_27.png) 4;
color: black;
}
StartDialog QPushButton#loadButton {
background: transparent;
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
color: white;
}
StartDialog QPushButton#loadButton:hover {
background: transparent;
border-image: url(:/images/btn_blue_hover.png) 4;
}

View file

@ -101,6 +101,9 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.mainPageButtonType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(updateRbtPageOnToolBar() ));
// connect(ui.menuItemsButtonType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionButtonLoc() ));
connect(ui.minimumFontSize_SB, SIGNAL(valueChanged(int)), this, SLOT(updateFontSize())) ;
}
void AppearancePage::switch_status_grpStatus(bool b) { switch_status(MainWindow::StatusGrpStatus ,"ShowStatusBar", b) ; }
@ -359,4 +362,12 @@ void AppearancePage::load()
whileBlocking(ui.checkBoxShowToasterDisable)->setChecked(Settings->valueFromGroup("StatusBar", "ShowToaster", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowSystrayOnStatus)->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool());
whileBlocking(ui.minimumFontSize_SB)->setValue(Settings->getFontSize());
}
void AppearancePage::updateFontSize()
{
Settings->setFontSize(ui.minimumFontSize_SB->value());
NotifyQt::getInstance()->notifySettingsChanged();
}

View file

@ -71,6 +71,8 @@ private slots:
// void updateCmboListItemSize();
void updateStyle() ;
void updateFontSize();
private:
void switch_status(MainWindow::StatusElement s,const QString& key,bool b);

View file

@ -14,22 +14,7 @@
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="AppearancePageGLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="grpLanguage">
<property name="minimumSize">
<size>
@ -86,110 +71,12 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="grpStyle">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Style</string>
</property>
<layout class="QGridLayout" name="grpStyleGLayout">
<item row="0" column="0">
<widget class="RSComboBox" name="cmboStyle">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Choose RetroShare's interface style</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="grpStyleHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="grpStyleSheet">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="grpStyleSheetGLayout">
<item row="0" column="0">
<widget class="RSComboBox" name="cmboStyleSheet">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="grpStyleSheetHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="8" column="0">
<spacer name="AppearancePageVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<item row="3" column="0">
<widget class="QGroupBox" name="grpToolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>228</height>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy">
@ -198,8 +85,8 @@
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelPageToolBar">
@ -237,7 +124,7 @@
</item>
</layout>
</item>
<item>
<item row="1" column="0">
<widget class="QFrame" name="frameToolListStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -289,19 +176,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="RSComboBox" name="cmboTollButtonsSize">
<item>
@ -352,10 +226,79 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="7" column="0">
<item row="3" column="1">
<widget class="QGroupBox" name="grpFonts">
<property name="title">
<string>Fonts</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="minimumFontSizeHLayout">
<item>
<widget class="QLabel" name="minimumFontSizeLabel">
<property name="text">
<string>Minimum font size </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="minimumFontSize_SB">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>64</number>
</property>
</widget>
</item>
<item>
<spacer name="minimumFontSizeHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>188</width>
<height>96</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="grpStatus">
<property name="title">
<string>Status Bar</string>
@ -464,6 +407,104 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="AppearancePageVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="grpStyle">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip">
<string/>
</property>
<property name="title">
<string>Style</string>
</property>
<layout class="QGridLayout" name="grpStyleGLayout">
<item row="0" column="0">
<widget class="RSComboBox" name="cmboStyle">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Choose RetroShare's interface style</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="grpStyleHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="grpStyleSheet">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="grpStyleSheetGLayout">
<item row="0" column="0">
<widget class="RSComboBox" name="cmboStyleSheet">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="grpStyleSheetHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>

Some files were not shown because too many files have changed in this diff Show more