turned drop menu for forum display type into a tool button group

This commit is contained in:
csoler 2022-04-02 16:53:29 +02:00
parent 7532efd5fc
commit 1085592449
7 changed files with 234 additions and 29 deletions

View File

@ -291,7 +291,6 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
connect(ui->threadTreeWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedThread(QModelIndex)));
connect(ui->threadTreeWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(changedSelection(const QModelIndex&,const QModelIndex&)));
connect(ui->viewBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changedViewBox()));
//connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(togglethreadview()));
ui->expandButton->hide();
@ -306,6 +305,10 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
connect(ui->actionSave_image, SIGNAL(triggered()), this, SLOT(saveImage()));
connect(ui->threadedView_TB, SIGNAL(toggled(bool)), this, SLOT(toggleThreadedView(bool)));
connect(ui->flatView_TB, SIGNAL(toggled(bool)), this, SLOT(toggleFlatView(bool)));
connect(ui->latestPostInThreadView_TB, SIGNAL(toggled(bool)), this, SLOT(toggleLstPostInThreadView(bool)));
/* Set own item delegate */
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
itemDelegate->setSpacing(QSize(0, 2));
@ -419,7 +422,9 @@ void GxsForumThreadWidget::blank()
ui->forumName->setText("");
ui->progressText->hide();
ui->progressBar->hide();
ui->viewBox->setEnabled(false);
ui->threadedView_TB->setEnabled(false);
ui->flatView_TB->setEnabled(false);
ui->latestPostInThreadView_TB->setEnabled(false);
ui->filterLineEdit->setEnabled(false);
mThreadModel->clear();
@ -454,7 +459,13 @@ void GxsForumThreadWidget::processSettings(bool load)
ui->filterLineEdit->setCurrentFilter(Settings->value("filterColumn", RsGxsForumModel::COLUMN_THREAD_TITLE).toInt());
// index of viewBox
ui->viewBox->setCurrentIndex(Settings->value("viewBox", VIEW_THREADED).toInt());
switch(Settings->value("viewBox", VIEW_THREADED).toInt())
{
default:
case VIEW_THREADED : ui->threadedView_TB->setChecked(true); break;
case VIEW_FLAT : ui->flatView_TB->setChecked(true); break;
case VIEW_LAST_POST: ui->latestPostInThreadView_TB->setChecked(true); break;
}
// state of thread tree
header->restoreState(Settings->value("ThreadTree").toByteArray());
@ -1048,7 +1059,9 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
ui->newthreadButton->show();
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
ui->viewBox->setEnabled(true);
ui->flatView_TB->setEnabled(true);
ui->threadedView_TB->setEnabled(true);
ui->latestPostInThreadView_TB->setEnabled(true);
ui->filterLineEdit->setEnabled(true);
QString anti_spam_features1 ;
@ -1817,21 +1830,25 @@ void GxsForumThreadWidget::saveImage()
ImageUtil::extractImage(window(), cursor);
}
void GxsForumThreadWidget::changedViewBox()
void GxsForumThreadWidget::toggleThreadedView(bool b) { if(b) changedViewBox(VIEW_THREADED); }
void GxsForumThreadWidget::toggleFlatView(bool b) { if(b) changedViewBox(VIEW_FLAT); }
void GxsForumThreadWidget::toggleLstPostInThreadView(bool b) { if(b) changedViewBox(VIEW_LAST_POST); }
void GxsForumThreadWidget::changedViewBox(int view_mode)
{
ui->threadTreeWidget->selectionModel()->clear();
ui->threadTreeWidget->selectionModel()->reset();
mThreadId.clear();
// save index
Settings->setValueToGroup("ForumThreadWidget", "viewBox", ui->viewBox->currentIndex());
Settings->setValueToGroup("ForumThreadWidget", "viewBox", view_mode);
if(ui->viewBox->currentIndex() == VIEW_FLAT)
if(view_mode == VIEW_FLAT)
mThreadModel->setTreeMode(RsGxsForumModel::TREE_MODE_FLAT);
else
mThreadModel->setTreeMode(RsGxsForumModel::TREE_MODE_TREE);
if(ui->viewBox->currentIndex() == VIEW_LAST_POST)
if(view_mode == VIEW_LAST_POST)
mThreadModel->setSortMode(RsGxsForumModel::SORT_MODE_CHILDREN_PUBLISH_TS);
else
mThreadModel->setSortMode(RsGxsForumModel::SORT_MODE_PUBLISH_TS);
@ -1960,8 +1977,12 @@ void GxsForumThreadWidget::postForumLoading()
ui->forumName->setText(QString::fromUtf8(mForumGroup.mMeta.mGroupName.c_str()));
ui->threadTreeWidget->sortByColumn(RsGxsForumModel::COLUMN_THREAD_DATE, Qt::DescendingOrder);
ui->threadTreeWidget->update();
ui->viewBox->setEnabled(true);
ui->filterLineEdit->setEnabled(true);
ui->threadedView_TB->setEnabled(true);
ui->flatView_TB->setEnabled(true);
ui->flatView_TB->setEnabled(true);
ui->threadedView_TB->setEnabled(true);
ui->latestPostInThreadView_TB->setEnabled(true);
ui->filterLineEdit->setEnabled(true);
recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages);
//mUpdating = false;

