Merge 26def039eb4f8bbb22b0ba21caae1e596f054928 into 8fcc52b304f35a5c7df95efbe2abdd0574048a15

This commit is contained in:
chelovechishko 2025-01-30 19:18:35 +00:00 committed by GitHub
commit ce4ad2806d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 158 additions and 7 deletions

View File

@ -170,7 +170,10 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
ui.lobbyTreeWidget->insertTopLevelItem(3, publicLobbyItem);
ui.lobbyTreeWidget->expandAll();
ui.lobbyTreeWidget->expandItem(privateSubLobbyItem);
ui.lobbyTreeWidget->expandItem(publicSubLobbyItem);
ui.lobbyTreeWidget->expandItem(privateLobbyItem);
// ui.lobbyTreeWidget->expandItem(publicLobbyItem);
ui.lobbyTreeWidget->setColumnHidden(COLUMN_NAME,false) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT,true) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC,true) ;

View File

@ -140,6 +140,9 @@ class ShareFlagsItemDelegate: public QStyledItemDelegate
{
public:
ShareFlagsItemDelegate() {}
/** Default Destructor */
~ShareFlagsItemDelegate() {}
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{

View File

@ -1144,6 +1144,9 @@ TransfersDialog::~TransfersDialog()
delete ULDelegate;
delete DLDelegate;
delete ULListModel;
delete DLListModel;
delete DLLFilterModel;
}
void TransfersDialog::activatePage(TransfersDialog::Page page)

View File

@ -202,6 +202,7 @@ void HomePage::certContextMenu(QPoint /*point*/)
HomePage::~HomePage()
{
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete ui->shareButton->menu();
delete ui;
}

View File

@ -1239,6 +1239,11 @@ IdDialog::~IdDialog()
{
rsEvents->unregisterEventsHandler(mEventHandlerId_identity);
rsEvents->unregisterEventsHandler(mEventHandlerId_circles);
delete ui->idTreeWidget->itemDelegateForColumn(RSID_COL_NICKNAME);
delete ui->idTreeWidget->itemDelegateForColumn(RSID_COL_VOTES);
delete ui->idTreeWidget->itemDelegate();
delete ui->treeWidget_membership->itemDelegateForColumn(CIRCLEGROUP_CIRCLE_COL_GROUPNAME);
delete ui->toolButton_New->menu();
// save settings
processSettings(false);

View File

@ -389,6 +389,7 @@ MainWindow::~MainWindow()
MacDockIconHandler::cleanup();
#endif
// delete notifyMenu; // already deleted by the deletion of trayMenu
delete idle;
StatisticsWindow::releaseInstance();
#ifdef MESSENGER_WINDOW
@ -1638,8 +1639,28 @@ void MainWindow::settingsChanged()
ui->toolBarPage->setIconSize(QSize(toolSize,toolSize));
ui->toolBarAction->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBarAction->setIconSize(QSize(toolSize,toolSize));
int itemSize = Settings->getListItemIconSize();
ui->listWidget->setIconSize(QSize(itemSize,itemSize));
switch (Settings->RshareSettings::getToolButtonStyle())
{
case Qt::ToolButtonTextOnly:
for (int i = 0; i < ui->listWidget->count(); ++i)
{
// annihilate icons
ui->listWidget->item(i)->setIcon(QIcon());
}
break;
default:
QList<MainPage*> pages = ui->stackPages->pages();
int count = 0;
for (QList<MainPage*>::iterator i = pages.begin(); i != pages.end(); ++i) {
ui->listWidget->item(count++)->setIcon((*i)->iconPixmap());
}
// because 'exit' isn't a 'page', but only 'action'
ui->listWidget->item(count)->setIcon(QIcon(IMAGE_QUIT)) ;
int itemSize = Settings->getListItemIconSize();
ui->listWidget->setIconSize(QSize(itemSize,itemSize));
break;
}
}
void MainWindow::externalLinkActivated(const QUrl &url)

View File

@ -146,6 +146,7 @@ NewsFeed::~NewsFeed()
if (instance == this) {
instance = NULL;
delete ui;
}
}

View File

@ -23,6 +23,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QWidgetAction>
#include <QClipboard>
#include "ChatLobbyDialog.h"
@ -98,6 +99,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
distantChatAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/png/chats.png"), tr("Start private chat"), this);
sendMessageAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/mail/write-mail.png"), tr("Send Message"), this);
showInPeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this);
copyIdAct = new QAction(QIcon(), tr("Copy ID to clipboard"), this);
QActionGroup *sortgrp = new QActionGroup(this);
actionSortByName = new QAction(QIcon(), tr("Sort by Name"), this);
@ -118,6 +120,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant()));
connect(voteNegativeAct, SIGNAL(triggered()), this, SLOT(voteParticipant()));
connect(showInPeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
connect(copyIdAct, SIGNAL(triggered()), this, SLOT(copyId()));
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
@ -290,6 +293,7 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QList<RsGxs
contextMnu->addAction(voteNeutralAct);
contextMnu->addAction(voteNegativeAct);
contextMnu->addAction(showInPeopleAct);
contextMnu->addAction(copyIdAct);
distantChatAct->setEnabled(false);
sendMessageAct->setEnabled(false);
@ -300,6 +304,7 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QList<RsGxs
voteNeutralAct->setEnabled(false);
voteNegativeAct->setEnabled(false);
showInPeopleAct->setEnabled(idList.count() == 1);
copyIdAct->setEnabled(idList.count() == 1);
distantChatAct->setData(QVariant::fromValue(idList));
sendMessageAct->setData(QVariant::fromValue(idList));
@ -311,6 +316,19 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QList<RsGxs
RsGxsId gxsid = idList.at(0);
if (!gxsid.isNull())
copyIdAct->setData(QString::fromStdString(gxsid.toStdString()));
if (!gxsid.isNull() && rsIdentity->isOwnId(gxsid))
{
distantChatAct->setVisible(false);
sendMessageAct->setVisible(false);
muteAct->setVisible(false);
votePositiveAct->setVisible(false);
voteNeutralAct->setVisible(false);
voteNegativeAct->setVisible(false);
}
if(!gxsid.isNull() && !rsIdentity->isOwnId(gxsid))
{
distantChatAct->setEnabled(true);
@ -379,6 +397,13 @@ void ChatLobbyDialog::showInPeopleTab()
idDialog->navigate(nickname);
}
void ChatLobbyDialog::copyId()
{
QAction* the_action = qobject_cast<QAction*>(sender());
if (the_action)
QApplication::clipboard()->setText(the_action->data().toString()) ;
}
void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
{
ChatLobbyInfo linfo ;
@ -444,6 +469,7 @@ ChatLobbyDialog::~ChatLobbyDialog()
// save settings
processSettings(false);
delete mParticipantCompareRole;
}
ChatWidget *ChatLobbyDialog::getChatWidget()

View File

@ -62,6 +62,7 @@ private slots:
void inviteFriends() ;
void filterChanged(const QString &text);
void showInPeopleTab();
void copyId();
void toggleWindowed(){setWindowed(!isWindowed());}
void setWindowed(bool windowed);
@ -131,6 +132,7 @@ private:
QWidgetAction *checkableAction;
QAction *sendMessageAct;
QAction *showInPeopleAct;
QAction *copyIdAct;
GxsIdChooser *ownIdChooser ;
//icons cache

View File

@ -259,6 +259,8 @@ ChatWidget::~ChatWidget()
foreach (ChatWidgetHolder *chatWidgetHolder, mChatWidgetHolder) {
delete(chatWidgetHolder);
}
delete ui->fontcolorButton->menu();
delete ui->pushtoolsButton->menu();
delete ui;
}

View File

@ -894,6 +894,12 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="HashBox" name="hashBox">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>78</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>

View File

@ -153,6 +153,8 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
GroupTreeWidget::~GroupTreeWidget()
{
delete compareRole;
delete ui->treeWidget->itemDelegate();
delete ui;
}

View File

@ -10,6 +10,12 @@
<height>257</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>

View File

