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
This commit is contained in:
thunder2 2013-04-22 21:12:38 +00:00
parent fea35e1e3c
commit dd0ef691c5
6 changed files with 76 additions and 40 deletions

View File

@ -27,6 +27,7 @@
#include "StatusMessage.h"
#include "ProfileManager.h"
#include "util/DateTime.h"
#include "rshare.h"
#include <QApplication>
#include <QClipboard>
@ -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*/ )

View File

@ -26,6 +26,7 @@
#include <QTextStream>
#include <QTextCodec>
#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);
}

View File

@ -52,8 +52,6 @@ class CryptoPage : public ConfigPage
bool fileSaveAs();
private:
void setCurrentFileName(const QString &fileName);
QString fileName;
/** Qt Designer generated object */

View File

@ -440,17 +440,60 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="certtextEdit">
<widget class="QPlainTextEdit" name="certplainTextEdit">
<property name="font">
<font>
<kerning>false</kerning>
<family>Courier New</family>
</font>
</property>
<property name="acceptRichText">
<bool>false</bool>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="_includeSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_useOldFormat_CB">
<property name="text">
<string>Use old key format</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -471,21 +514,17 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="_useOldFormat_CB">
<property name="text">
<string>Use old key format</string>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="checked">
<bool>true</bool>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_includeSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</spacer>
</item>
</layout>
</item>

View File

@ -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. */

View File

@ -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