From 511e040dcba901df68e5fb3e96f23f402d073012 Mon Sep 17 00:00:00 2001 From: ammorais Date: Thu, 9 Jul 2009 16:12:18 +0000 Subject: [PATCH] * 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 --- retroshare-gui/src/RetroShare.pro | 23 +++++++-------- retroshare-gui/src/gui/NetworkDialog.cpp | 26 +++++++++-------- retroshare-gui/src/gui/NetworkDialog.h | 36 ++++++++++++------------ retroshare-gui/src/main.cpp | 2 +- retroshare-gui/src/rsiface/notifyqt.cpp | 5 ++-- 5 files changed, 48 insertions(+), 44 deletions(-) diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 6463ed7bf..ea3604ea8 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -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 \ diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index f815357b5..2ad2a0068 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -21,6 +21,7 @@ #include #include +#include #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("")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8(" - ") + info + QString::fromUtf8("")); + ui.infoLog->append(QString::fromUtf8("")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8(" - ") + info + QString::fromUtf8("")); + } 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() diff --git a/retroshare-gui/src/gui/NetworkDialog.h b/retroshare-gui/src/gui/NetworkDialog.h index df0530714..2d1e6db78 100644 --- a/retroshare-gui/src/gui/NetworkDialog.h +++ b/retroshare-gui/src/gui/NetworkDialog.h @@ -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 diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index 231444f69..5cb587547 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -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; diff --git a/retroshare-gui/src/rsiface/notifyqt.cpp b/retroshare-gui/src/rsiface/notifyqt.cpp index 5598940c0..08b4a19d2 100644 --- a/retroshare-gui/src/rsiface/notifyqt.cpp +++ b/retroshare-gui/src/rsiface/notifyqt.cpp @@ -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(); }