@ -68,6 +68,14 @@ LineEditClear::LineEditClear(QWidget *parent)
qMax(msz.height(), mClearButton->sizeHint().height() + frameWidth * 2));
}
LineEditClear::~LineEditClear()
{
delete (mFilterButton ? mFilterButton->menu() : nullptr);
delete mClearButton;
delete mFilterButton;
delete mActionGroup;
}
void LineEditClear::resizeEvent(QResizeEvent *)
{
QSize sz = mClearButton->sizeHint();

View File

@ -37,6 +37,7 @@ class LineEditClear : public QLineEdit
public:
LineEditClear(QWidget *parent = 0);
~LineEditClear();
void addFilter(const QIcon &icon, const QString &text, int id, const QString &description = "");
void setCurrentFilter(int id);

View File

@ -1026,6 +1026,15 @@ void NewFriendList::removeProfile()
if ((QMessageBox::question(this, "RetroShare", tr("Do you want to remove this Friend?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes)
rsPeers->removeFriend(det.gpg_id);
QModelIndex index_to_remove = ui->peerTreeWidget->selectionModel()->selectedIndexes().first();
// could be only one selected item
ui->peerTreeWidget->selectionModel()->select(index_to_remove, QItemSelectionModel::Clear);
// otherwise already at top
QModelIndex index_to_select = ui->peerTreeWidget->indexAbove(index_to_remove);
if (index_to_select.isValid()) {
ui->peerTreeWidget->selectionModel()->select(index_to_select, QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
checkInternalData(true);
}

View File

@ -33,6 +33,11 @@ RSComboBox::RSComboBox(QWidget *parent /*= nullptr*/)
view()->installEventFilter(this);
}
RSComboBox::~RSComboBox()
{
delete this->itemDelegate();
}
bool RSComboBox::eventFilter(QObject *obj, QEvent *event)
{
if(QAbstractItemView* view = dynamic_cast<QAbstractItemView*>(obj))

View File

@ -28,6 +28,7 @@ class RSComboBox : public QComboBox
Q_OBJECT
public:
explicit RSComboBox(QWidget *parent = nullptr);
~RSComboBox();
protected:
bool eventFilter(QObject *obj, QEvent *event);

View File

@ -301,6 +301,8 @@ RSGraphWidget::~RSGraphWidget()
{
delete _painter;
delete _source ;
_timer->stop();
delete _timer;
}
void RSGraphWidget::setFiltering(bool b)

View File

@ -47,6 +47,7 @@ RSImageBlockWidget::~RSImageBlockWidget()
delete mAnimation;
mTimer->stop();
delete mTimer;
delete ui->loadImagesButton->menu();
delete ui;
}

View File

@ -179,7 +179,12 @@ void UserNotify::update()
}
if (mListItem) {
mListItem->setIcon(getMainIcon(count > 0));
switch (Settings->RshareSettings::getToolButtonStyle()) {
case Qt::ToolButtonTextOnly:
break;
default:
mListItem->setIcon(getMainIcon(count > 0));
}
mListItem->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText);
QFont font = mListItem->font();

View File

@ -97,6 +97,7 @@ class DistributionItemDelegate: public QStyledItemDelegate
{
public:
DistributionItemDelegate() {}
~DistributionItemDelegate() {}
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
{
@ -435,6 +436,10 @@ GxsForumThreadWidget::~GxsForumThreadWidget()
// save settings
processSettings(false);
delete ui->threadTreeWidget->itemDelegateForColumn(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION) ;
delete ui->threadTreeWidget->itemDelegateForColumn(RsGxsForumModel::COLUMN_THREAD_AUTHOR) ;
delete ui->threadTreeWidget->itemDelegateForColumn(RsGxsForumModel::COLUMN_THREAD_READ) ;
delete ui->threadTreeWidget->model();
delete ui;
}
@ -925,6 +930,12 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
#endif
markMsgAsReadUnread(true, false, false);
}
if (Settings->getForumExpandNewMessages())
{
recursExpandUnread(index);
}
}
void GxsForumThreadWidget::clickedThread(QModelIndex index)
@ -1314,7 +1325,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
else {
RsIdentityDetails details;
rsIdentity->getIdDetails(msg.mMeta.mAuthorId, details);
QString name = GxsIdDetails::getName(details);
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
banned_text_info += "<p><font color=\"#e00000\"><b>" + tr( "The author of this message (with ID %1) is banned. And named by name ( %2 )").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString()), name) + "</b>";
banned_text_info += "<ul><li><b><font color=\"#e00000\">" + tr( "Messages from this author are not forwarded.") + "</font></b></li></ul>";
@ -2099,3 +2110,16 @@ void GxsForumThreadWidget::showAuthorInPeople(const RsGxsForumMsg& msg)
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(RsGxsId(msg.mMeta.mAuthorId));
}
void GxsForumThreadWidget::recursExpandUnread(const QModelIndex &index)
{
if (index.isValid()
&& index.data(RsGxsForumModel::UnreadChildrenRole).toBool()
) {
ui->threadTreeWidget->expand(index);
for (int row=0; row < mThreadProxyModel->rowCount(index); ++row)
{
recursExpandUnread(index.child(row, 0));
}
}
}

View File

@ -200,6 +200,7 @@ private:
void setForumDescriptionLoading();
void clearForumDescription();
void blankPost();
void recursExpandUnread(const QModelIndex &index);
RsGxsGroupId mLastForumID;
RsGxsMessageId mThreadId;

View File

@ -474,7 +474,11 @@
</widget>
</item>
<item row="0" column="8">
<widget class="RSComboBox" name="versions_CB"/>
<widget class="RSComboBox" name="versions_CB">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="Line" name="lineRight">

View File

@ -223,6 +223,7 @@ MessageWidget::~MessageWidget()
}
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete ui.moreButton->menu();
}
void MessageWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)

