From b3b87303e2ea716880d0b23c76d1b65d125497ae Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 17 Jun 2020 00:21:32 +0200 Subject: [PATCH 1/2] Added default column with for file name & store the column state & width * Added default column width for file name & store the column state & width * disabled resize column to contents --- .../GxsChannelPostsWidgetWithModel.cpp | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 1560eaf4f..90b820d4a 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -266,7 +266,12 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize))); - //ui->nameLabel->setMinimumWidth(20); + /* Set initial section sizes */ + QHeaderView * channelpostfilesheader = ui->channelPostFiles_TV->header () ; + QHeaderView * channelfilesheader = ui->channelFiles_TV->header () ; + + channelpostfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, fm.width("RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z")*1.5); + channelfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, fm.width("RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z")*1.5); /* Initialize feed widget */ //ui->feedWidget->setSortRole(ROLE_PUBLISH, Qt::DescendingOrder); @@ -421,8 +426,8 @@ void GxsChannelPostsWidgetWithModel::showPostDetails() ui->postTime_LB->setText(QDateTime::fromMSecsSinceEpoch(post.mMeta.mPublishTs*1000).toString("MM/dd/yyyy, hh:mm")); ui->postTime_LB->setFixedWidth(W); - ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); - ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); + //ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); + //ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); ui->channelPostFiles_TV->setAutoSelect(true); // Now also set the post as read @@ -484,8 +489,8 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad() mChannelPostsModel->getFilesList(files); mChannelFilesModel->setFiles(files); - ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); - ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); + //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE); + //ui->channelFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE); ui->channelFiles_TV->setAutoSelect(true); @@ -536,6 +541,9 @@ GxsChannelPostsWidgetWithModel::~GxsChannelPostsWidgetWithModel() void GxsChannelPostsWidgetWithModel::processSettings(bool load) { + QHeaderView *channelpostfilesheader = ui->channelPostFiles_TV->header () ; + QHeaderView *channelfilesheader = ui->channelFiles_TV->header () ; + Settings->beginGroup(QString("ChannelPostsWidget")); if (load) { @@ -548,6 +556,10 @@ void GxsChannelPostsWidgetWithModel::processSettings(bool load) /* View mode */ //setViewMode(Settings->value("viewMode", VIEW_MODE_FEEDS).toInt()); #endif + // state of files tree + channelpostfilesheader->restoreState(Settings->value("PostFilesTree").toByteArray()); + channelfilesheader->restoreState(Settings->value("FilesTree").toByteArray()); + // state of splitter ui->splitter->restoreState(Settings->value("SplitterChannelPosts").toByteArray()); } else { @@ -560,6 +572,10 @@ void GxsChannelPostsWidgetWithModel::processSettings(bool load) /* View mode */ //Settings->setValue("viewMode", viewMode()); #endif + // state of files tree + Settings->setValue("PostFilesTree", channelpostfilesheader->saveState()); + Settings->setValue("FilesTree", channelfilesheader->saveState()); + // state of splitter Settings->setValue("SplitterChannelPosts", ui->splitter->saveState()); } From 9e0c24767735c08994c362572b1150ad6ba42d85 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 17 Jun 2020 17:19:12 +0200 Subject: [PATCH 2/2] Fixing get work links click on messages & clear the channel details when no channel selected --- .../GxsChannelPostsWidgetWithModel.cpp | 14 +- .../GxsChannelPostsWidgetWithModel.ui | 136 +++++++++--------- 2 files changed, 81 insertions(+), 69 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 90b820d4a..10de9b504 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -955,10 +955,18 @@ void GxsChannelPostsWidgetWithModel::blank() ui->postButton->setEnabled(false); ui->subscribeToolButton->setEnabled(false); - mChannelPostsModel->clear(); - groupNameChanged(QString()); + ui->channelName_LB->setText(tr("No Channel Selected")); + ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channels.png")); + ui->infoPosts->setText(""); + ui->infoLastPost->setText(""); + ui->infoAdministrator->setText(""); + ui->infoDistribution->setText(""); + ui->infoCreated->setText(""); + ui->infoDescription->setText(""); + + mChannelPostsModel->clear(); + groupNameChanged(QString()); - //ui->infoWidget->hide(); } bool GxsChannelPostsWidgetWithModel::navigate(const RsGxsMessageId &msgId) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui index 097f6b298..0a7f3a594 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.ui @@ -161,7 +161,7 @@ - 1 + 0 @@ -199,25 +199,8 @@ - - - - unknown - - - true - - - - - - - unknown - - - - - + + 75 @@ -225,33 +208,14 @@ - Created: + Distribution: - - + + - unknown - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Posts: + unknown @@ -268,21 +232,8 @@ - - - - 0 - - - - - - - - 0 - 0 - - + + 75 @@ -290,14 +241,31 @@ - Last Post: + Created: - - + + - unknown + unknown + + + + + + + 0 + + + + + + + unknown + + + true @@ -314,8 +282,21 @@ - - + + + + unknown + + + + + + + + 0 + 0 + + 75 @@ -323,7 +304,26 @@ - Distribution: + Posts: + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Last Post: @@ -460,7 +460,11 @@ p, li { white-space: pre-wrap; } - + + + true + +