* Fixed Create Forum Message Dialog

* Fixed some Displaying isues for statusbar


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@846 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-11-27 23:59:08 +00:00
parent 99c038a4db
commit 74104d71e7
4 changed files with 181 additions and 60 deletions

View File

@ -242,8 +242,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#else
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
toolAct = ui.toolBarservice->toggleViewAction();
toolAct->setText("Service");
toolAct = ui.toolBarservice->toggleViewAction();
toolAct->setText("Service");
toolAct->setShortcut(tr("Ctrl+T"));
toolAct->setIcon(QIcon(":/images/blockdevice2.png"));
//ui.toolBar->addAction(toolAct);
@ -282,7 +282,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#endif
peerstatus = new PeerStatus();
statusBar()->addWidget(peerstatus);
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 | <strong>Up:</strong> 0.00 ")));
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
//servicegrp->actions()[0]->setChecked(true);
@ -715,16 +715,16 @@ void MainWindow::showHelpDialog(const QString &topic)
helpBrowser->showWindow(topic);
}
void MainWindow::setStyle()
{
QString standardSheet = "{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 <color1>, stop:1 <color2>);}";
QColor stop1 = QColorDialog::getColor(Qt::white);
QColor stop2 = QColorDialog::getColor(Qt::black);
//QString widgetSheet = ".QWidget" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
QString toolSheet = "QToolBar" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
QString menuSheet = "QMenuBar" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
qApp->setStyleSheet(/*widgetSheet + */toolSheet + menuSheet);
void MainWindow::setStyle()
{
QString standardSheet = "{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 <color1>, stop:1 <color2>);}";
QColor stop1 = QColorDialog::getColor(Qt::white);
QColor stop2 = QColorDialog::getColor(Qt::black);
//QString widgetSheet = ".QWidget" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
QString toolSheet = "QToolBar" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
QString menuSheet = "QMenuBar" + standardSheet.replace("<color1>", stop1.name()).replace("<color2>", stop2.name());
qApp->setStyleSheet(/*widgetSheet + */toolSheet + menuSheet);
}
/** Creates and displays the Configuration dialog with the current page set to

View File

@ -50,14 +50,22 @@
#include <QTextDocumentFragment>
/** Constructor */
CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
: QMainWindow(NULL), mForumId(fId), mParentId(pId)
CreateForumMsg::CreateForumMsg(std::string fId, std::string pId, QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags), mForumId(fId), mParentId(pId)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setupFileActions();
setupEditActions();
setupViewActions();
setupInsertActions();
RshareSettings config;
config.loadWidgetInformation(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
// connect up the buttons.
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) );
@ -520,3 +528,105 @@ bool CreateForumMsg::maybeSave()
return true;
}
void CreateForumMsg::setupFileActions()
{
QMenu *menu = new QMenu(tr("&File"), this);
menuBar()->addMenu(menu);
QAction *a;
a = new QAction(QIcon(":/images/textedit/filenew.png"), tr("&New"), this);
a->setShortcut(QKeySequence::New);
connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
menu->addAction(a);
a = new QAction(QIcon(":/images/textedit/fileopen.png"), tr("&Open..."), this);
a->setShortcut(QKeySequence::Open);
connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
menu->addAction(a);
menu->addSeparator();
actionSave = a = new QAction(QIcon(":/images/textedit/filesave.png"), tr("&Save"), this);
a->setShortcut(QKeySequence::Save);
connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
a->setEnabled(false);
menu->addAction(a);
a = new QAction(tr("Save &As..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
menu->addAction(a);
menu->addSeparator();
a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("&Print..."), this);
a->setShortcut(QKeySequence::Print);
connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
menu->addAction(a);
/*a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
menu->addAction(a);*/
a = new QAction(QIcon(":/images/textedit/exportpdf.png"), tr("&Export PDF..."), this);
a->setShortcut(Qt::CTRL + Qt::Key_D);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
menu->addAction(a);
menu->addSeparator();
a = new QAction(tr("&Quit"), this);
a->setShortcut(Qt::CTRL + Qt::Key_Q);
connect(a, SIGNAL(triggered()), this, SLOT(close()));
menu->addAction(a);
}
void CreateForumMsg::setupEditActions()
{
QMenu *menu = new QMenu(tr("&Edit"), this);
menuBar()->addMenu(menu);
QAction *a;
a = actionUndo = new QAction(QIcon(":/images/textedit/editundo.png"), tr("&Undo"), this);
a->setShortcut(QKeySequence::Undo);
menu->addAction(a);
a = actionRedo = new QAction(QIcon(":/images/textedit/editredo.png"), tr("&Redo"), this);
a->setShortcut(QKeySequence::Redo);
menu->addAction(a);
menu->addSeparator();
a = actionCut = new QAction(QIcon(":/images/textedit/editcut.png"), tr("Cu&t"), this);
a->setShortcut(QKeySequence::Cut);
menu->addAction(a);
a = actionCopy = new QAction(QIcon(":/images/textedit/editcopy.png"), tr("&Copy"), this);
a->setShortcut(QKeySequence::Copy);
menu->addAction(a);
a = actionPaste = new QAction(QIcon(":/images/textedit/editpaste.png"), tr("&Paste"), this);
a->setShortcut(QKeySequence::Paste);
menu->addAction(a);
actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
}
void CreateForumMsg::setupViewActions()
{
QMenu *menu = new QMenu(tr("&View"), this);
menuBar()->addMenu(menu);
QAction *a;
a = new QAction(QIcon(""), tr("&Contacts Sidebar"), this);
connect(a, SIGNAL(triggered()), this, SLOT(toggleContacts()));
menu->addAction(a);
}
void CreateForumMsg::setupInsertActions()
{
QMenu *menu = new QMenu(tr("&Insert"), this);
menuBar()->addMenu(menu);
QAction *a;
a = new QAction(QIcon(""), tr("&Image"), this);
connect(a, SIGNAL(triggered()), this, SLOT(addImage()));
menu->addAction(a);
}

View File

@ -24,6 +24,7 @@
#define _CREATE_FORUM_MSG_DIALOG_H
#include <QWidget>
#include <QMainWindow>
#include <string>
#include "ui_CreateForumMsg.h"
@ -39,15 +40,19 @@ class CreateForumMsg : public QMainWindow
Q_OBJECT
public:
CreateForumMsg(std::string fId, std::string pId);
CreateForumMsg(std::string fId, std::string pId, QWidget *parent = 0, Qt::WFlags flags = 0);
void newMsg(); /* cleanup */
public slots:
void createMsg();
void cancelMsg();
private slots:
/* actions to take.... */
void createMsg();
void cancelMsg();
void fileNew();
void fileOpen();
@ -77,6 +82,12 @@ private:
std::string mForumId;
std::string mParentId;
void setTextColor(const QColor& col) ;
void setupFileActions();
void setupEditActions();
void setupViewActions();
void setupInsertActions();
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
void fontChanged(const QFont &f);
void colorChanged(const QColor &c);

View File

@ -17,48 +17,48 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "peerstatus.h"
****************************************************************/
#include "peerstatus.h"
#include <QtGui>
#include <QString>
#include <QLayout>
#include <QLabel>
#include <QIcon>
#include <QPainter>
#include <QPixmap>
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <sstream>
#include <iomanip>
PeerStatus::PeerStatus(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0);
hbox->setSpacing(6);
iconLabel = new QLabel( this );
iconLabel->setPixmap(QPixmap::QPixmap(":/images/user/identity16.png"));
// iconLabel doesn't change over time, so we didn't need a minimum size
hbox->addWidget(iconLabel);
statusPeers = new QLabel( tr("Online: 0 |Friends: 0|Network: 0"), this );
//statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusPeers);
setLayout( hbox );
}
PeerStatus::~PeerStatus()
{
}
#include <QLayout>
#include <QLabel>
#include <QIcon>
#include <QPainter>
#include <QPixmap>
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <sstream>
#include <iomanip>
PeerStatus::PeerStatus(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0);
hbox->setSpacing(6);
iconLabel = new QLabel( this );
iconLabel->setPixmap(QPixmap::QPixmap(":/images/user/identity16.png"));
// iconLabel doesn't change over time, so we didn't need a minimum size
hbox->addWidget(iconLabel);
statusPeers = new QLabel( tr("Online: 0 | Friends: 0 | Network: 0 "), this );
//statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusPeers);
setLayout( hbox );
}
PeerStatus::~PeerStatus()
{
}
void PeerStatus::setPeerStatus()
{
/* set users/friends/network */
@ -82,6 +82,6 @@ void PeerStatus::setPeerStatus()
if (statusPeers)
statusPeers -> setText(QString::fromStdString(out2.str()));
}
}