View File

@ -122,7 +122,11 @@ private slots:
void replytoforummessage();
void editforummessage();
void replyMessageData(const RsGxsForumMsg &msg);
void toggleThreadedView(bool);
void toggleFlatView(bool);
void toggleLstPostInThreadView(bool);
void replyMessageData(const RsGxsForumMsg &msg);
void editForumMessageData(const RsGxsForumMsg &msg);
void replyForumMessageData(const RsGxsForumMsg &msg);
void showAuthorInPeople(const RsGxsForumMsg& msg);
@ -153,7 +157,7 @@ private slots:
void nextUnreadMessage();
void downloadAllFiles();
void changedViewBox();
void changedViewBox(int);
void flagperson();
void filterColumnChanged(int column);

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<width>848</width>
<height>600</height>
</rect>
</property>
@ -196,22 +196,63 @@
</widget>
</item>
<item>
<widget class="RSComboBox" name="viewBox">
<item>
<property name="text">
<string>Lastest post in thread</string>
</property>
</item>
<item>
<property name="text">
<string>Threaded View</string>
</property>
</item>
<item>
<property name="text">
<string>Flat View</string>
</property>
</item>
<widget class="QToolButton" name="threadedView_TB">
<property name="toolTip">
<string>Threaded</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/threaded-view.svg</normaloff>:/icons/svg/threaded-view.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="flatView_TB">
<property name="toolTip">
<string>Flat</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/flat-view.svg</normaloff>:/icons/svg/flat-view.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="latestPostInThreadView_TB">
<property name="toolTip">
<string>Latest post in thread</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/lastpost-view.svg</normaloff>:/icons/svg/lastpost-view.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>

View File

