Fixing layout issues & added to store ratio combox

* Fixing layout issues
* Added to store/load ratio combox
This commit is contained in:
defnax 2020-09-12 14:08:18 +02:00
parent 96cbbce3b1
commit 14a5c82442
3 changed files with 221 additions and 216 deletions

View File

@ -72,13 +72,18 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&))); connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&)));
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail())); connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool))); connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool)));
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool))); connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool)));
connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int))); connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int)));
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png"));
addfilepushButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-file.png"));
aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg")); aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg"));
aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg")); aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg"));
@ -106,6 +111,9 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
generateCheckBox->hide(); generateCheckBox->hide();
generateSpinBox->hide(); generateSpinBox->hide();
#endif #endif
/* load settings */
processSettings(true);
} }
CreateGxsChannelMsg::~CreateGxsChannelMsg() CreateGxsChannelMsg::~CreateGxsChannelMsg()
@ -114,6 +122,29 @@ CreateGxsChannelMsg::~CreateGxsChannelMsg()
#ifdef CHANNELS_FRAME_CATCHER #ifdef CHANNELS_FRAME_CATCHER
delete fCatcher; delete fCatcher;
#endif #endif
// save settings
processSettings(false);
}
void CreateGxsChannelMsg::processSettings(bool load)
{
Settings->beginGroup(QString("CreateGxsChannelMsg"));
if (load) {
// load settings
// state of Ratio combobox
int index = Settings->value("aspectRatio_CB", 0).toInt();
aspectRatio_CB->setCurrentIndex(index);
} else {
// save settings
// state of Ratio combobox
Settings->setValue("aspectRatio_CB", aspectRatio_CB->currentIndex());
}
Settings->endGroup();
} }
void CreateGxsChannelMsg::changeAspectRatio(int s) void CreateGxsChannelMsg::changeAspectRatio(int s)

View File

@ -72,6 +72,7 @@ private slots:
void on_channelpostButton_clicked(); void on_channelpostButton_clicked();
void on_attachmentsButton_clicked(); void on_attachmentsButton_clicked();
private: private:
void processSettings(bool load);
void loadChannelInfo(); void loadChannelInfo();
void loadOriginalChannelPostInfo(); void loadOriginalChannelPostInfo();
void saveChannelInfo(const RsGroupMetaData &group); void saveChannelInfo(const RsGroupMetaData &group);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>881</width> <width>881</width>
<height>383</height> <height>328</height>
</rect> </rect>
</property> </property>
<property name="acceptDrops"> <property name="acceptDrops">
@ -39,13 +39,6 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QFrame" name="mainFrame"> <widget class="QFrame" name="mainFrame">
<property name="frameShape"> <property name="frameShape">
@ -64,6 +57,19 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="1">
<widget class="QPushButton" name="attachmentsButton">
<property name="text">
<string>Attachments</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3"> <item row="1" column="0" colspan="3">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="mouseTracking"> <property name="mouseTracking">
@ -79,207 +85,188 @@
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="stackedWidgetPage1"> <widget class="QWidget" name="stackedWidgetPage1">
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QGridLayout" name="gridLayout_2">
<item> <property name="leftMargin">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="4">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="ChannelPostThumbnailView" name="preview_W" native="true">
<item> <property name="sizePolicy">
<widget class="ChannelPostThumbnailView" name="preview_W" native="true"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<property name="sizePolicy"> <horstretch>0</horstretch>
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch> </property>
</sizepolicy> </widget>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<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>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <spacer name="verticalSpacer_2">
<property name="spacing"> <property name="orientation">
<number>6</number> <enum>Qt::Vertical</enum>
</property> </property>
<item> <property name="sizeHint" stdset="0">
<layout class="QHBoxLayout" name="channelNameHLayout"> <size>
<property name="topMargin"> <width>20</width>
<number>6</number> <height>1</height>
</property> </size>
<item> </property>
<widget class="QLabel" name="channelNameLabel"> </spacer>
<property name="sizePolicy"> </item>
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> </layout>
<horstretch>0</horstretch> </item>
<verstretch>0</verstretch> <item row="0" column="1">
</sizepolicy> <layout class="QHBoxLayout" name="channelNameHLayout">
</property> <property name="topMargin">
<property name="font"> <number>6</number>
<font> </property>
<weight>75</weight> <item>
<bold>true</bold> <widget class="QLabel" name="channelNameLabel">
</font> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<property name="text"> <horstretch>0</horstretch>
<string>Channel Post to:</string> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="font">
<item> <font>
<widget class="QLineEdit" name="channelName"> <weight>75</weight>
<property name="enabled"> <bold>true</bold>
<bool>true</bool> </font>
</property> </property>
<property name="readOnly"> <property name="text">
<bool>true</bool> <string>Channel Post to:</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item>
</item> <widget class="QLineEdit" name="channelName">
<item> <property name="enabled">
<widget class="QLabel" name="channelAttachLabel"> <bool>true</bool>
<property name="text"> </property>
<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; <property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="channelAttachLabel">
<property name="text">
<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; &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; } 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:'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;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; 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:'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>
</property> </property>
</widget> </widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="addThumbnailButton">
<property name="text">
<string>Add Channel Thumbnail</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="aspectRatio_CB">
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<item>
<property name="text">
<string>Auto</string>
</property>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <property name="text">
<item> <string>1:1</string>
<widget class="QPushButton" name="addThumbnailButton"> </property>
<property name="text">
<string>Add Channel Thumbnail</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/png/add-image.png</normaloff>:/icons/png/add-image.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="aspectRatio_CB">
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>1:1</string>
</property>
</item>
<item>
<property name="text">
<string>3:4</string>
</property>
</item>
<item>
<property name="text">
<string>16:9</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="addfilepushButton">
<property name="text">
<string>Add File to Attach</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <property name="text">
<property name="topMargin"> <string>3:4</string>
<number>9</number> </property>
</property>
<item>
<widget class="QLineEdit" name="subjectEdit">
<property name="placeholderText">
<string>Title</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <property name="text">
<property name="orientation"> <string>16:9</string>
<enum>Qt::Vertical</enum> </property>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </widget>
</item>
<item>
<widget class="QPushButton" name="addfilepushButton">
<property name="text">
<string>Add File to Attach</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="3" column="1">
<widget class="RichTextEdit" name="RichTextEditWidget" native="true"/> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>9</number>
</property>
<item>
<widget class="QLineEdit" name="subjectEdit">
<property name="placeholderText">
<string>Title</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="RichTextEdit" name="RichTextEditWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -342,7 +329,7 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>84</width> <width>842</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
@ -416,23 +403,6 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QPushButton" name="channelpostButton">
<property name="text">
<string>Channel Post</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/png/comment.png</normaloff>:/icons/png/comment.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -446,14 +416,10 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="1"> <item row="0" column="0">
<widget class="QPushButton" name="attachmentsButton"> <widget class="QPushButton" name="channelpostButton">
<property name="text"> <property name="text">
<string>Attachments</string> <string>Channel Post</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/png/attachements.png</normaloff>:/icons/png/attachements.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -500,6 +466,13 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>