mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-29 11:26:09 -04:00
Added to store last used page for post creation
Added to store last used page for post creation
This commit is contained in:
parent
48e8dc5c8c
commit
bedd2d36d4
@ -22,6 +22,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
|
||||||
#include "PostedCreatePostDialog.h"
|
#include "PostedCreatePostDialog.h"
|
||||||
#include "ui_PostedCreatePostDialog.h"
|
#include "ui_PostedCreatePostDialog.h"
|
||||||
|
|
||||||
@ -35,10 +37,13 @@
|
|||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <gui/RetroShareLink.h>
|
||||||
#include <util/imageutil.h>
|
#include <util/imageutil.h>
|
||||||
|
|
||||||
#include <gui/RetroShareLink.h>
|
/* View Page */
|
||||||
|
#define VIEW_POST 1
|
||||||
|
#define VIEW_IMAGE 2
|
||||||
|
#define VIEW_LINK 3
|
||||||
|
|
||||||
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
|
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
|
||||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
||||||
@ -67,6 +72,16 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
|
|||||||
/* fill in the available OwnIds for signing */
|
/* fill in the available OwnIds for signing */
|
||||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||||
|
|
||||||
|
QSignalMapper *signalMapper = new QSignalMapper(this);
|
||||||
|
connect(ui->postButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
|
||||||
|
connect(ui->imageButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
|
||||||
|
connect(ui->linkButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
|
||||||
|
|
||||||
|
signalMapper->setMapping(ui->postButton, VIEW_POST);
|
||||||
|
signalMapper->setMapping(ui->imageButton, VIEW_IMAGE);
|
||||||
|
signalMapper->setMapping(ui->linkButton, VIEW_LINK);
|
||||||
|
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(setPage(int)));
|
||||||
|
|
||||||
ui->removeButton->hide();
|
ui->removeButton->hide();
|
||||||
|
|
||||||
/* load settings */
|
/* load settings */
|
||||||
@ -93,11 +108,17 @@ void PostedCreatePostDialog::processSettings(bool load)
|
|||||||
// state of ID Chooser combobox
|
// state of ID Chooser combobox
|
||||||
int index = Settings->value("IDChooser", 0).toInt();
|
int index = Settings->value("IDChooser", 0).toInt();
|
||||||
ui->idChooser->setCurrentIndex(index);
|
ui->idChooser->setCurrentIndex(index);
|
||||||
|
|
||||||
|
// load last used Stacked Page
|
||||||
|
setPage(Settings->value("viewPage", VIEW_POST).toInt());
|
||||||
} else {
|
} else {
|
||||||
// save settings
|
// save settings
|
||||||
|
|
||||||
// state of ID Chooser combobox
|
// state of ID Chooser combobox
|
||||||
Settings->setValue("IDChooser", ui->idChooser->currentIndex());
|
Settings->setValue("IDChooser", ui->idChooser->currentIndex());
|
||||||
|
|
||||||
|
// store last used Page
|
||||||
|
Settings->setValue("viewPage", viewMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
@ -222,19 +243,51 @@ void PostedCreatePostDialog::addPicture()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostedCreatePostDialog::on_postButton_clicked()
|
int PostedCreatePostDialog::viewMode()
|
||||||
{
|
{
|
||||||
|
if (ui->postButton->isChecked()) {
|
||||||
|
return VIEW_POST;
|
||||||
|
} else if (ui->imageButton->isChecked()) {
|
||||||
|
return VIEW_IMAGE;
|
||||||
|
} else if (ui->linkButton->isChecked()) {
|
||||||
|
return VIEW_LINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Default */
|
||||||
|
return VIEW_POST;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedCreatePostDialog::setPage(int viewMode)
|
||||||
|
{
|
||||||
|
switch (viewMode) {
|
||||||
|
case VIEW_POST:
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
}
|
|
||||||
|
|
||||||
void PostedCreatePostDialog::on_imageButton_clicked()
|
ui->postButton->setChecked(true);
|
||||||
{
|
ui->imageButton->setChecked(false);
|
||||||
|
ui->linkButton->setChecked(false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case VIEW_IMAGE:
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
}
|
|
||||||
|
|
||||||
void PostedCreatePostDialog::on_linkButton_clicked()
|
ui->imageButton->setChecked(true);
|
||||||
{
|
ui->postButton->setChecked(false);
|
||||||
|
ui->linkButton->setChecked(false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case VIEW_LINK:
|
||||||
ui->stackedWidget->setCurrentIndex(2);
|
ui->stackedWidget->setCurrentIndex(2);
|
||||||
|
|
||||||
|
ui->linkButton->setChecked(true);
|
||||||
|
ui->postButton->setChecked(false);
|
||||||
|
ui->imageButton->setChecked(false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setPage(VIEW_POST);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostedCreatePostDialog::on_removeButton_clicked()
|
void PostedCreatePostDialog::on_removeButton_clicked()
|
||||||
|
@ -52,14 +52,13 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void createPost();
|
void createPost();
|
||||||
void addPicture();
|
void addPicture();
|
||||||
void on_postButton_clicked();
|
|
||||||
void on_imageButton_clicked();
|
|
||||||
void on_linkButton_clicked();
|
|
||||||
void on_removeButton_clicked();
|
void on_removeButton_clicked();
|
||||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||||
|
|
||||||
|
void setPage(int viewMode);
|
||||||
private:
|
private:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
int viewMode();
|
||||||
|
|
||||||
QString mLink;
|
QString mLink;
|
||||||
QString mNotes;
|
QString mNotes;
|
||||||
|
@ -246,36 +246,7 @@
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="1" column="2">
|
||||||
<widget class="QLabel" name="imageLabel">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>800</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>188</width>
|
|
||||||
<height>17</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QToolButton" name="removeButton">
|
<widget class="QToolButton" name="removeButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Remove image</string>
|
<string>Remove image</string>
|
||||||
@ -295,6 +266,42 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>188</width>
|
||||||
|
<height>17</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="shareimagecheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Share Orginal Image</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="3">
|
||||||
|
<widget class="QLabel" name="imageLabel">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>800</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -418,6 +425,9 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -435,6 +445,15 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="default">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -452,6 +471,12 @@
|
|||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user