@ -1,6 +1,9 @@
<RCC>
<qresource prefix="/">
<file>icons/onion.png</file>
<file>icons/svg/threaded-view.svg</file>
<file>icons/svg/flat-view.svg</file>
<file>icons/svg/lastpost-view.svg</file>
<file>icons/svg/design.svg</file>
<file>icons/svg/hidden.svg</file>
<file>icons/svg/ratio-auto.svg</file>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg4"
sodipodi:docname="flat-view.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="21.666667"
inkscape:cx="11.976923"
inkscape:cy="14.284615"
inkscape:window-width="1366"
inkscape:window-height="705"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4">
<inkscape:grid
type="xygrid"
id="grid861" />
</sodipodi:namedview>
<path
d="M 7.838215,3.3529412 V 8.023513 H 21.849931 V 3.3529412 M 7.838215,19.699941 H 21.849931 V 15.029373 H 7.838215 m 0,-1.167644 H 21.849931 V 9.1911557 H 7.838215 M 2,8.023513 H 6.6705718 V 3.3529412 H 2 M 2,19.699941 H 6.6705718 V 15.029373 H 2 M 2,13.861729 H 6.6705718 V 9.1911557 H 2 Z"
id="path2"
style="fill:#039bd5;fill-opacity:1;stroke-width:1.16763" />
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg4155"
version="1.1"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xml:space="preserve"
width="128"
height="128"
viewBox="0 0 128 128"
sodipodi:docname="lastpost.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
id="metadata4161"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs4159" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="705"
id="namedview4157"
showgrid="true"
inkscape:zoom="2.559375"
inkscape:cx="50.989012"
inkscape:cy="70.525031"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g4163"
inkscape:pagecheckerboard="0"><inkscape:grid
type="xygrid"
id="grid1000" /></sodipodi:namedview><g
id="g4163"
inkscape:groupmode="layer"
inkscape:label="ink_ext_XXXXXX"
transform="matrix(1.25,0,0,-1.25,0,80)"><path
style="fill:#039bd5;fill-opacity:1;stroke-width:0.17417"
d="m 47.937786,-33.592704 c -2.195225,0.591202 -3.96008,2.011428 -4.908361,3.94989 -0.657422,1.343879 -0.885211,2.505371 -0.885211,4.513722 v 1.543723 h 7.576248 7.576243 v -2.008406 c 0,-1.569306 -0.07866,-2.242047 -0.35999,-3.077018 -1.264976,-3.755027 -5.246239,-5.932553 -8.998929,-4.921911 z M 8.9114622,-17.659241 c -1.1381664,0.693924 -1.0973712,0.05515 -1.0320513,16.1595845 0.065262,16.0902865 0.00892,15.2373095 1.2192521,18.4595695 0.970175,2.582889 2.052272,4.220688 4.222592,6.390995 2.033849,2.033862 3.662408,3.152185 5.938844,4.078197 6.902518,2.807822 14.647617,1.166897 19.863655,-4.208426 2.952445,-3.042606 4.596608,-6.449549 5.103339,-10.574835 0.112417,-0.915188 0.181283,-7.0188401 0.181283,-16.0668641 V -18.012037 l -17.460193,6.94e-4 c -17.205424,7e-4 -17.4686098,0.0057 -18.0367208,0.352147 z m 26.7952308,6.48324 c 1.380323,0.696056 1.386149,0.728115 1.386149,7.6197876 0,6.7259344 -0.02415,6.876174 -1.218625,7.57032 -0.59212,0.3441097 -0.874028,0.3542584 -9.84041,0.3542584 h -9.23083 L 16.234308,3.962759 c -1.084414,-0.7734669 -1.085912,-0.7838002 -1.085912,-7.5189724 0,-5.0656377 0.0443,-6.1988228 0.258627,-6.6132466 0.278862,-0.539271 1.009156,-1.130339 1.570125,-1.270796 0.191584,-0.04795 4.309254,-0.09631 9.150385,-0.107416 8.801025,-0.02022 8.802134,-0.02017 9.57916,0.371671 z m -15.507462,7.6197876 v 2.96083152 h 5.921655 5.921667 V -3.5562134 -6.5170448 h -5.921667 -5.921655 z m 29.736881,1.2627076 C 49.873764,12.956614 49.860892,13.473202 49.503826,15.041605 48.37637,19.99395 46.443534,23.634086 43.125741,27.053559 l -1.732128,1.785207 H 53.960572 66.527529 V 20.330661 11.822557 L 65.354553,11.230456 C 61.206464,9.1365834 59.469916,3.9535107 61.509095,-0.24704876 c 0.671166,-1.38254644 2.462068,-3.24113514 3.753867,-3.89574194 3.43729,-1.7418049 7.405445,-1.1373825 10.08202,1.5356822 2.923458,2.91961507 3.446495,7.3504228 1.268375,10.7447307 -0.743063,1.1579669 -2.393539,2.6405978 -3.546947,3.1862458 l -0.965545,0.456779 v 8.494244 8.494245 l 1.415808,-0.136869 c 5.057631,-0.488921 10.14328,-3.301436 13.416779,-7.419863 1.882935,-2.368937 3.043293,-4.731514 3.945751,-8.03381 l 0.456216,-1.669398 0.0576,-13.7875249 c 0.06374,-15.2433331 0.101305,-14.6864341 -1.037769,-15.3809121 -0.569352,-0.347119 -0.824017,-0.3515 -20.465724,-0.352147 l -19.889205,-6.49e-4 z m 18.07184,2.98040769 C 66.386886,1.4401741 65.749175,3.2829955 66.542478,4.9217444 c 1.142589,2.3602739 4.470961,2.2422515 5.579341,-0.1978411 0.405948,-0.8936972 0.404373,-1.562476 -0.0058,-2.465756 C 71.628568,1.1847953 70.717221,0.56890065 69.514877,0.500286 68.923624,0.4665455 68.321766,0.541079 68.007952,0.68690189 Z M 66.527529,44.086991 c 0,8.307237 0.03736,9.747115 0.264202,10.185789 0.556264,1.075705 0.0757,1.039304 13.720562,1.039304 11.825221,0 12.448695,-0.01559 12.722813,-0.318512 0.158534,-0.175172 0.288242,-0.432111 0.288242,-0.570973 0,-0.138852 -0.615433,-1.3588 -1.367625,-2.710971 -0.752192,-1.352182 -1.420107,-2.595282 -1.484254,-2.762444 -0.07801,-0.203371 0.374467,-1.207564 1.367624,-3.035032 0.816339,-1.502109 1.484255,-2.850609 1.484255,-2.996669 0,-0.14607 -0.143329,-0.395277 -0.318503,-0.553811 C 92.915961,42.102228 91.919742,42.07542 82.493599,42.07542 H 72.100865 v -3.831664 -3.831664 h -2.786668 -2.786668 z"
id="path1038" /></g></svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg4"
sodipodi:docname="threaded-view.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="21.666667"
inkscape:cx="12.023077"
inkscape:cy="12.023077"
inkscape:window-width="1366"
inkscape:window-height="705"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4">
<inkscape:grid
type="xygrid"
id="grid1133" />
</sodipodi:namedview>
<path
d="M3,3H9V7H3V3M15,10H21V14H15V10M15,17H21V21H15V17M13,13H7V18H13V20H7L5,20V9H7V11H13V13Z"
id="path2"
style="fill:#039bd5;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB