* Change on the Timers of Network Menu that weren't wroking properlly

* Fixed the context menu position of the Netwok Log


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/ammorais_branch@1340 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
ammorais 2009-07-09 16:12:18 +00:00
parent dbc35c43c0
commit 511e040dcb
5 changed files with 48 additions and 44 deletions

View File

@ -1,9 +1,9 @@
CONFIG += qt gui uic qrc resources uitools release # pluginmgr debug
CONFIG += qt gui uic qrc resources uitools debug_and_release # pluginmgr debug
QT += network xml script
TEMPLATE = app
TARGET = RetroShare
DEFINES *= RS_RELEASE_VERSION
#DEFINES *= RS_RELEASE_VERSION
RCC_DIR = temp/qrc
UI_DIR = temp/ui
MOC_DIR = temp/moc
@ -67,17 +67,18 @@ macx {
# On Linux systems that alredy have libssl and libcrypto it is advisable
# to rename the patched version of SSL to something like libsslxpgp.a and libcryptoxpg.a
# comment the next option if you renamed libcrtypto and libssl
LIBS += -L"../../../../lib" -lretroshare -lminiupnpc -lssl -lcrypto
# uncomment the next option if you renamed libcrtypto and libssl
#LIBS += -L"../../../../lib" -lretroshare -lminiupnpc -lsslxpgp -lcryptoxpgp
# ###########################################
LIBS += -lz -lgpgme
LIBS += -lQtUiTools
CONFIG(debug, debug|release) {
LIBS += -L"../../../../../../lib" -lretrosharedebug -lminiupnpc -lsslxpgp -lcryptoxpgp
TARGET = retrosharedebug
}
else {
LIBS += -L"../../../../../../lib" -lretroshare -lminiupnpc -lsslxpgp -lcryptoxpgp
TARGET = retroshare
}
DEPENDPATH += . \
rsiface \
control \

View File

@ -21,6 +21,7 @@
#include <QFile>
#include <QFileInfo>
#include <QCursor>
#include "rshare.h"
#include "common/vmessagebox.h"
@ -114,7 +115,7 @@ NetworkDialog::NetworkDialog(QWidget *parent)
QTreeWidgetItem * headerItem = ui.connecttreeWidget->headerItem();
headerItem->setTextAlignment(0, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(2, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(2, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(4, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(5, Qt::AlignHCenter | Qt::AlignVCenter);
@ -148,16 +149,15 @@ NetworkDialog::NetworkDialog(QWidget *parent)
menu->addAction(ui.actionTabsRounded);
ui.viewButton->setMenu(menu);
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(getNetworkStatus()));
timer->start(100000);
updateNetworkTimer = new QTimer(this);
updateNetworkTimer->start(5000);
connect(updateNetworkTimer, SIGNAL(timeout()), this, SLOT(getNetworkStatus()));
connect(updateNetworkTimer, SIGNAL(timeout()), this, SLOT(updateNetworkStatus()));
QTimer *timer2 = new QTimer(this);
timer2->connect(timer, SIGNAL(timeout()), this, SLOT(updateNetworkStatus()));
timer2->start(1000);
getNetworkStatus();
updateNetworkStatus();
//getNetworkStatus();
//updateNetworkStatus();
//load();
@ -616,7 +616,8 @@ void NetworkDialog::setLogInfo(QString info, QColor color) {
ui.infoLog->clear();
nbLines = 1;
}
ui.infoLog->append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
ui.infoLog->append(QString::fromUtf8("<font color='grey' // XXX: Why mapToGlobal() is not enough?>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
}
void NetworkDialog::on_actionClearLog_triggered() {
@ -628,7 +629,8 @@ void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
QMenu myLogMenu(this);
myLogMenu.addAction(ui.actionClearLog);
// XXX: Why mapToGlobal() is not enough?
myLogMenu.exec(mapToGlobal(pos)+QPoint(0,320));
// No. Simple use QCursor::pos() to retrieve the position of the cursor.
myLogMenu.exec(QCursor::pos());
}
void NetworkDialog::getNetworkStatus()

View File

@ -87,28 +87,28 @@ private slots:
private:
QTreeWidgetItem *getCurrentNeighbour();
QTreeWidgetItem *getCurrentNeighbour();
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* peerdetailsAct;
QAction* denyFriendAct;
QAction* deleteCertAct;
QAction* makefriendAct;
QAction* authAct;
QAction* loadcertAct;
QTimer* updateNetworkTimer;
/* connection dialog */
ConnectDialog *connectdialog;
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* peerdetailsAct;
QAction* denyFriendAct;
QAction* deleteCertAct;
QAction* makefriendAct;
QAction* authAct;
QAction* loadcertAct;
/* connection dialog */
ConnectDialog *connectdialog;
QTreeWidget *connecttreeWidget;
QTreeWidget *connecttreeWidget;
class NetworkView *networkview;
class NetworkView *networkview;
/** Qt Designer generated object */
Ui::NetworkDialog ui;
/** Qt Designer generated object */
Ui::NetworkDialog ui;
};
#endif

View File

@ -194,7 +194,7 @@ int main(int argc, char *argv[])
/* Startup a Timer to keep the gui's updated */
QTimer *timer = new QTimer(w);
timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI()));
timer->start(1000);
timer->start(1000);
/* dive into the endless loop */
// return ret;

View File

@ -164,14 +164,15 @@ void NotifyQt::UpdateGUI()
static time_t lastTs = 0;
// std::cerr << "Got update signal t=" << lastTs << std::endl ;
time_t currentTime = time(NULL);
if (time(NULL) > lastTs) // always update, every 1 sec.
if (currentTime > lastTs) // always update, every 1 sec.
{
emit transfersChanged();
emit friendsChanged() ;
}
if (time(NULL) > lastTs + 5) // update every 5 seconds. I don't know what to do with these.
if (currentTime >= lastTs + 5) // update every 5 seconds. I don't know what to do with these.
{
// displayChannels();
}