mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 00:53:58 -05:00
Improved the notification model so that it uses Qt signals to avoid core dumps, and improved the gui to increase responsiveness (e.g. forum display, network discovery info, friends, msg deletion and selection)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1050 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
93fa052b58
commit
59cdaba9dc
25 changed files with 298 additions and 292 deletions
|
|
@ -85,7 +85,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||
// SLOT( changedThread( QTreeWidgetItem *, QTreeWidgetItem * ) ) );
|
||||
|
||||
connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread2() ) );
|
||||
connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( changedThread2() ) );
|
||||
connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( insertThreads() ) );
|
||||
|
||||
connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ public:
|
|||
ForumsDialog(QWidget *parent = 0);
|
||||
|
||||
void insertForums();
|
||||
void insertThreads();
|
||||
void insertPost();
|
||||
|
||||
private slots:
|
||||
|
||||
void insertThreads();
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumListCustomPopupMenu( QPoint point );
|
||||
void threadListCustomPopupMenu( QPoint point );
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
|
||||
connect( ui.msgWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.msgWidget, SIGNAL( itemClicked ( QTreeWidgetItem *, int) ), this, SLOT( updateMessages ( QTreeWidgetItem *, int) ) );
|
||||
connect( ui.msgWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *,QTreeWidgetItem * ) ), this, SLOT( updateCurrentMessage( QTreeWidgetItem *, QTreeWidgetItem *) ) );
|
||||
connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) );
|
||||
|
||||
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
|
||||
|
|
@ -448,11 +448,9 @@ void MessagesDialog::getallrecommended()
|
|||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::changeBox( int newrow )
|
||||
void MessagesDialog::changeBox(int)
|
||||
{
|
||||
//std::cerr << "MessagesDialog::changeBox()" << std::endl;
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
insertMessages(); // show current msg list
|
||||
}
|
||||
|
||||
void MessagesDialog::insertMessages()
|
||||
|
|
@ -463,7 +461,7 @@ void MessagesDialog::insertMessages()
|
|||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *msgWidget = ui.msgWidget;
|
||||
QTreeWidget *msgWidget = ui.msgWidget;
|
||||
|
||||
/* get the MsgId of the current one ... */
|
||||
|
||||
|
|
@ -500,7 +498,7 @@ void MessagesDialog::insertMessages()
|
|||
break;
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
/* check the message flags, to decide which
|
||||
|
|
@ -529,7 +527,7 @@ void MessagesDialog::insertMessages()
|
|||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
/* So Text should be:
|
||||
* (1) Msg / Broadcast
|
||||
|
|
@ -581,7 +579,7 @@ void MessagesDialog::insertMessages()
|
|||
QFont qf = item->font(i);
|
||||
qf.setBold(true);
|
||||
item->setFont(i, qf);
|
||||
item -> setIcon(2, (QIcon(":/images/message-mail.png")));
|
||||
item -> setIcon(2, (QIcon(":/images/message-mail.png")));
|
||||
|
||||
//std::cerr << "Setting Item BOLD!" << std::endl;
|
||||
}
|
||||
|
|
@ -601,12 +599,27 @@ void MessagesDialog::insertMessages()
|
|||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::updateMessages( QTreeWidgetItem * item, int column )
|
||||
void MessagesDialog::updateCurrentMessage( QTreeWidgetItem *item , QTreeWidgetItem * )
|
||||
{
|
||||
//std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
|
||||
insertMsgTxtAndFiles();
|
||||
setMsgAsRead(item) ;
|
||||
}
|
||||
|
||||
void MessagesDialog::setMsgAsRead(QTreeWidgetItem *item)
|
||||
{
|
||||
if(item == NULL)
|
||||
return ;
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
QFont qf = item->font(i);
|
||||
qf.setBold(false);
|
||||
item->setFont(i, qf);
|
||||
}
|
||||
|
||||
std::string mid(item->text(5).toStdString());
|
||||
rsMsgs->MessageRead(mid);
|
||||
}
|
||||
|
||||
void MessagesDialog::insertMsgTxtAndFiles()
|
||||
{
|
||||
|
|
@ -654,7 +667,7 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
|||
return;
|
||||
}
|
||||
|
||||
const std::list<FileInfo> &recList = msgInfo.files;
|
||||
const std::list<FileInfo> &recList = msgInfo.files;
|
||||
std::list<FileInfo>::const_iterator it;
|
||||
|
||||
/* get a link to the table */
|
||||
|
|
@ -662,18 +675,18 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
|||
|
||||
/* get the MessageInfo */
|
||||
|
||||
tree->clear();
|
||||
tree->setColumnCount(5);
|
||||
tree->clear();
|
||||
tree->setColumnCount(5);
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = recList.begin(); it != recList.end(); it++)
|
||||
{
|
||||
/* make a widget per person */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
/* (0) Filename */
|
||||
item -> setText(0, QString::fromStdString(it->fname));
|
||||
//std::cerr << "Msg FileItem(" << it->fname.length() << ") :" << it->fname << std::endl;
|
||||
|
||||
|
||||
/* (1) Size */
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
|
@ -686,9 +699,9 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
|||
out << it->rank;
|
||||
item -> setText(2, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
|
||||
item -> setText(3, QString::fromStdString(it->hash));
|
||||
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
|
@ -747,12 +760,8 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
|||
}
|
||||
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
|
||||
|
||||
/* finally mark message as read! */
|
||||
rsMsgs -> MessageRead(mid);
|
||||
}
|
||||
|
||||
|
||||
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
||||
{
|
||||
/* Locate the current Message */
|
||||
|
|
@ -774,39 +783,21 @@ bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
|||
|
||||
void MessagesDialog::removemessage()
|
||||
{
|
||||
#ifdef TO_REMOVE
|
||||
//std::cerr << "MessagesDialog::removemessage()" << std::endl;
|
||||
std::string cid, mid;
|
||||
if (!getCurrentMsg(cid, mid))
|
||||
{
|
||||
//std::cerr << "MessagesDialog::removemessage()";
|
||||
//std::cerr << " No Message selected" << std::endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
QList<QTreeWidgetItem*> list(ui.msgWidget->selectedItems()) ;
|
||||
|
||||
int maxrow = -1 ;
|
||||
for(QList<QTreeWidgetItem*>::const_iterator it(list.begin());it!=list.end();++it)
|
||||
maxrow = std::max(maxrow,ui.msgWidget->indexOfTopLevelItem(*it)) ;
|
||||
|
||||
QTreeWidgetItem *next = ui.msgWidget->topLevelItem(maxrow+1) ;
|
||||
|
||||
for(QList<QTreeWidgetItem*>::const_iterator it(list.begin());it!=list.end();++it)
|
||||
rsMsgs->MessageDelete((*it)->text(5).toStdString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void MessagesDialog::markMsgAsRead()
|
||||
{
|
||||
//std::cerr << "MessagesDialog::markMsgAsRead()" << std::endl;
|
||||
std::string cid, mid;
|
||||
if (!getCurrentMsg(cid, mid))
|
||||
{
|
||||
//std::cerr << "MessagesDialog::markMsgAsRead()";
|
||||
//std::cerr << " No Message selected" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
rsMsgs -> MessageRead(mid);
|
||||
if(next != NULL)
|
||||
ui.msgWidget->setCurrentItem(next) ;
|
||||
|
||||
insertMessages();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,21 +35,19 @@ public:
|
|||
/** Default Constructor */
|
||||
MessagesDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
|
||||
void insertMessages();
|
||||
void insertMsgTxtAndFiles();
|
||||
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent *) ;
|
||||
|
||||
public slots:
|
||||
void insertMessages();
|
||||
private slots:
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void messageslistWidgetCostumPopupMenu( QPoint point );
|
||||
void msgfilelistWidgetCostumPopupMenu(QPoint);
|
||||
|
||||
void changeBox( int newrow );
|
||||
void updateMessages ( QTreeWidgetItem * item, int column );
|
||||
void changeBox( int newrow );
|
||||
void updateCurrentMessage ( QTreeWidgetItem * item, QTreeWidgetItem * item2 );
|
||||
|
||||
void newmessage();
|
||||
|
||||
|
|
@ -61,7 +59,6 @@ void updateMessages ( QTreeWidgetItem * item, int column );
|
|||
void printpreview();
|
||||
|
||||
void removemessage();
|
||||
void markMsgAsRead();
|
||||
|
||||
void getcurrentrecommended();
|
||||
void getallrecommended();
|
||||
|
|
@ -72,6 +69,7 @@ void updateMessages ( QTreeWidgetItem * item, int column );
|
|||
private:
|
||||
|
||||
bool getCurrentMsg(std::string &cid, std::string &mid);
|
||||
void setMsgAsRead(QTreeWidgetItem *);
|
||||
|
||||
std::string mCurrCertId;
|
||||
std::string mCurrMsgId;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ public:
|
|||
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertPeers();
|
||||
void setChatDialog(PeersDialog *cd);
|
||||
|
||||
NetworkDialog *networkDialog2;
|
||||
|
|
@ -51,6 +50,7 @@ public:
|
|||
|
||||
|
||||
public slots:
|
||||
void insertPeers();
|
||||
/** Called when this dialog is to be displayed */
|
||||
void show();
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ public:
|
|||
NetworkDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertConnect();
|
||||
void showpeerdetails(std::string id);
|
||||
|
||||
public slots:
|
||||
void insertConnect();
|
||||
std::string loadneighbour();
|
||||
/* void loadneighbour(); */
|
||||
void setLogInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
|
|
|
|||
|
|
@ -48,13 +48,11 @@ public:
|
|||
void clearOldChats();
|
||||
|
||||
void loadEmoticonsgroupchat();
|
||||
|
||||
void insertPeers();
|
||||
|
||||
void setChatDialog(ChatDialog *cd);
|
||||
|
||||
public slots:
|
||||
|
||||
void insertPeers();
|
||||
void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
|
||||
void insertChat();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
DLDelegate = new DLListDelegate();
|
||||
ui.downloadList->setItemDelegate(DLDelegate);
|
||||
|
||||
ui.downloadList->setAutoScroll(false) ;
|
||||
|
||||
//Selection Setup
|
||||
selection = ui.downloadList->selectionModel();
|
||||
|
|
@ -108,6 +109,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
ULDelegate = new ULListDelegate();
|
||||
ui.uploadsList->setItemDelegate(ULDelegate);
|
||||
|
||||
ui.uploadsList->setAutoScroll(false) ;
|
||||
ui.uploadsList->setRootIsDecorated(false);
|
||||
|
||||
//Selection Setup
|
||||
|
|
|
|||
|
|
@ -39,35 +39,33 @@ class QStandardItemModel;
|
|||
|
||||
class TransfersDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
TransfersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~TransfersDialog();
|
||||
public:
|
||||
/** Default Constructor */
|
||||
TransfersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~TransfersDialog();
|
||||
|
||||
public slots:
|
||||
void insertTransfers();
|
||||
|
||||
private slots:
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void downloadListCostumPopupMenu( QPoint point );
|
||||
|
||||
void insertTransfers();
|
||||
void cancel();
|
||||
/** removes finished Downloads**/
|
||||
void clearcompleted();
|
||||
void playSelectedTransfer();
|
||||
|
||||
private slots:
|
||||
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void downloadListCostumPopupMenu( QPoint point );
|
||||
|
||||
void cancel();
|
||||
/** removes finished Downloads**/
|
||||
void clearcompleted();
|
||||
void playSelectedTransfer();
|
||||
signals:
|
||||
void playFiles(QStringList files);
|
||||
|
||||
signals:
|
||||
void playFiles(QStringList files);
|
||||
|
||||
private:
|
||||
QStandardItemModel *DLListModel;
|
||||
QStandardItemModel *ULListModel;
|
||||
private:
|
||||
QStandardItemModel *DLListModel;
|
||||
QStandardItemModel *ULListModel;
|
||||
QItemSelectionModel *selection;
|
||||
DLListDelegate *DLDelegate;
|
||||
ULListDelegate *ULDelegate;
|
||||
|
|
@ -78,26 +76,26 @@ private:
|
|||
qlonglong completed, remaining;
|
||||
|
||||
|
||||
/** Create the actions on the tray menu or menubar */
|
||||
void createActions();
|
||||
/** Create the actions on the tray menu or menubar */
|
||||
void createActions();
|
||||
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* showdowninfoAct;
|
||||
QAction* cancelAct;
|
||||
QAction* clearcompletedAct;
|
||||
/** Define the popup menus for the Context menu */
|
||||
QMenu* contextMnu;
|
||||
/** Defines the actions for the context menu */
|
||||
QAction* showdowninfoAct;
|
||||
QAction* cancelAct;
|
||||
QAction* clearcompletedAct;
|
||||
|
||||
QTreeView *downloadList;
|
||||
QTreeView *downloadList;
|
||||
|
||||
/** Adds a new action to the toolbar. */
|
||||
void addAction(QAction *action, const char *slot = 0);
|
||||
/** Adds a new action to the toolbar. */
|
||||
void addAction(QAction *action, const char *slot = 0);
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::TransfersDialog ui;
|
||||
|
||||
public slots:
|
||||
int addItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
/** Qt Designer generated object */
|
||||
Ui::TransfersDialog ui;
|
||||
|
||||
public slots:
|
||||
int addItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
void delItem(int row);
|
||||
|
||||
int addUploadItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
|
||||
|
|
@ -105,7 +103,7 @@ public slots:
|
|||
|
||||
void editItem(int row, int column, QVariant data);
|
||||
void updateProgress(int value);
|
||||
|
||||
|
||||
double getProgress(int row, QStandardItemModel *model);
|
||||
double getSpeed(int row, QStandardItemModel *model);
|
||||
QString getFileName(int row, QStandardItemModel *model);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue