mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 14:41:04 -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
3 changed files with 120 additions and 43 deletions
|
@ -22,6 +22,8 @@
|
|||
#include <QMessageBox>
|
||||
#include <QByteArray>
|
||||
#include <QStringList>
|
||||
#include <QSignalMapper>
|
||||
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "ui_PostedCreatePostDialog.h"
|
||||
|
||||
|
@ -35,10 +37,13 @@
|
|||
#include <QBuffer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gui/RetroShareLink.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):
|
||||
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 */
|
||||
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();
|
||||
|
||||
/* load settings */
|
||||
|
@ -93,11 +108,17 @@ void PostedCreatePostDialog::processSettings(bool load)
|
|||
// state of ID Chooser combobox
|
||||
int index = Settings->value("IDChooser", 0).toInt();
|
||||
ui->idChooser->setCurrentIndex(index);
|
||||
|
||||
// load last used Stacked Page
|
||||
setPage(Settings->value("viewPage", VIEW_POST).toInt());
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of ID Chooser combobox
|
||||
Settings->setValue("IDChooser", ui->idChooser->currentIndex());
|
||||
|
||||
// store last used Page
|
||||
Settings->setValue("viewPage", viewMode());
|
||||
}
|
||||
|
||||
Settings->endGroup();
|
||||
|
@ -222,19 +243,51 @@ void PostedCreatePostDialog::addPicture()
|
|||
|
||||
}
|
||||
|
||||
void PostedCreatePostDialog::on_postButton_clicked()
|
||||
int PostedCreatePostDialog::viewMode()
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
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::on_imageButton_clicked()
|
||||
void PostedCreatePostDialog::setPage(int viewMode)
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
}
|
||||
switch (viewMode) {
|
||||
case VIEW_POST:
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
|
||||
void PostedCreatePostDialog::on_linkButton_clicked()
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(2);
|
||||
ui->postButton->setChecked(true);
|
||||
ui->imageButton->setChecked(false);
|
||||
ui->linkButton->setChecked(false);
|
||||
|
||||
break;
|
||||
case VIEW_IMAGE:
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
|
||||
ui->imageButton->setChecked(true);
|
||||
ui->postButton->setChecked(false);
|
||||
ui->linkButton->setChecked(false);
|
||||
|
||||
break;
|
||||
case VIEW_LINK:
|
||||
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue