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:
defnax 2010-01-02 15:47:07 +00:00
parent 45d96a6e55
commit 65b35e8c53
5 changed files with 362 additions and 3 deletions

View File

@ -134,6 +134,7 @@ HEADERS += rshare.h \
gui/AddLinksDialog.h \ gui/AddLinksDialog.h \
gui/LinksDialog.h \ gui/LinksDialog.h \
gui/ForumsDialog.h \ gui/ForumsDialog.h \
gui/forums/ForumDetails.h \
gui/forums/CreateForum.h \ gui/forums/CreateForum.h \
gui/forums/CreateForumMsg.h \ gui/forums/CreateForumMsg.h \
gui/NetworkView.h \ gui/NetworkView.h \
@ -246,6 +247,7 @@ FORMS += gui/StartDialog.ui \
gui/LinksDialog.ui \ gui/LinksDialog.ui \
gui/forums/CreateForum.ui \ gui/forums/CreateForum.ui \
gui/forums/CreateForumMsg.ui \ gui/forums/CreateForumMsg.ui \
gui/forums/ForumDetails.ui \
gui/NetworkView.ui \ gui/NetworkView.ui \
gui/TrustView.ui \ gui/TrustView.ui \
gui/MessengerWindow.ui \ gui/MessengerWindow.ui \
@ -305,6 +307,7 @@ SOURCES += main.cpp \
gui/MainWindow.cpp \ gui/MainWindow.cpp \
gui/LinksDialog.cpp \ gui/LinksDialog.cpp \
gui/ForumsDialog.cpp \ gui/ForumsDialog.cpp \
gui/forums/ForumDetails.cpp \
gui/forums/CreateForum.cpp \ gui/forums/CreateForum.cpp \
gui/forums/CreateForumMsg.cpp \ gui/forums/CreateForumMsg.cpp \
gui/NetworkView.cpp \ gui/NetworkView.cpp \

View File

@ -23,6 +23,7 @@
#include "ForumsDialog.h" #include "ForumsDialog.h"
#include "gui/forums/CreateForum.h" #include "gui/forums/CreateForum.h"
#include "gui/forums/CreateForumMsg.h" #include "gui/forums/CreateForumMsg.h"
#include "gui/forums/ForumDetails.h"
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
@ -891,8 +892,8 @@ void ForumsDialog::forumSubscribe(bool subscribe)
void ForumsDialog::showForumDetails() void ForumsDialog::showForumDetails()
{ {
#if 0
static ForumDisplay *fui = new ForumDisplay(); static ForumDetails *fui = new ForumDetails();
if (mCurrForumId == "") if (mCurrForumId == "")
{ {
@ -901,7 +902,7 @@ static ForumDisplay *fui = new ForumDisplay();
fui->showDetails(mCurrForumId); fui->showDetails(mCurrForumId);
fui->show(); fui->show();
#endif
} }

View 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();
}

View File

@ -0,0 +1,67 @@
/****************************************************************
* 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.
****************************************************************/
#ifndef _FORUMDETAILS_H
#define _FORUMDETAILS_H
#include <QDialog>
#include "ui_ForumDetails.h"
class ForumDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
ForumDetails(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
void showDetails(std::string mCurrForumId);
signals:
void configChanged() ;
public slots:
/** Overloaded QWidget.show */
void show();
protected:
void closeEvent (QCloseEvent * event);
private slots:
void closeinfodlg();
void applyDialog();
private:
void loadDialog();
std::string fId;
/** Qt Designer generated object */
Ui::ForumDetails ui;
};
#endif

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumDetails</class>
<widget class="QDialog" name="ForumDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>427</width>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
<string>Forum Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/konversation16.png</normaloff>:/images/konversation16.png</iconset>
</attribute>
<attribute name="title">
<string>Forum Details</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Forum Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Forum Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="popline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Last Post</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Forum ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Forum Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="applyButton">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>