View File

@ -415,6 +415,7 @@ MessagesDialog::~MessagesDialog()
rsEvents->unregisterEventsHandler(mEventHandlerId);
rsEvents->unregisterEventsHandler(mTagEventHandlerId);
delete ui.messageTreeWidget->itemDelegateForColumn(RsMessageModel::COLUMN_THREAD_AUTHOR) ;
}
UserNotify *MessagesDialog::createUserNotify(QObject *parent)

View File

@ -36,6 +36,7 @@ PostedPage::PostedPage(QWidget * parent, Qt::WindowFlags flags)
PostedPage::~PostedPage()
{
delete ui;
}
/** Loads the settings for this page */

View File

@ -197,6 +197,7 @@ BwCtrlWindow::BwCtrlWindow(QWidget *parent)
BwCtrlWindow::~BwCtrlWindow()
{
delete BWDelegate;
}
void BwCtrlWindow::updateDisplay()

View File

@ -59,6 +59,7 @@
#define IMAGE_BWGRAPH ":/icons/bandwidth128.png"
#define IMAGE_GLOBALROUTER ":/icons/GRouter128.png"
#define IMAGE_GXSTRANSPORT ":/icons/transport128.png"
#define IMAGE_QUIT ":/icons/png/exit.png"
#define IMAGE_RTT ":/icons/RTT128.png"
//#define IMAGE_BANDWIDTH ":images/office-chart-area-stacked.png"
@ -97,6 +98,7 @@ StatisticsWindow::StatisticsWindow(QWidget *parent) :
ui(new Ui::StatisticsWindow)
{
ui->setupUi(this);
// setAttribute(Qt::WA_DeleteOnClose, true);
Settings->loadWidgetInformation(this);
@ -200,6 +202,9 @@ void StatisticsWindow::initStackedPage()
/* Create the toolbar */
ui->toolBar->addActions(grp->actions());
// commented out per cyril taste
// action = ui->toolBar->addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_QUIT), tr("Quit"));
// connect(action, &QAction::triggered, this, &StatisticsWindow::close);
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));

View File

@ -1210,7 +1210,7 @@ QString RsHtml::toHtml(QString text, bool realHtml)
/** Loads image and converts image to embedded image HTML fragment **/
bool RsHtml::makeEmbeddedImage(const QString &fileName, QString &embeddedImage, const int maxPixels, const int maxBytes)
{
QImage image;
QImage image {};
if (image.load (fileName) == false) {
fprintf (stderr, "RsHtml::makeEmbeddedImage() - image \"%s\" can't be load\n", fileName.toLatin1().constData());