From dd0ef691c534463041d4d9126a7b27173851f135 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 22 Apr 2013 21:12:38 +0000 Subject: [PATCH] Fixed online time in profile widget. Fixed width of settings dialog. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6329 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/profile/ProfileWidget.cpp | 3 +- .../src/gui/settings/CryptoPage.cpp | 26 ++----- retroshare-gui/src/gui/settings/CryptoPage.h | 2 - retroshare-gui/src/gui/settings/CryptoPage.ui | 73 ++++++++++++++----- retroshare-gui/src/rshare.cpp | 8 ++ retroshare-gui/src/rshare.h | 4 +- 6 files changed, 76 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/profile/ProfileWidget.cpp b/retroshare-gui/src/gui/profile/ProfileWidget.cpp index b3d091136..ab6747747 100644 --- a/retroshare-gui/src/gui/profile/ProfileWidget.cpp +++ b/retroshare-gui/src/gui/profile/ProfileWidget.cpp @@ -27,6 +27,7 @@ #include "StatusMessage.h" #include "ProfileManager.h" #include "util/DateTime.h" +#include "rshare.h" #include #include @@ -44,7 +45,7 @@ ProfileWidget::ProfileWidget(QWidget *parent, Qt::WFlags flags) connect(ui.CopyCertButton,SIGNAL(clicked()), this, SLOT(copyCert())); connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager())); - ui.onlinesince->setText(DateTime::formatLongDateTime(QDateTime::currentDateTime())); + ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime())); } void ProfileWidget::showEvent ( QShowEvent * /*event*/ ) diff --git a/retroshare-gui/src/gui/settings/CryptoPage.cpp b/retroshare-gui/src/gui/settings/CryptoPage.cpp index 9800377eb..385170d49 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.cpp +++ b/retroshare-gui/src/gui/settings/CryptoPage.cpp @@ -26,6 +26,7 @@ #include #include +#include "rshare.h" #include "CryptoPage.h" #include "util/misc.h" #include "util/DateTime.h" @@ -57,8 +58,9 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags) #endif connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager())); - ui.onlinesince->setText(DateTime::formatLongDateTime(QDateTime::currentDateTime())); + ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime())); } + void CryptoPage::profilemanager() { ProfileManager profilemanager; @@ -111,12 +113,7 @@ void CryptoPage::load() { /* Loads ouer default Puplickey */ - QFont font("Courier New",9,50,false) ; - ui.certtextEdit->setFont(font) ; - - ui.certtextEdit->setPlainText(QString::fromUtf8(rsPeers->GetRetroshareInvite(ui._includeSignatures_CB->isChecked(),ui._useOldFormat_CB->isChecked()).c_str())); - ui.certtextEdit->setReadOnly(true); - ui.certtextEdit->setMinimumHeight(200); + ui.certplainTextEdit->setPlainText(QString::fromUtf8(rsPeers->GetRetroshareInvite(ui._includeSignatures_CB->isChecked(),ui._useOldFormat_CB->isChecked()).c_str())); } void CryptoPage::copyRSLink() @@ -148,7 +145,7 @@ CryptoPage::copyPublicKey() tr("Your Public Key is copied to Clipboard, paste and send it to your" " friend via email or some other way")); QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(ui.certtextEdit->toPlainText()); + clipboard->setText(ui.certplainTextEdit->toPlainText()); } bool CryptoPage::fileSave() @@ -161,8 +158,7 @@ bool CryptoPage::fileSave() return false; QTextStream ts(&file); ts.setCodec(QTextCodec::codecForName("UTF-8")); - ts << ui.certtextEdit->document()->toPlainText(); - ui.certtextEdit->document()->setModified(false); + ts << ui.certplainTextEdit->document()->toPlainText(); return true; } @@ -170,16 +166,8 @@ bool CryptoPage::fileSaveAs() { QString fn; if (misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT, tr("Save as..."), tr("RetroShare Certificate (*.rsc );;All Files (*)"), fn)) { - setCurrentFileName(fn); + fileName = fn; return fileSave(); } return false; } - -void CryptoPage::setCurrentFileName(const QString &fileName) -{ - this->fileName = fileName; - ui.certtextEdit->document()->setModified(false); - - setWindowModified(false); -} diff --git a/retroshare-gui/src/gui/settings/CryptoPage.h b/retroshare-gui/src/gui/settings/CryptoPage.h index 783499549..635a576bc 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.h +++ b/retroshare-gui/src/gui/settings/CryptoPage.h @@ -52,8 +52,6 @@ class CryptoPage : public ConfigPage bool fileSaveAs(); private: - void setCurrentFileName(const QString &fileName); - QString fileName; /** Qt Designer generated object */ diff --git a/retroshare-gui/src/gui/settings/CryptoPage.ui b/retroshare-gui/src/gui/settings/CryptoPage.ui index de6d2becd..46a0e3baa 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.ui +++ b/retroshare-gui/src/gui/settings/CryptoPage.ui @@ -440,17 +440,60 @@ - + - false + Courier New - - false + + true + + + QPlainTextEdit::NoWrap + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + Include signatures + + + + + + + Use old key format + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -471,21 +514,17 @@ - - - Use old key format + + + Qt::Horizontal - - true + + + 40 + 20 + - - - - - - Include signatures - - + diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index b5c367c3a..6427d6ef4 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -61,6 +61,7 @@ QString Rshare::_dateformat; /**< The format of dates in feed items etc Log Rshare::_log; bool Rshare::useConfigDir; QString Rshare::configDir; +QDateTime Rshare::mStartupTime; /** Catches debugging messages from Qt and sends them to RetroShare's logs. If Qt * emits a QtFatalMsg, we will write the message to the log and then abort(). @@ -95,6 +96,8 @@ Rshare::qt_msg_handler(QtMsgType type, const char *s) Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir) : QApplication(argc, argv) { + mStartupTime = QDateTime::currentDateTime(); + qInstallMsgHandler(qt_msg_handler); #ifndef __APPLE__ @@ -162,6 +165,11 @@ Rshare::run() return rApp->exec(); } +QDateTime Rshare::startupTime() +{ + return mStartupTime; +} + /** Called when the application's main event loop has started. This method * will emit the running() signal to indicate that the application's event * loop is running. */ diff --git a/retroshare-gui/src/rshare.h b/retroshare-gui/src/rshare.h index a023e60e5..bcc956ef9 100644 --- a/retroshare-gui/src/rshare.h +++ b/retroshare-gui/src/rshare.h @@ -108,6 +108,8 @@ public: static QString stylesheet() { return _stylesheet; } /** Returns Rshare's application version. */ static QString version() { return RSHARE_VERSION; } + /** Returns Rshare's application startup time. */ + static QDateTime startupTime(); /** Returns the location Rshare uses for its data files. */ static QString dataDirectory(); @@ -173,6 +175,7 @@ private: static QString _language; /**< The current language. */ static QString _dateformat; /**< The format for dates in feed items etc. */ static Log _log; /**< Logs debugging messages to file or stdout. */ + static QDateTime mStartupTime; // startup time static bool useConfigDir; static QString configDir; @@ -180,4 +183,3 @@ private: }; #endif -