mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 13:30:36 -04:00
Added Forum Details Dialog
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1961 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
45d96a6e55
commit
65b35e8c53
5 changed files with 362 additions and 3 deletions
137
retroshare-gui/src/gui/forums/ForumDetails.cpp
Normal file
137
retroshare-gui/src/gui/forums/ForumDetails.cpp
Normal file
|
@ -0,0 +1,137 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include "ForumDetails.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsdisc.h"
|
||||
#include "rsiface/rsforums.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
/** Default constructor */
|
||||
ForumDetails::ForumDetails(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
|
||||
|
||||
ui.applyButton->setToolTip(tr("Apply and Close"));
|
||||
|
||||
ui.nameline ->setReadOnly(true);
|
||||
ui.popline ->setReadOnly(true);
|
||||
ui.postline ->setReadOnly(true);
|
||||
ui.IDline ->setReadOnly(true);
|
||||
ui.DescriptiontextEdit ->setReadOnly(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Overloads the default show() slot so we can set opacity*/
|
||||
|
||||
void
|
||||
ForumDetails::show()
|
||||
{
|
||||
//loadSettings();
|
||||
if(!this->isVisible()) {
|
||||
QDialog::show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ForumDetails::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void ForumDetails::closeinfodlg()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void ForumDetails::showDetails(std::string mCurrForumId)
|
||||
{
|
||||
fId = mCurrForumId;
|
||||
loadDialog();
|
||||
}
|
||||
|
||||
void ForumDetails::loadDialog()
|
||||
{
|
||||
|
||||
std::list<ForumInfo>::iterator it;
|
||||
|
||||
if (!rsForums)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ForumInfo fi;
|
||||
rsForums->getForumInfo(fId, fi);
|
||||
|
||||
// Set Forum Name
|
||||
ui.nameline->setText(QString::fromStdWString(fi.forumName));
|
||||
|
||||
// Set Popularity
|
||||
/*{
|
||||
std::ostringstream out;
|
||||
out << it->pop;
|
||||
ui.popline -> setText(QString::fromStdString(out.str()));
|
||||
}*/
|
||||
|
||||
// Set Last Post Date
|
||||
/*{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(it->lastPost);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
ui.postline -> setText(timestamp);
|
||||
}*/
|
||||
|
||||
// Set Forum ID
|
||||
ui.IDline->setText(QString::fromStdString(fi.forumId));
|
||||
|
||||
// Set Forum Description
|
||||
ui.DescriptiontextEdit->setText(QString::fromStdWString(fi.forumDesc));
|
||||
|
||||
}
|
||||
|
||||
void ForumDetails::applyDialog()
|
||||
{
|
||||
|
||||
/* reload now */
|
||||
loadDialog();
|
||||
|
||||
/* close the Dialog after the Changes applied */
|
||||
closeinfodlg();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue