mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed conflicts with upstream/master
This commit is contained in:
commit
20f4b51bb7
@ -1 +1 @@
|
||||
Subproject commit 7e526a4232285e1c2789315c1f382f54d868df8d
|
||||
Subproject commit 0c16c4a07eea82a5946bf49ebccb41d7c1e82368
|
@ -2,17 +2,14 @@
|
||||
README for RetroShare
|
||||
=======================================================================================
|
||||
|
||||
RetroShare web site . . . . http://retroshare.net/index.html
|
||||
RetroShare web site . . . . https://retroshare.cc/
|
||||
Developer's blog . . . . . https://retroshareteam.wordpress.com
|
||||
Documentation . . . . . . . https://retroshare.readthedocs.io/en/latest/
|
||||
Support . . . . . . . . . . http://retroshare.net/support.html
|
||||
Forums . . . . . . . . . . http://retroshare.sourceforge.net/forum/
|
||||
Documentation . . . . . . . https://retrosharedocs.readthedocs.io/en/latest/
|
||||
Wiki . . . . . . . . . . . https://github.com/RetroShare/documentation/wiki
|
||||
Old developers site . . . . http://retroshare.sourceforge.net/wiki/index.php/Developers_Corner
|
||||
Project site . . . . . . . https://github.com/RetroShare/RetroShare
|
||||
Relted projects/plugins . . https://github.com/RetroShare
|
||||
Related projects/plugins . .https://github.com/RetroShare
|
||||
|
||||
Contact: . . . . . . . . . retroshare@lunamutt.com ,defnax@users.sourceforge.net
|
||||
Contact: . . . . . . . . . retroshare.project@gmail.com
|
||||
|
||||
=========================================================================================
|
||||
Compiling RetroShare
|
||||
@ -22,9 +19,9 @@ Build Scripts are avaible on GIT:
|
||||
https://github.com/RetroShare/RetroShare/tree/master/build_scripts
|
||||
|
||||
You can find here instructions howto compile RetroShare:
|
||||
https://retroshare.readthedocs.io/en/latest/developer/compilation/
|
||||
https://retrosharedocs.readthedocs.io/en/latest/developer/compilation/
|
||||
|
||||
You can go on over to our forum or chat lobby when you have trouble with compiling:
|
||||
You can go on over to our forum or chat room when you have trouble with compiling:
|
||||
retroshare://forum?name=Developers%20Discussions&id=8fd22bd8f99754461e7ba1ca8a727995
|
||||
retroshare://chat_room?name=Retroshare%20Devel%20%28signed%29&id=L68DB0A1E09BDA3A5
|
||||
http://retroshare.sourceforge.net/forum/
|
||||
|
||||
|
@ -142,7 +142,7 @@ void AboutWidget::updateTitle()
|
||||
{
|
||||
if (tWidget == NULL)
|
||||
{
|
||||
setWindowTitle(QString("%1 %2").arg(tr("About RetroShare"), Rshare::retroshareVersion(true)));
|
||||
setWindowTitle(QString("%1 %2").arg(tr("About RetroShare"), RsApplication::retroshareVersion(true)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -228,7 +228,7 @@ void AWidget::initImages()
|
||||
#ifdef RS_ONLYHIDDENNODE
|
||||
p.drawText(QPointF(10, 50), QString("%1 : %2 (With embedded Tor)").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
|
||||
#else
|
||||
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
|
||||
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), RsApplication::retroshareVersion(true)));
|
||||
#endif
|
||||
|
||||
/* Draw Qt's version number */
|
||||
@ -936,7 +936,7 @@ void AboutWidget::on_copy_button_clicked()
|
||||
{
|
||||
QString verInfo;
|
||||
QString rsVerString = "RetroShare Version: ";
|
||||
rsVerString+=Rshare::retroshareVersion(true);
|
||||
rsVerString+=RsApplication::retroshareVersion(true);
|
||||
verInfo+=rsVerString;
|
||||
#ifdef RS_ONLYHIDDENNODE
|
||||
verInfo+=" " + tr("Only Hidden Node");
|
||||
|
@ -325,7 +325,7 @@ void SearchDialog::checkText(const QString& txt)
|
||||
ui.searchButton->setDisabled(txt.length() < 3);
|
||||
ui.searchLineFrame->setProperty("valid", (txt.length() >= 3));
|
||||
ui.searchLineFrame->style()->unpolish(ui.searchLineFrame);
|
||||
Rshare::refreshStyleSheet(ui.searchLineFrame, false);
|
||||
RsApplication::refreshStyleSheet(ui.searchLineFrame, false);
|
||||
}
|
||||
|
||||
void SearchDialog::initialiseFileTypeMappings()
|
||||
|
@ -251,7 +251,7 @@ void GenCertDialog::initKeyList()
|
||||
|
||||
void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl;
|
||||
//std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl;
|
||||
|
||||
QDialog::mouseMoveEvent(e) ;
|
||||
}
|
||||
@ -649,7 +649,7 @@ void GenCertDialog::genPerson()
|
||||
{
|
||||
/* complete the process */
|
||||
RsInit::LoadPassword(sslPasswd);
|
||||
if (Rshare::loadCertificate(sslId, false)) {
|
||||
if (RsApplication::loadCertificate(sslId, false)) {
|
||||
|
||||
// Normally we should clear the cached passphrase as soon as possible. However,some other GUI components may still need it at start.
|
||||
// (csoler) This is really bad: we have to guess that 30 secs will be enough. I have no better way to do this.
|
||||
|
@ -421,7 +421,7 @@ void GetStartedDialog::emailSupport()
|
||||
sysVersion = "Linux";
|
||||
#endif
|
||||
#endif
|
||||
text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(Rshare::retroshareVersion(true)
|
||||
text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(RsApplication::retroshareVersion(true)
|
||||
, sysVersion
|
||||
).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n";
|
||||
text += "\n";
|
||||
|
@ -80,7 +80,7 @@ HelpDialog::HelpDialog(QWidget *parent) :
|
||||
ui->thanks->setHtml(in.readAll());
|
||||
}
|
||||
|
||||
ui->version->setText(Rshare::retroshareVersion(true));
|
||||
ui->version->setText(RsApplication::retroshareVersion(true));
|
||||
|
||||
/* Add version numbers of libretroshare */
|
||||
std::list<RsLibraryInfo> libraries;
|
||||
|
@ -703,7 +703,7 @@ void IdEditDialog::updateInterface()
|
||||
const QPixmap *pixmap = ui->avatarLabel->pixmap();
|
||||
if (pixmap && !pixmap->isNull()) {
|
||||
ui->removeButton->setEnabled(true);
|
||||
} else if (mEditGroup.mImage.mSize != NULL) {
|
||||
} else if (mEditGroup.mImage.mSize > 0) {
|
||||
ui->removeButton->setEnabled(true);
|
||||
} else {
|
||||
ui->removeButton->setEnabled(false);
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
#include <util/argstream.h>
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
#include "gui/common/MacDockIconHandler.h"
|
||||
@ -211,7 +212,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
hiddenmode = true;
|
||||
}
|
||||
|
||||
setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(Rshare::retroshareVersion(true)) + " - " + nameAndLocation);
|
||||
setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(RsApplication::retroshareVersion(true)) + " - " + nameAndLocation);
|
||||
connect(rApp, SIGNAL(newArgsReceived(QStringList)), this, SLOT(receiveNewArgs(QStringList)));
|
||||
|
||||
/* add url handler for RetroShare links */
|
||||
@ -1253,10 +1254,91 @@ void MainWindow::doQuit()
|
||||
rApp->quit();
|
||||
}
|
||||
|
||||
// This method parses arguments passed by the operating system. All arguments
|
||||
// except -r, -f, -o and lists of rscollection files and rslinks are discarded.
|
||||
//
|
||||
void MainWindow::receiveNewArgs(QStringList args)
|
||||
{
|
||||
Rshare::parseArguments(args, false);
|
||||
processLastArgs();
|
||||
RsInfo() << "Received new arguments from operating system call.";
|
||||
|
||||
std::string argstring = RsApplication::applicationFilePath().toStdString() ;
|
||||
|
||||
for(auto l:args)
|
||||
argstring += " " + l.toStdString();
|
||||
|
||||
// This class does all the job at once: validate arguments, and parses them.
|
||||
|
||||
std::vector<std::string> links_and_files;
|
||||
|
||||
argstream as(argstring.c_str());
|
||||
|
||||
QString omValues = QString(";full;noturtle;gaming;minimal;");
|
||||
std::string opModeStr;
|
||||
std::string retroshare_link_url;
|
||||
std::string rscollection_file;
|
||||
|
||||
as >> parameter('r',"rslink",retroshare_link_url,"Retroshare:// link","Retroshare link to open in Downloads " ,false)
|
||||
>> parameter('f',"rsfile",rscollection_file,"file","File to open " ,false)
|
||||
>> parameter('o',"opmode",opModeStr,"opmode","Set mode (Full, NoTurtle, Gaming, Minimal) " ,false)
|
||||
>> values<std::string>(back_inserter(links_and_files),"links and files");
|
||||
|
||||
if(!as.isOk())
|
||||
{
|
||||
RsErr() << "Error while parsing arguments:" ;
|
||||
RsErr() << as.errorLog() ;
|
||||
return;
|
||||
}
|
||||
if(!opModeStr.empty() && omValues.contains(";"+QString::fromStdString(opModeStr).toLower()+";"))
|
||||
{
|
||||
QString opmode = QString::fromStdString(opModeStr).toLower();
|
||||
//RsApplication::setOpMode(opModeStr.toLower()); // Do we need this??
|
||||
|
||||
RsInfo() << "Setting new operating mode to \"" << opmode.toStdString() << "\"";
|
||||
|
||||
if (opmode == "noturtle")
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::NOTURTLE) - 1);
|
||||
else if (opmode == "gaming")
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::GAMING) - 1);
|
||||
else if (opmode == "minimal")
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::MINIMAL) - 1);
|
||||
else if (opmode != "")
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::FULL) - 1);
|
||||
|
||||
opModeStatus->setOpMode();
|
||||
}
|
||||
|
||||
// Sort all collected arguments into rscollection files and retroshare links, accordingly
|
||||
|
||||
QStringList rscollection_files;
|
||||
QList<RetroShareLink> rslinks;
|
||||
|
||||
auto sort = [&](const QString s) {
|
||||
|
||||
if(QFile(s).exists() && s.endsWith(".rscollection"))
|
||||
rscollection_files.append(QString::fromUtf8(rscollection_file.c_str()));
|
||||
else if(s.startsWith("retroshare://"))
|
||||
{
|
||||
RetroShareLink link(s);
|
||||
|
||||
if(link.valid())
|
||||
rslinks.push_back(link);
|
||||
}
|
||||
};
|
||||
|
||||
sort(QString::fromUtf8(rscollection_file.c_str()));
|
||||
sort(QString::fromUtf8(retroshare_link_url.c_str()));
|
||||
|
||||
for(auto s:links_and_files)
|
||||
sort(QString::fromUtf8(s.c_str()));
|
||||
|
||||
// Now handle links and rscollection files.
|
||||
|
||||
for(auto file:rscollection_files)
|
||||
if(file.endsWith(".rscollection"))
|
||||
openRsCollection(file);
|
||||
|
||||
for(auto link:rslinks)
|
||||
retroshareLinkActivated(link.toUrl());
|
||||
}
|
||||
|
||||
void MainWindow::displayErrorMessage(int /*a*/,int /*b*/,const QString& error_msg)
|
||||
@ -1623,43 +1705,11 @@ void MainWindow::retroshareLinkActivated(const QUrl &url)
|
||||
void MainWindow::openRsCollection(const QString &filename)
|
||||
{
|
||||
QFileInfo qinfo(filename);
|
||||
|
||||
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString))
|
||||
RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
void MainWindow::processLastArgs()
|
||||
{
|
||||
while (!Rshare::links()->isEmpty()) {
|
||||
std::cerr << "MainWindow::processLastArgs() : " << Rshare::links()->count() << std::endl;
|
||||
/* Now use links from the command line, because no RetroShare was running */
|
||||
RetroShareLink link(Rshare::links()->takeFirst());
|
||||
if (link.valid()) {
|
||||
retroshareLinkActivated(link.toUrl());
|
||||
}
|
||||
}
|
||||
while (!Rshare::files()->isEmpty()) {
|
||||
/* Now use files from the command line, because no RetroShare was running */
|
||||
openRsCollection(Rshare::files()->takeFirst());
|
||||
}
|
||||
/* Handle the -opmode options. */
|
||||
if (opModeStatus) {
|
||||
QString opmode = Rshare::opmode().toLower();
|
||||
if (opmode == "noturtle") {
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::NOTURTLE) - 1);
|
||||
} else if (opmode == "gaming") {
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::GAMING) - 1);
|
||||
} else if (opmode == "minimal") {
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::MINIMAL) - 1);
|
||||
} else if (opmode != "") {
|
||||
opModeStatus->setCurrentIndex(static_cast<typename std::underlying_type<RsOpMode>::type>(RsOpMode::FULL) - 1);
|
||||
}
|
||||
opModeStatus->setOpMode();
|
||||
} else {
|
||||
std::cerr << "ERR: MainWindow::processLastArgs opModeStatus is not initialized.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::switchVisibilityStatus(StatusElement e,bool b)
|
||||
{
|
||||
switch(e)
|
||||
|
@ -214,7 +214,6 @@ public slots:
|
||||
void externalLinkActivated(const QUrl &url);
|
||||
void retroshareLinkActivated(const QUrl &url);
|
||||
void openRsCollection(const QString &filename);
|
||||
void processLastArgs();
|
||||
//! Go to a specific part of the control panel.
|
||||
void setNewPage(int page);
|
||||
void setCompactStatusMode(bool compact);
|
||||
|
@ -41,7 +41,7 @@
|
||||
PluginManager::PluginManager()
|
||||
{
|
||||
baseFolder = //qApp->applicationDirPath()+"///plugins" ;
|
||||
Rshare::dataDirectory() + "/plugins" ;
|
||||
RsApplication::dataDirectory() + "/plugins" ;
|
||||
lastError = "No error.";
|
||||
|
||||
viewWidget = 0;
|
||||
|
@ -123,7 +123,7 @@ void StartDialog::loadPerson()
|
||||
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
||||
rsNotify->setDisableAskPassword(true);
|
||||
|
||||
bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
||||
bool res = RsApplication::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
||||
|
||||
rsNotify->setDisableAskPassword(false);
|
||||
rsNotify->clearPgpPassphrase();
|
||||
|
@ -121,7 +121,7 @@ void AvatarWidget::setFrameType(FrameType type)
|
||||
|
||||
//refreshAvatarImage();
|
||||
refreshStatus();
|
||||
Rshare::refreshStyleSheet(this, false);
|
||||
RsApplication::refreshStyleSheet(this, false);
|
||||
}
|
||||
void AvatarWidget::setId(const ChatId &id)
|
||||
{
|
||||
@ -174,7 +174,7 @@ void AvatarWidget::refreshStatus()
|
||||
case NO_FRAME:
|
||||
case NORMAL_FRAME:
|
||||
{
|
||||
Rshare::refreshStyleSheet(this, false);
|
||||
RsApplication::refreshStyleSheet(this, false);
|
||||
break;
|
||||
}
|
||||
case STATUS_FRAME:
|
||||
@ -252,7 +252,7 @@ void AvatarWidget::updateStatus(int status)
|
||||
mPeerState = status;
|
||||
|
||||
setEnabled(((uint32_t) status == RS_STATUS_OFFLINE) ? false : true);
|
||||
Rshare::refreshStyleSheet(this, false);
|
||||
RsApplication::refreshStyleSheet(this, false);
|
||||
}
|
||||
|
||||
void AvatarWidget::updateAvatar(const QString &peerId)
|
||||
|
@ -127,7 +127,7 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
|
||||
ui->filterLineEdit->showFilterIcon();
|
||||
|
||||
/* Refresh style to have the correct text color */
|
||||
Rshare::refreshStyleSheet(this, false);
|
||||
RsApplication::refreshStyleSheet(this, false);
|
||||
|
||||
mEventHandlerId_identities = 0;
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) {
|
||||
@ -1225,7 +1225,7 @@ std::string FriendSelectionWidget::idFromItem(QTreeWidgetItem *item)
|
||||
return item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::sortByChecked(bool sort)
|
||||
void FriendSelectionWidget::sortByChecked(bool)
|
||||
{
|
||||
mCompareRole->clear();
|
||||
mCompareRole->setRole(COLUMN_NAME,ROLE_SORT_SELECTED);
|
||||
|
@ -234,8 +234,10 @@ void LineEditClear::setFilterButtonIcon(const QIcon &icon)
|
||||
mFilterButton->setIcon(icon);
|
||||
|
||||
ensurePolished();
|
||||
#if !defined(Q_OS_DARWIN)
|
||||
QFontMetrics fm(this->font());
|
||||
QSize size(fm.width("___"), fm.height());
|
||||
mFilterButton->setFixedSize(size);
|
||||
mFilterButton->setIconSize(size);
|
||||
#endif
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ public slots:
|
||||
void setShowUnconnected(bool hidden);
|
||||
void setShowState(bool show);
|
||||
void headerContextMenuRequested(QPoint);
|
||||
void exportFriendlistClicked();
|
||||
|
||||
private slots:
|
||||
void sortColumn(int col,Qt::SortOrder so);
|
||||
@ -164,6 +165,5 @@ private slots:
|
||||
void editGroup();
|
||||
void removeGroup();
|
||||
|
||||
void exportFriendlistClicked();
|
||||
void importFriendlistClicked();
|
||||
};
|
||||
|
@ -367,7 +367,9 @@ RsCollection::RsCollection(const QString& fileName, RsCollectionErrorCode& error
|
||||
return;
|
||||
}
|
||||
|
||||
recursParseXml(xml_doc,root,0);
|
||||
if(!recursParseXml(xml_doc,root,0))
|
||||
error = RsCollectionErrorCode::XML_PARSING_ERROR;
|
||||
else
|
||||
error = RsCollectionErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
@ -672,11 +674,11 @@ void RsCollection::saveColl(std::vector<ColFileInfo> colFileInfos, const QString
|
||||
|
||||
bool RsCollection::removeFile(RsFileTree::FileIndex index_to_remove,RsFileTree::DirIndex parent_index)
|
||||
{
|
||||
mFileTree->removeFile(index_to_remove,parent_index);
|
||||
return mFileTree->removeFile(index_to_remove,parent_index);
|
||||
}
|
||||
bool RsCollection::removeDirectory(RsFileTree::DirIndex index_to_remove,RsFileTree::DirIndex parent_index)
|
||||
{
|
||||
mFileTree->removeDirectory(index_to_remove,parent_index);
|
||||
return mFileTree->removeDirectory(index_to_remove,parent_index);
|
||||
}
|
||||
|
||||
void RsCollection::cleanup()
|
||||
|
@ -117,7 +117,7 @@ HelpBrowser::~HelpBrowser()
|
||||
QString
|
||||
HelpBrowser::language()
|
||||
{
|
||||
QString lang = Rshare::language();
|
||||
QString lang = RsApplication::language();
|
||||
if (!QDir(":/help/" + lang).exists())
|
||||
lang = "en";
|
||||
return lang;
|
||||
|
@ -54,7 +54,7 @@ HelpTextBrowser::loadResource(int type, const QUrl &name)
|
||||
/* Fall back to English if there is no translation of the specified help
|
||||
* page in the current language. */
|
||||
if (!name.path().contains("/")) {
|
||||
QString language = Rshare::language();
|
||||
QString language = RsApplication::language();
|
||||
if (!QDir(":/help/" + language).exists())
|
||||
language = "en";
|
||||
helpPath += language + "/";
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.6 KiB |
@ -2,25 +2,28 @@
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg4823"
|
||||
id="svg4155"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
|
||||
xml:space="preserve"
|
||||
width="80"
|
||||
height="80"
|
||||
viewBox="0 0 80 80"
|
||||
sodipodi:docname="invite.svg"><metadata
|
||||
id="metadata4829"><rdf:RDF><cc:Work
|
||||
sodipodi:docname="invite.svg"
|
||||
inkscape:export-filename="C:\Users\ProBook\Documents\GitHub\RetroShare\retroshare-gui\src\gui\icons\png\invite.png"
|
||||
inkscape:export-xdpi="153.60001"
|
||||
inkscape:export-ydpi="153.60001"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
|
||||
id="metadata4161"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4827" /><sodipodi:namedview
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4159" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
@ -29,46 +32,31 @@
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1009"
|
||||
id="namedview4825"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="705"
|
||||
id="namedview4157"
|
||||
showgrid="false"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:zoom="1.475"
|
||||
inkscape:cx="-155.33838"
|
||||
inkscape:cy="28.585876"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:zoom="2.559375"
|
||||
inkscape:cx="34.188034"
|
||||
inkscape:cy="69.352868"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g4831" /><g
|
||||
id="g4831"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:pagecheckerboard="0" /><g
|
||||
id="g4163"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="ink_ext_XXXXXX"
|
||||
transform="matrix(1.25,0,0,-1.25,0,80)"><path
|
||||
transform="matrix(1.25,0,0,-1.25,0,80)"
|
||||
style="display:inline"><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4835"
|
||||
id="path4167"
|
||||
style="fill:#039bd5;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="M 64,32 C 64,14.327 49.673,0 32,0 14.327,0 0,14.327 0,32 0,49.673 14.327,64 32,64 49.673,64 64,49.673 64,32" /><path
|
||||
sodipodi:nodetypes="csasccsassc"
|
||||
d="m 33.346398,27.138373 c 2.012782,2.397011 3.817716,9.137224 3.780729,13.03223 -0.04053,4.268676 -4.147427,7.833723 -7.844104,7.839587 -3.89323,0.0062 -8.134746,-3.432459 -8.287329,-8.230168 C 20.876209,36.02303 22.815244,29.25428 24.970657,27.344578 24.73295,25.80496 23.829344,23.960201 21.144182,22.793431 19.6943,22.163465 15.581718,20.946417 15.626371,18.600543 c 0.04851,-2.548391 8.793599,-4.303905 13.521842,-4.28593 4.621336,0.01757 13.160147,1.682212 13.183878,4.289387 0.01639,1.800667 -5.45021,3.369885 -6.656712,4.623374 -1.535253,1.595043 -2.168834,3.07356 -2.328981,3.910999 z"
|
||||
style="fill:#000000;fill-opacity:0.15686275;fill-rule:nonzero;stroke:none"
|
||||
id="use4155"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4839"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 33.346398,28.617307 c 2.012782,2.397011 3.817716,9.137224 3.780729,13.03223 -0.04053,4.268677 -4.147427,7.833723 -7.844104,7.839587 -3.89323,0.0062 -8.134746,-3.432459 -8.287329,-8.230168 -0.119485,-3.756992 1.81955,-10.525742 3.974963,-12.435444 -0.237707,-1.539618 -1.141313,-3.384377 -3.826475,-4.551147 -1.449882,-0.629966 -5.562464,-1.847014 -5.517811,-4.192888 0.04851,-2.54839 8.793599,-4.303905 13.521842,-4.28593 4.621336,0.01757 13.160147,1.682212 13.183878,4.289387 0.01639,1.800667 -5.45021,3.369885 -6.656712,4.623374 -1.535253,1.595044 -2.168834,3.07356 -2.328981,3.910999 z"
|
||||
sodipodi:nodetypes="csasccsassc" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5440"
|
||||
style="fill:#000000;fill-opacity:0.15686275;fill-rule:nonzero;stroke:none"
|
||||
d="m 46.384917,23.38757 c -1.021112,0 -1.848668,0.827556 -1.848668,1.848667 l 0,3.697335 -3.697335,0 c -1.021112,0 -1.848668,0.827556 -1.848668,1.848668 0,1.021112 0.827556,1.848668 1.848668,1.848668 l 3.697335,0 0,3.697335 c 0,1.021111 0.827556,1.848668 1.848668,1.848668 1.021111,0 1.848667,-0.827557 1.848667,-1.848668 l 0,-3.697335 3.697336,0 c 1.021111,0 1.848667,-0.827556 1.848667,-1.848668 0,-1.021112 -0.827556,-1.848668 -1.848667,-1.848668 l -3.697336,0 0,-3.697335 c 0,-1.021111 -0.827556,-1.848667 -1.848667,-1.848667" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5452"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 53.779587,32.010539 c 0,-1.021111 -0.827556,-1.848667 -1.848667,-1.848667 l -11.092006,0 c -1.021112,0 -1.848668,0.827556 -1.848668,1.848667 0,1.021112 0.827556,1.848668 1.848668,1.848668 l 11.092006,0 c 1.021111,0 1.848667,-0.827556 1.848667,-1.848668" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5456"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 46.384917,24.615869 c -1.021112,0 -1.848668,0.827556 -1.848668,1.848667 l 0,11.092006 c 0,1.021112 0.827556,1.848668 1.848668,1.848668 1.021111,0 1.848667,-0.827556 1.848667,-1.848668 l 0,-11.092006 c 0,-1.021111 -0.827556,-1.848667 -1.848667,-1.848667" /></g></svg>
|
||||
d="M 64,32 C 64,14.327 49.673,0 32,0 14.327,0 0,14.327 0,32 0,49.673 14.327,64 32,64 49.673,64 64,49.673 64,32" /></g><g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
inkscape:label="forground"
|
||||
style="display:inline"><path
|
||||
style="fill:#f9f9f9;stroke-width:0.115097"
|
||||
d="m 16.369227,64.730725 c -2.410081,-0.519492 -4.393567,-2.486625 -4.89547,-4.855106 -0.230292,-1.086748 -0.232509,-8.437472 -0.0031,-10.160706 0.544804,-4.091726 2.311934,-7.6619 5.240845,-10.588196 0.729631,-0.728977 1.620855,-1.524992 1.9805,-1.768921 l 0.653899,-0.443506 0.870488,0.635708 c 1.713047,1.251025 4.034249,2.2608 6.317223,2.748136 1.666706,0.355784 4.587773,0.356708 6.248914,0.0019 2.717698,-0.580353 4.507782,-1.407765 7.126351,-3.293936 0.472315,-0.340212 5.163656,4.356013 4.822871,4.827896 -1.873071,2.593626 -2.716501,4.411741 -3.283366,7.077697 -0.3636,1.710005 -0.366662,4.607965 -0.0066,6.294485 0.619445,2.901855 2.005028,5.663034 3.887193,7.746366 0.407391,0.450932 0.415297,0.475502 0.20546,0.638472 -0.545416,0.423596 -2.110246,1.093106 -2.807926,1.201366 -0.471223,0.07313 -5.349087,0.113024 -13.178634,0.107808 -10.202918,-0.0067 -12.564565,-0.03718 -13.178629,-0.169543 z m 39.420806,0.0498 c -4.989364,-0.623224 -9.270985,-4.31662 -10.693102,-9.224051 -1.670749,-5.765402 1.045758,-12.068253 6.384936,-14.81436 2.550296,-1.311698 5.092938,-1.744661 7.818632,-1.331366 2.790409,0.423106 5.148972,1.616342 7.149858,3.617227 6.209256,6.209257 4.488252,16.634919 -3.383501,20.496904 -2.348935,1.152418 -4.765258,1.569365 -7.276823,1.255646 z M 58.3181,57.212066 c 0.613555,-0.348996 0.802549,-0.844473 0.85019,-2.228919 l 0.04257,-1.237296 1.224561,-4.6e-4 c 1.026113,-3.45e-4 1.286453,-0.03817 1.60646,-0.233264 0.506112,-0.308566 0.877263,-1.129212 0.76979,-1.702082 -0.199788,-1.064967 -0.953807,-1.510795 -2.561627,-1.514613 l -1.064649,-0.0025 -0.0026,-1.064649 c -0.0038,-1.607821 -0.449645,-2.36184 -1.514612,-2.561627 -0.572871,-0.107472 -1.393515,0.263677 -1.702082,0.769789 -0.195498,0.320659 -0.232903,0.580298 -0.233265,1.619192 l -4.25e-4,1.237295 h -1.12656 c -0.940194,0 -1.211113,0.04284 -1.637501,0.258969 -0.911823,0.462175 -1.238494,1.559926 -0.71455,2.401192 0.397339,0.637989 0.639056,0.729347 2.09747,0.792756 l 1.323618,0.05755 0.05755,1.323619 c 0.06014,1.383222 0.154758,1.663359 0.68795,2.036821 0.579138,0.405644 1.239785,0.422433 1.897665,0.04823 z M 28.051598,37.042095 C 23.062233,36.418873 18.780612,32.725476 17.358495,27.818044 15.67366,22.00403 18.44977,15.656315 23.867225,12.935506 c 2.497687,-1.254414 5.02093,-1.66863 7.694839,-1.263188 2.790408,0.423107 5.148971,1.616342 7.149857,3.617228 6.209256,6.209257 4.488253,16.634919 -3.3835,20.496904 -2.348935,1.152417 -4.765259,1.569364 -7.276823,1.255645 z"
|
||||
id="path1478" /></g></svg>
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.7 KiB |
@ -45,13 +45,13 @@ ProfileWidget::ProfileWidget(QWidget *parent, Qt::WindowFlags flags)
|
||||
connect(ui.CopyCertButton,SIGNAL(clicked()), this, SLOT(copyCert()));
|
||||
connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager()));
|
||||
|
||||
ui.onLineSince->setText(DateTime::formatLongDateTime(Rshare::startupTime()));
|
||||
ui.onLineSince->setText(DateTime::formatLongDateTime(RsApplication::startupTime()));
|
||||
}
|
||||
|
||||
void ProfileWidget::showEvent ( QShowEvent * /*event*/ )
|
||||
{
|
||||
/* set retroshare version */
|
||||
ui.version->setText(Rshare::retroshareVersion(true));
|
||||
ui.version->setText(RsApplication::retroshareVersion(true));
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
|
||||
|
@ -84,7 +84,7 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
|
||||
}
|
||||
|
||||
QMap<QString, QString> styleSheets;
|
||||
Rshare::getAvailableStyleSheets(styleSheets);
|
||||
RsApplication::getAvailableStyleSheets(styleSheets);
|
||||
|
||||
foreach (QString name, styleSheets.keys()) {
|
||||
ui.cmboStyleSheet->addItem(name, styleSheets[name]);
|
||||
@ -136,7 +136,7 @@ void AppearancePage::updateInterfaceStyle()
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
Rshare::setStyle(ui.cmboStyle->currentText());
|
||||
RsApplication::setStyle(ui.cmboStyle->currentText());
|
||||
Settings->setInterfaceStyle(ui.cmboStyle->currentText());
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
@ -152,7 +152,7 @@ void AppearancePage::loadStyleSheet(int index)
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
Rshare::loadStyleSheet(ui.cmboStyleSheet->itemData(index).toString());
|
||||
RsApplication::loadStyleSheet(ui.cmboStyleSheet->itemData(index).toString());
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
@ -251,7 +251,7 @@ void AppearancePage::updateCmboToolButtonSize()
|
||||
// NotifyQt::getInstance()->notifySettingsChanged();
|
||||
// }
|
||||
|
||||
void AppearancePage::updateStyle() { Rshare::setStyle(ui.cmboStyle->currentText()); }
|
||||
void AppearancePage::updateStyle() { RsApplication::setStyle(ui.cmboStyle->currentText()); }
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void AppearancePage::load()
|
||||
@ -259,7 +259,7 @@ void AppearancePage::load()
|
||||
int index = ui.cmboLanguage->findData(Settings->getLanguageCode());
|
||||
whileBlocking(ui.cmboLanguage)->setCurrentIndex(index);
|
||||
|
||||
index = ui.cmboStyle->findData(Rshare::style().toLower());
|
||||
index = ui.cmboStyle->findData(RsApplication::style().toLower());
|
||||
whileBlocking(ui.cmboStyle)->setCurrentIndex(index);
|
||||
|
||||
index = ui.cmboStyleSheet->findData(Settings->getSheetName());
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <gui/connect/ConfCertDialog.h>
|
||||
#include <gui/profile/ProfileManager.h>
|
||||
#include <gui/statistics/StatisticsWindow.h>
|
||||
#include <gui/common/NewFriendList.h>
|
||||
|
||||
#include <retroshare/rspeers.h> //for rsPeers variable
|
||||
#include <retroshare/rsdisc.h> //for rsPeers variable
|
||||
@ -60,13 +61,14 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
|
||||
//connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager()));
|
||||
connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(exportProfile()));
|
||||
connect(ui.exportfriendslist,SIGNAL(clicked()), this, SLOT(exportFriendsList()) );
|
||||
|
||||
// Remove this because it duplicates functionality of the HomePage.
|
||||
ui.retroshareId_LB->hide();
|
||||
ui.retroshareId_content_LB->hide();
|
||||
ui.stackPageCertificate->hide();
|
||||
|
||||
ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime()));
|
||||
ui.onlinesince->setText(DateTime::formatLongDateTime(RsApplication::startupTime()));
|
||||
}
|
||||
|
||||
#ifdef UNUSED_CODE
|
||||
@ -111,7 +113,7 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
|
||||
ui.retroshareId_content_LB->setText(QString::fromUtf8(invite.c_str()));
|
||||
|
||||
/* set retroshare version */
|
||||
ui.version->setText(Rshare::retroshareVersion(true));
|
||||
ui.version->setText(RsApplication::retroshareVersion(true));
|
||||
|
||||
std::list<RsPgpId> ids;
|
||||
ids.clear();
|
||||
@ -229,3 +231,8 @@ void CryptoPage::showStats()
|
||||
{
|
||||
StatisticsWindow::showYourself();
|
||||
}
|
||||
|
||||
void CryptoPage::exportFriendsList()
|
||||
{
|
||||
NewFriendList().exportFriendlistClicked();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class CryptoPage : public ConfigPage
|
||||
bool fileSave();
|
||||
bool fileSaveAs();
|
||||
void showStats();
|
||||
void exportFriendsList();
|
||||
|
||||
private:
|
||||
QString fileName;
|
||||
|
@ -13,25 +13,11 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="stackPageNodeInfo" native="true">
|
||||
<widget class="QWidget" name="stackPageNodeInfo">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="retroshareId_LB">
|
||||
<property name="text">
|
||||
<string>Retroshare ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Statistics:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLabel" name="peerid">
|
||||
<property name="sizePolicy">
|
||||
@ -51,13 +37,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>PGP fingerprint:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
@ -77,99 +56,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<widget class="QLabel" name="friendsEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Export Profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLabel" name="pgpfingerprint">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLabel" name="pgpid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Online since:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
@ -189,184 +75,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="publicIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="publicLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="retroshareId_LB">
|
||||
<property name="text">
|
||||
<string>Public Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QLabel" name="country">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QPushButton" name="exportprofile">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use this button to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Software Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QPushButton" name="showStats_PB">
|
||||
<property name="text">
|
||||
<string>Show statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="otherIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="otherLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Other Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Profile path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Friend nodes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLabel" name="name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
<string>Retroshare ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -407,22 +119,80 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QLabel" name="country">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>PGP fingerprint:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="otherIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="otherLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Other Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QPushButton" name="showStats_PB">
|
||||
<property name="text">
|
||||
<string>Show statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Export Profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -448,8 +218,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -463,23 +233,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PGP Id :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QLabel" name="retroshareId_content_LB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<string>Friend nodes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -502,6 +256,100 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PGP Id :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QPushButton" name="exportprofile">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use this button to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Statistics:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLabel" name="name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Online since:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Profile path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="2">
|
||||
<widget class="QLabel" name="labelpath">
|
||||
<property name="font">
|
||||
@ -515,6 +363,172 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<widget class="QLabel" name="friendsEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Software Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QLabel" name="retroshareId_content_LB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLabel" name="pgpid">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLabel" name="pgpfingerprint">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="publicIcon">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/info16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="publicLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Public Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Export Friendslist:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QPushButton" name="exportfriendslist">
|
||||
<property name="text">
|
||||
<string>Export friends list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2" rowspan="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -533,7 +547,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="stackPageCertificate" native="true">
|
||||
<widget class="QWidget" name="stackPageCertificate">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPlainTextEdit" name="certplainTextEdit">
|
||||
|
@ -146,10 +146,10 @@
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="useLocalServer">
|
||||
<property name="toolTip">
|
||||
<string>When checked, this instance receives new parameters (like RsLink or RsFile) and avoid new one.</string>
|
||||
<string><html><head/><body><p>When checked, this retroshare instance will accept calls by your operating system to open Retroshare collection files, and download links.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Local Server to get new arguments.</string>
|
||||
<string>Accept operating systems calls</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -910,7 +910,7 @@ void RshareSettings::setUseLocalServer(bool value)
|
||||
{
|
||||
if (value != getUseLocalServer()) {
|
||||
setValue("UseLocalServer", value);
|
||||
Rshare::updateLocalServer();
|
||||
RsApplication::updateLocalServer();
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,10 @@ CrashStackTrace gCrashStackTrace;
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
#include <QSplashScreen>
|
||||
#include <QMessageBox>
|
||||
#include <QBuffer>
|
||||
#include <QSharedMemory>
|
||||
#include <QLocalSocket>
|
||||
|
||||
#include <rshare.h>
|
||||
#include "gui/common/FilesDefs.h"
|
||||
@ -106,6 +110,134 @@ __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
|
||||
#include "gui/notifyqt.h"
|
||||
#include <unistd.h>
|
||||
|
||||
static void showHelp(const argstream& as)
|
||||
{
|
||||
RsInfo() << "\n" <<
|
||||
"+================================================================+\n"
|
||||
"| o---o o |\n"
|
||||
"| \\ / - Retroshare GUI - / \\ |\n"
|
||||
"| o o---o |\n"
|
||||
"+================================================================+"
|
||||
<< std::endl ;
|
||||
|
||||
std::cerr << as.usage(false) << std::endl;
|
||||
|
||||
char *argv[1];
|
||||
int argc=0;
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
QMessageBox box;
|
||||
QString text = QString::fromUtf8(as.usage(false,false).c_str());
|
||||
QFont font("Courier New",10,50,false);
|
||||
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
|
||||
font.setStyle(QFont::StyleNormal);
|
||||
font.setBold(true);
|
||||
box.setFont(font);
|
||||
box.setInformativeText(text);
|
||||
box.setWindowTitle(QObject::tr("Retroshare commandline arguments"));
|
||||
|
||||
// now compute the size of text and set the size of the box. For the record, this doesn't work...
|
||||
box.setBaseSize( QSize(QFontMetricsF(font).width(text),QFontMetricsF(font).height()*text.count('\n')) );
|
||||
box.exec();
|
||||
}
|
||||
|
||||
static bool notifyRunningInstance()
|
||||
{
|
||||
// Connect to the Local Server of the main process to notify it
|
||||
// that a new process had been started
|
||||
|
||||
RsInfo() << "Trying to contact running instance through socket \"" << TARGET << "\"";
|
||||
QLocalSocket localSocket;
|
||||
localSocket.connectToServer(QString(TARGET));
|
||||
#ifdef DEBUG
|
||||
std::cerr << "RsApplication::RsApplication waitForConnected to other instance." << std::endl;
|
||||
#endif
|
||||
if( localSocket.waitForConnected(100) )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "RsApplication::RsApplication Connection etablished. Waiting for disconnection." << std::endl;
|
||||
#endif
|
||||
localSocket.waitForDisconnected(1000);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "RsApplication::RsApplication failed to connect to other instance." << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void sendArgsToRunningInstance(const QStringList& args)
|
||||
{
|
||||
QString serverName = QString(TARGET);
|
||||
|
||||
// load into shared memory
|
||||
QBuffer buffer;
|
||||
buffer.open(QBuffer::ReadWrite);
|
||||
QDataStream out(&buffer);
|
||||
out << args;
|
||||
int size = buffer.size();
|
||||
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(serverName + "_newArgs");
|
||||
if (newArgs.isAttached()) newArgs.detach();
|
||||
|
||||
if (!newArgs.create(size)) {
|
||||
std::cerr << "(EE) RsApplication::RsApplication Unable to create shared memory segment of size:"
|
||||
<< size << " error:" << newArgs.errorString().toStdString() << "." << std::endl;
|
||||
#ifdef Q_OS_UNIX
|
||||
std::cerr << "Look with `ipcs -m` for nattch==0 segment. And remove it with `ipcrm -m 'shmid'`." << std::endl;
|
||||
//No need for windows, as it removes shared segment directly even when crash.
|
||||
#endif
|
||||
newArgs.detach();
|
||||
::exit(EXIT_FAILURE);
|
||||
}
|
||||
newArgs.lock();
|
||||
char *to = (char*)newArgs.data();
|
||||
const char *from = buffer.data().data();
|
||||
memcpy(to, from, qMin(newArgs.size(), size));
|
||||
newArgs.unlock();
|
||||
|
||||
std::cerr << "RsApplication::RsApplication waitForConnected to other instance." << std::endl;
|
||||
if(notifyRunningInstance())
|
||||
{
|
||||
newArgs.detach();
|
||||
std::cerr << "RsApplication::RsApplication Arguments was sended." << std::endl
|
||||
<< " To disable it, in Options - General - Misc," << std::endl
|
||||
<< " uncheck \"Use Local Server to get new Arguments\"." << std::endl;
|
||||
::exit(EXIT_SUCCESS); // Terminate the program using STDLib's exit function
|
||||
}
|
||||
else
|
||||
std::cerr << "RsApplication::RsApplication failed to connect to other instance." << std::endl;
|
||||
newArgs.detach();
|
||||
}
|
||||
|
||||
static bool setLanguage(const std::string& language)
|
||||
{
|
||||
if(!language.empty())
|
||||
{
|
||||
if(!LanguageSupport::translate(QString::fromStdString(language)))
|
||||
{
|
||||
RsErr() << "Language \"" << language << "\" is not supported." ;
|
||||
|
||||
QString s;
|
||||
for(QString ss:LanguageSupport::languageCodes())
|
||||
s += ss + ", " ;
|
||||
|
||||
RsErr() << "Possible choices are: " << s.toStdString();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void displayWarningAboutDSAKeys()
|
||||
{
|
||||
std::map<std::string,std::vector<std::string> > unsupported_keys;
|
||||
@ -209,17 +341,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
Q_INIT_RESOURCE(images);
|
||||
Q_INIT_RESOURCE(icons);
|
||||
|
||||
// Loop through all command-line args/values to get help wanted before RsInit exit.
|
||||
for (int i = 0; i < args.size(); ++i) {
|
||||
QString arg;
|
||||
/* Get the argument name and set a blank value */
|
||||
arg = args.at(i);
|
||||
if ((arg.toLower() == "-h") || (arg.toLower() == "--help")) {
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
Rshare::showUsageMessageBox();
|
||||
}
|
||||
}
|
||||
|
||||
// This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
|
||||
//
|
||||
RsControl::earlyInitNotificationSystem() ;
|
||||
@ -230,30 +351,80 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
/* RetroShare Core Objects */
|
||||
RsInit::InitRsConfig();
|
||||
|
||||
RsConfigOptions conf;
|
||||
RsGUIConfigOptions conf;
|
||||
|
||||
std::string rslink,rsfile;
|
||||
std::list<std::string> links_and_files;
|
||||
std::string loglevel="off";
|
||||
std::string logfilename,language,guistyle,guistylesheetfile;
|
||||
|
||||
argstream as(argc,argv);
|
||||
as >> option('s',"stderr" ,conf.outStderr ,"output to stderr instead of log file." )
|
||||
>> option('u',"udp" ,conf.udpListenerOnly,"Only listen to UDP." )
|
||||
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory", "Set base directory." ,false)
|
||||
>> parameter('l',"log-file" ,conf.logfname ,"logfile" ,"Set Log filename." ,false)
|
||||
>> parameter('d',"debug-level" ,conf.debugLevel ,"level" ,"Set debug level." ,false)
|
||||
>> parameter('i',"ip-address" ,conf.forcedInetAddress,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false)
|
||||
>> parameter('p',"port" ,conf.forcedPort ,"port" ,"Set listenning port to use." ,false)
|
||||
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode" ,"Set Operating mode (Full, NoTurtle, Gaming, Minimal)." ,false)
|
||||
>> parameter('t',"opmode" ,conf.userSuppliedTorExecutable,"tor" ,"supply full tor eecutable path." ,false);
|
||||
as >> option( 's',"stderr" ,conf.outStderr ,"output to stderr instead of log file " )
|
||||
>> option( 'u',"udp" ,conf.udpListenerOnly ,"Only listen to UDP " )
|
||||
>> option( 'R',"reset" ,conf.optResetParams ,"reset retroshare parameters " )
|
||||
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory" ,"Set base directory " ,false)
|
||||
>> parameter('l',"log-file" ,logfilename ,"logfile" ,"Set Log filename " ,false)
|
||||
>> parameter('d',"debug-level" ,loglevel ,"level (debug,info,notice,warn,error,off)","Set debug level " ,false)
|
||||
>> parameter('i',"ip-address" ,conf.forcedInetAddress ,"nnn.nnn.nnn.nnn" ,"Force IP address " ,false)
|
||||
>> parameter('p',"port" ,conf.forcedPort ,"port" ,"Set listenning port " ,false)
|
||||
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode (Full, NoTurtle, Gaming, Minimal)","Set mode" ,false)
|
||||
>> parameter('t',"tor" ,conf.userSuppliedTorExecutable,"path" ,"supply full tor executable path " ,false)
|
||||
>> parameter('g',"style" ,guistyle ,"style (fusion,windows,gtk2,breeze)" ,"set GUI style" ,false)
|
||||
>> parameter('k',"style" ,guistylesheetfile ,"file" ,"gui stylesheet file" ,false)
|
||||
>> parameter('L',"lang" ,language ,"langage (fr,cn,...)" ,"set language" ,false)
|
||||
>> parameter('r',"link" ,rslink ,"retroshare link" ,"retroshare link to open (passed to running server)" ,false)
|
||||
>> parameter('f',"rsfile" ,rsfile ,"rsfile" ,"rscollection file to open (passed to running server)" ,false);
|
||||
#ifdef RS_JSONAPI
|
||||
as >> parameter('J', "jsonApiPort", conf.jsonApiPort, "jsonApiPort", "Enable JSON API on the specified port", false )
|
||||
>> parameter('P', "jsonApiBindAddress", conf.jsonApiBindAddress, "jsonApiBindAddress", "JSON API Bind Address.", false);
|
||||
as >> parameter('J', "jsonApiPort" ,conf.jsonApiPort ,"jsonApiPort" ,"Enable JSON API on the specified port" ,false)
|
||||
>> parameter('P', "jsonApiBindAddress",conf.jsonApiBindAddress ,"jsonApiBindAddress" ,"JSON API Bind Address " ,false);
|
||||
#endif // ifdef RS_JSONAPI
|
||||
|
||||
#ifdef LOCALNET_TESTING
|
||||
as >> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false);
|
||||
as >> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction " ,false);
|
||||
#endif // ifdef LOCALNET_TESTING
|
||||
|
||||
#ifdef RS_AUTOLOGIN
|
||||
as >> option('a',"auto-login" ,conf.autoLogin ,"AutoLogin (Windows Only) + StartMinimised");
|
||||
#endif // ifdef RS_AUTOLOGIN
|
||||
as >> values<std::string>(std::back_inserter(links_and_files),"links and rscollection files")
|
||||
>> help('h',"help",QObject::tr("Display this help").toStdString().c_str());
|
||||
|
||||
if(!as.isOk())
|
||||
{
|
||||
std::cerr << "Incorrect arguments." << std::endl;
|
||||
std::cerr << as.usage() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
conf.logFileName = QString::fromStdString(logfilename);
|
||||
conf.logLevel = QString::fromStdString(loglevel); // these will be checked when used in RsApplication
|
||||
conf.guiStyle = QString::fromStdString(guistyle); // these will be checked when used in RsApplication
|
||||
conf.guiStyleSheetFile = QString::fromUtf8(guistylesheetfile.c_str());// these will be checked when used in RsApplication
|
||||
|
||||
if(as.helpRequested())
|
||||
{
|
||||
showHelp(as);
|
||||
return 0;
|
||||
}
|
||||
// Look for parameters to be transmitted to running server
|
||||
|
||||
if((!rslink.empty() || !rsfile.empty() || !links_and_files.empty() || !conf.opModeStr.empty()) && notifyRunningInstance())
|
||||
{
|
||||
QStringList args;
|
||||
RsErr() << "Sending rscollection files, retroshare links and opmode parameters to the runnning retroshare server." ;
|
||||
|
||||
if(!rslink.empty()) { args.push_back("-l"); args.push_back(QString::fromUtf8(rslink.c_str())); }
|
||||
if(!rsfile.empty()) { args.push_back("-f"); args.push_back(QString::fromUtf8(rsfile.c_str())); }
|
||||
|
||||
for(auto s:links_and_files)
|
||||
args.push_back(QString::fromUtf8(s.c_str()));
|
||||
|
||||
if(!conf.opModeStr.empty()) { args.push_back("-o"); args.push_back(QString::fromStdString(conf.opModeStr)); }
|
||||
|
||||
sendArgsToRunningInstance(args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Now start RS login system
|
||||
|
||||
conf.main_executable_path = argv[0];
|
||||
|
||||
@ -263,7 +434,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
{
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
/* Translate into the desired language */
|
||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||
|
||||
if(!setLanguage(language))
|
||||
return 1;
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has it's own keyring shared by all RetroShare instances. <br><br>You do not appear to have such a keyring, although PGP keys are mentioned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
||||
@ -294,7 +467,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
/* Error occured */
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
/* Translate into the desired language */
|
||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||
|
||||
if(!setLanguage(language))
|
||||
return 1;
|
||||
|
||||
displayWarningAboutDSAKeys();
|
||||
|
||||
@ -322,8 +497,15 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
in this case it can be use only for default values */
|
||||
RshareSettings::Create ();
|
||||
|
||||
if(LanguageSupport::isValidLanguageCode(QString::fromStdString(language)))
|
||||
conf.language = QString::fromStdString(language);
|
||||
|
||||
/* Setup The GUI Stuff */
|
||||
Rshare rshare(args, argc, argv, QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||
//Rshare rshare(args, argc, argv, QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||
RsApplication rshare(conf);
|
||||
|
||||
if(!setLanguage(language))
|
||||
return 1;
|
||||
|
||||
/* Start RetroShare */
|
||||
QString sDefaultGXSIdToCreate = "";
|
||||
@ -371,7 +553,11 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
RsAccounts::GetPreferredAccountId(preferredId);
|
||||
|
||||
// true: note auto-login is active
|
||||
Rshare::loadCertificate(preferredId, true);
|
||||
if(!RsApplication::loadCertificate(preferredId, true))
|
||||
{
|
||||
RsErr() << "Retroshare auto-login startup failed." ;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -383,7 +569,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
|
||||
/* recreate global settings object, now with correct path, specific to the selected node */
|
||||
RshareSettings::Create(true);
|
||||
Rshare::resetLanguageAndStyle();
|
||||
RsApplication::resetLanguageAndStyle();
|
||||
|
||||
SoundManager::create();
|
||||
|
||||
@ -402,7 +588,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
|
||||
std::string tor_hidden_service_dir = RsAccounts::AccountDirectory() + "/hidden_service/" ;
|
||||
|
||||
RsTor::setTorDataDirectory(Rshare::dataDirectory().toStdString() + "/tor/");
|
||||
RsTor::setTorDataDirectory(RsApplication::dataDirectory().toStdString() + "/tor/");
|
||||
RsTor::setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
|
||||
|
||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir)) ;
|
||||
@ -485,7 +671,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address,proxy_server_port) ;
|
||||
}
|
||||
|
||||
Rshare::initPlugins();
|
||||
RsApplication::initPlugins();
|
||||
|
||||
splashScreen.showMessage(rshare.translate("SplashScreen", "Create interface"), Qt::AlignHCenter | Qt::AlignBottom);
|
||||
QCoreApplication::processEvents(); // forces splashscreen to show up
|
||||
@ -507,7 +693,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
* only on the first run - as the user might want to change it ;)
|
||||
*/
|
||||
QString osx_style("cleanlooks");
|
||||
Rshare::setStyle(osx_style);
|
||||
RsApplication::setStyle(osx_style);
|
||||
Settings->setInterfaceStyle(osx_style);
|
||||
#endif
|
||||
|
||||
@ -523,8 +709,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
MainWindow *w = MainWindow::Create ();
|
||||
splashScreen.finish(w);
|
||||
|
||||
w->processLastArgs();
|
||||
|
||||
if (!sDefaultGXSIdToCreate.isEmpty()) {
|
||||
RsIdentityParameters params;
|
||||
params.nickname = sDefaultGXSIdToCreate.toUtf8().constData();
|
||||
|
@ -50,55 +50,22 @@
|
||||
#include <lang/languagesupport.h>
|
||||
#include <util/stringutil.h>
|
||||
|
||||
#include <util/argstream.h>
|
||||
#include <retroshare/rsinit.h>
|
||||
#include <retroshare/rsversion.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
||||
#include "rshare.h"
|
||||
|
||||
/* Available command-line arguments. */
|
||||
#define ARG_RESET "reset" /**< Reset Rshare's saved settings. */
|
||||
#define ARG_DATADIR "datadir" /**< Directory to use for data files. */
|
||||
#define ARG_LOGFILE "logfile" /**< Location of our logfile. */
|
||||
#define ARG_LOGLEVEL "loglevel" /**< Log verbosity. */
|
||||
#define ARG_GUISTYLE "style" /**< Argument specfying GUI style. */
|
||||
#define ARG_GUISTYLESHEET "stylesheet" /**< Argument specfying GUI style. */
|
||||
#define ARG_LANGUAGE "lang" /**< Argument specifying language. */
|
||||
#define ARG_OPMODE_S "o" /**< OpMode (Full, NoTurtle, Gaming, Minimal) */
|
||||
#define ARG_OPMODE_L "opmode" /**< OpMode (Full, NoTurtle, Gaming, Minimal) */
|
||||
#define ARG_RSLINK_S "r" /**< Open RsLink with protocol retroshare:// */
|
||||
#define ARG_RSLINK_L "link" /**< Open RsLink with protocol retroshare:// */
|
||||
#define ARG_RSFILE_S "f" /**< Open RsFile with or without arg. */
|
||||
#define ARG_RSFILE_L "rsfile" /**< Open RsFile with or without arg. */
|
||||
//Other defined for server in /libretroshare/src/rsserver/rsinit.cc:351
|
||||
#ifdef __APPLE__
|
||||
QStringList RsApplication::_links; /**< List of links passed by arguments. */
|
||||
QStringList RsApplication::_files; /**< List of files passed by arguments. */
|
||||
#endif
|
||||
|
||||
// The arguments here can be send to a running instance.
|
||||
// If the command line contains arguments not listed here, we have to start a new instance.
|
||||
// For example, the user wants to start a second instance using --base-dir arg of libretroshare.
|
||||
static const char* const forwardableArgs[] = {
|
||||
ARG_OPMODE_S,
|
||||
ARG_OPMODE_L,
|
||||
ARG_RSLINK_S,
|
||||
ARG_RSLINK_L,
|
||||
ARG_RSFILE_S,
|
||||
ARG_RSFILE_L,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* Static member variables */
|
||||
QMap<QString, QString> Rshare::_args; /**< List of command-line arguments. */
|
||||
Log Rshare::_log; /**< Logs debugging messages to file or stdout. */
|
||||
QString Rshare::_style; /**< The current GUI style. */
|
||||
QString Rshare::_stylesheet; /**< The current GUI stylesheet. */
|
||||
QString Rshare::_language; /**< The current language. */
|
||||
QString Rshare::_dateformat; /**< The format of dates in feed items etc. */
|
||||
QString Rshare::_opmode; /**< The operating mode passed by args. */
|
||||
QStringList Rshare::_links; /**< List of links passed by arguments. */
|
||||
QStringList Rshare::_files; /**< List of files passed by arguments. */
|
||||
QDateTime Rshare::mStartupTime;
|
||||
bool Rshare::useConfigDir;
|
||||
QString Rshare::configDir;
|
||||
QLocalServer* Rshare::localServer;
|
||||
Log RsApplication::log_output; /**< Logs debugging messages to file or stdout. */
|
||||
RsGUIConfigOptions RsApplication::options;
|
||||
QDateTime RsApplication::mStartupTime;
|
||||
QLocalServer* RsApplication::localServer;
|
||||
|
||||
/** 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().
|
||||
@ -133,127 +100,30 @@ void qt_msg_handler(QtMsgType type, const char *msg)
|
||||
}
|
||||
}
|
||||
|
||||
static bool notifyRunningInstance()
|
||||
{
|
||||
// Connect to the Local Server of the main process to notify it
|
||||
// that a new process had been started
|
||||
QLocalSocket localSocket;
|
||||
localSocket.connectToServer(QString(TARGET));
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl;
|
||||
#endif
|
||||
if( localSocket.waitForConnected(100) )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare Connection etablished. Waiting for disconnection." << std::endl;
|
||||
#endif
|
||||
localSocket.waitForDisconnected(1000);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Constructor. Parses the command-line arguments, resets Rshare's
|
||||
/** Constructor. Parses the command-line arguments, resets RsApplication's
|
||||
* configuration (if requested), and sets up the GUI style and language
|
||||
* translation. */
|
||||
Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||
: QApplication(argc, argv)
|
||||
* translation.
|
||||
* the const_cast below is truely horrible, but it allows to hide these unused argc/argv
|
||||
* when initing RsApplication
|
||||
*/
|
||||
|
||||
RsApplication::RsApplication(const RsGUIConfigOptions& conf)
|
||||
: QApplication(const_cast<RsGUIConfigOptions*>(&conf)->argc,const_cast<RsGUIConfigOptions*>(&conf)->argv)
|
||||
{
|
||||
mStartupTime = QDateTime::currentDateTime();
|
||||
localServer = NULL;
|
||||
options = conf;
|
||||
|
||||
//Initialize connection to LocalServer to know if other process runs.
|
||||
{
|
||||
QString serverName = QString(TARGET);
|
||||
|
||||
// check if another instance is running
|
||||
bool haveRunningInstance = notifyRunningInstance();
|
||||
|
||||
bool sendArgsToRunningInstance = haveRunningInstance;
|
||||
if(args.empty())
|
||||
sendArgsToRunningInstance = false;
|
||||
// if we find non-forwardable args, start a new instance
|
||||
for(int iCurs = 0; iCurs < args.size(); ++iCurs)
|
||||
{
|
||||
const char* const* argit = forwardableArgs;
|
||||
bool found = false;
|
||||
while(*argit && iCurs < args.size())
|
||||
{
|
||||
if(args.value(iCurs) == "-"+QString(*argit) || args.value(iCurs) == "--"+QString(*argit))
|
||||
{
|
||||
found = true;
|
||||
if(argNeedsValue(*argit))
|
||||
iCurs++;
|
||||
}
|
||||
argit++;
|
||||
}
|
||||
if(!found)
|
||||
sendArgsToRunningInstance = false;
|
||||
}
|
||||
|
||||
if (sendArgsToRunningInstance) {
|
||||
// load into shared memory
|
||||
QBuffer buffer;
|
||||
buffer.open(QBuffer::ReadWrite);
|
||||
QDataStream out(&buffer);
|
||||
out << args;
|
||||
int size = buffer.size();
|
||||
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(serverName + "_newArgs");
|
||||
if (newArgs.isAttached()) newArgs.detach();
|
||||
|
||||
if (!newArgs.create(size)) {
|
||||
std::cerr << "(EE) Rshare::Rshare Unable to create shared memory segment of size:"
|
||||
<< size << " error:" << newArgs.errorString().toStdString() << "." << std::endl;
|
||||
#ifdef Q_OS_UNIX
|
||||
std::cerr << "Look with `ipcs -m` for nattch==0 segment. And remove it with `ipcrm -m 'shmid'`." << std::endl;
|
||||
//No need for windows, as it removes shared segment directly even when crash.
|
||||
#endif
|
||||
newArgs.detach();
|
||||
::exit(EXIT_FAILURE);
|
||||
}
|
||||
newArgs.lock();
|
||||
char *to = (char*)newArgs.data();
|
||||
const char *from = buffer.data().data();
|
||||
memcpy(to, from, qMin(newArgs.size(), size));
|
||||
newArgs.unlock();
|
||||
|
||||
std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl;
|
||||
if(notifyRunningInstance())
|
||||
{
|
||||
newArgs.detach();
|
||||
std::cerr << "Rshare::Rshare Arguments was sended." << std::endl
|
||||
<< " To disable it, in Options - General - Misc," << std::endl
|
||||
<< " uncheck \"Use Local Server to get new Arguments\"." << std::endl;
|
||||
::exit(EXIT_SUCCESS); // Terminate the program using STDLib's exit function
|
||||
}
|
||||
else
|
||||
std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl;
|
||||
newArgs.detach();
|
||||
}
|
||||
|
||||
if(!haveRunningInstance)
|
||||
{
|
||||
// No main process exists
|
||||
// Or started without arguments
|
||||
// So we start a Local Server to listen for connections from new process
|
||||
localServer= new QLocalServer();
|
||||
QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished()));
|
||||
updateLocalServer();
|
||||
|
||||
// clear out any old arguments (race condition?)
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(QString(TARGET) + "_newArgs");
|
||||
if(newArgs.attach(QSharedMemory::ReadWrite))
|
||||
newArgs.detach();
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
qInstallMessageHandler(qt_msg_handler);
|
||||
@ -279,32 +149,22 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||
connect(timer, SIGNAL(timeout()), this, SIGNAL(minuteTick()));
|
||||
timer->start();
|
||||
|
||||
/* Read in all our command-line arguments. */
|
||||
parseArguments(args);
|
||||
|
||||
/* Check if we're supposed to reset our config before proceeding. */
|
||||
if (_args.contains(ARG_RESET)) {
|
||||
if (options.optResetParams)
|
||||
{
|
||||
RsInfo() << "Resetting Retroshare config parameters, as requested (option -R)";
|
||||
Settings->reset();
|
||||
}
|
||||
|
||||
/* Handle the -loglevel and -logfile options. */
|
||||
if (_args.contains(ARG_LOGFILE))
|
||||
_log.open(_args.value(ARG_LOGFILE));
|
||||
if (_args.contains(ARG_LOGLEVEL)) {
|
||||
_log.setLogLevel(Log::stringToLogLevel(
|
||||
_args.value(ARG_LOGLEVEL)));
|
||||
if (!_args.contains(ARG_LOGFILE))
|
||||
_log.open(stdout);
|
||||
}
|
||||
if (!_args.contains(ARG_LOGLEVEL) &&
|
||||
!_args.contains(ARG_LOGFILE))
|
||||
_log.setLogLevel(Log::Off);
|
||||
|
||||
/* config directory */
|
||||
useConfigDir = false;
|
||||
if (dir != "")
|
||||
if (options.logLevel != "Off")
|
||||
{
|
||||
setConfigDirectory(dir);
|
||||
if (!options.logFileName.isNull())
|
||||
log_output.open(options.logFileName);
|
||||
else
|
||||
log_output.open(stdout);
|
||||
|
||||
log_output.setLogLevel(Log::stringToLogLevel(options.logLevel));
|
||||
}
|
||||
|
||||
/** Initialize support for language translations. */
|
||||
@ -320,7 +180,7 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||
}
|
||||
|
||||
/** Destructor */
|
||||
Rshare::~Rshare()
|
||||
RsApplication::~RsApplication()
|
||||
{
|
||||
/* Cleanup GxsIdDetails */
|
||||
GxsIdDetails::cleanup();
|
||||
@ -334,7 +194,7 @@ Rshare::~Rshare()
|
||||
/**
|
||||
* @brief Executed when new instance connect command is sent to LocalServer
|
||||
*/
|
||||
void Rshare::slotConnectionEstablished()
|
||||
void RsApplication::slotConnectionEstablished()
|
||||
{
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(QString(TARGET) + "_newArgs");
|
||||
@ -346,7 +206,7 @@ void Rshare::slotConnectionEstablished()
|
||||
/* this is not an error. It just means we were notified to check
|
||||
newArgs, but none had been set yet.
|
||||
TODO: implement separate ping/take messages
|
||||
std::cerr << "(EE) Rshare::slotConnectionEstablished() Unable to attach to shared memory segment."
|
||||
std::cerr << "(EE) RsApplication::slotConnectionEstablished() Unable to attach to shared memory segment."
|
||||
<< newArgs.errorString().toStdString() << std::endl;
|
||||
*/
|
||||
socket->close();
|
||||
@ -357,6 +217,11 @@ void Rshare::slotConnectionEstablished()
|
||||
socket->close();
|
||||
delete socket;
|
||||
|
||||
if(newArgs.error())
|
||||
{
|
||||
RsErr() << "Something when wrong in receiving arguments from operating system: " << newArgs.errorString().toStdString() ;
|
||||
return ;
|
||||
}
|
||||
QBuffer buffer;
|
||||
QDataStream in(&buffer);
|
||||
QStringList args;
|
||||
@ -371,22 +236,22 @@ void Rshare::slotConnectionEstablished()
|
||||
emit newArgsReceived(args);
|
||||
while (!args.empty())
|
||||
{
|
||||
std::cerr << "Rshare::slotConnectionEstablished args:" << QString(args.takeFirst()).toStdString() << std::endl;
|
||||
std::cerr << "RsApplication::slotConnectionEstablished args:" << QString(args.takeFirst()).toStdString() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
QString Rshare::retroshareVersion(bool) { return RS_HUMAN_READABLE_VERSION; }
|
||||
QString RsApplication::retroshareVersion(bool) { return RS_HUMAN_READABLE_VERSION; }
|
||||
|
||||
/** Enters the main event loop and waits until exit() is called. The signal
|
||||
* running() will be emitted when the event loop has started. */
|
||||
int
|
||||
Rshare::run()
|
||||
RsApplication::run()
|
||||
{
|
||||
QTimer::singleShot(0, rApp, SLOT(onEventLoopStarted()));
|
||||
return rApp->exec();
|
||||
}
|
||||
|
||||
QDateTime Rshare::startupTime()
|
||||
QDateTime RsApplication::startupTime()
|
||||
{
|
||||
return mStartupTime;
|
||||
}
|
||||
@ -395,203 +260,17 @@ QDateTime Rshare::startupTime()
|
||||
* will emit the running() signal to indicate that the application's event
|
||||
* loop is running. */
|
||||
void
|
||||
Rshare::onEventLoopStarted()
|
||||
RsApplication::onEventLoopStarted()
|
||||
{
|
||||
emit running();
|
||||
}
|
||||
|
||||
/** Display usage information regarding command-line arguments. */
|
||||
/*void
|
||||
Rshare::printUsage(QString errmsg)
|
||||
{
|
||||
QTextStream out(stdout);*/
|
||||
|
||||
/* If there was an error message, print it out. */
|
||||
/*if (!errmsg.isEmpty()) {
|
||||
out << "** " << errmsg << " **" << endl << endl;
|
||||
}*/
|
||||
|
||||
/* Now print the application usage */
|
||||
//out << "Usage: " << endl;
|
||||
//out << "\t" << qApp->arguments().at(0) << " [options]" << endl;
|
||||
|
||||
/* And available options */
|
||||
//out << endl << "Available Options:" << endl;
|
||||
//out << "\t-"ARG_RESET"\t\tResets ALL stored Rshare settings." << endl;
|
||||
//out << "\t-"ARG_DATADIR"\tSets the directory Rshare uses for data files"<< endl;
|
||||
//out << "\t-"ARG_GUISTYLE"\t\tSets Rshare's interface style." << endl;
|
||||
//out << "\t-"ARG_GUISTYLESHEET"\t\tSets Rshare's stylesheet." << endl;
|
||||
//out << "\t\t\t[" << QStyleFactory::keys().join("|") << "]" << endl;
|
||||
//out << "\t-"ARG_LANGUAGE"\t\tSets Rshare's language." << endl;
|
||||
//out << "\t\t\t[" << LanguageSupport::languageCodes().join("|") << "]" << endl;
|
||||
//}
|
||||
|
||||
/** Displays usage information for command-line args. */
|
||||
void
|
||||
Rshare::showUsageMessageBox()
|
||||
{
|
||||
QString usage;
|
||||
QTextStream out(&usage);
|
||||
|
||||
out << "Available Options:" << endl;
|
||||
out << "<table>";
|
||||
//out << trow(tcol("-"ARG_HELP) +
|
||||
// tcol(tr("Displays this usage message and exits.")));
|
||||
out << trow(tcol("-" ARG_RESET) +
|
||||
tcol(tr("Resets ALL stored RetroShare settings.")));
|
||||
out << trow(tcol("-" ARG_DATADIR" <dir>") +
|
||||
tcol(tr("Sets the directory RetroShare uses for data files.")));
|
||||
out << trow(tcol("-" ARG_LOGFILE" <" + tr("filename") + ">") +
|
||||
tcol(tr("Sets the name and location of RetroShare's logfile.")));
|
||||
out << trow(tcol("-" ARG_LOGLEVEL" <" + tr("level") + ">") +
|
||||
tcol(tr("Sets the verbosity of RetroShare's logging.") +
|
||||
"<br>[" + Log::logLevels().join("|") +"]"));
|
||||
out << trow(tcol("-" ARG_GUISTYLE" <" + tr("style") +">") +
|
||||
tcol(tr("Sets RetroShare's interface style.") +
|
||||
"<br>[" + QStyleFactory::keys().join("|") + "]"));
|
||||
out << trow(tcol("-" ARG_GUISTYLESHEET" <" + tr("stylesheet") + ">") +
|
||||
tcol(tr("Sets RetroShare's interface stylesheets.")));
|
||||
out << trow(tcol("-" ARG_LANGUAGE" <" + tr("language") + ">") +
|
||||
tcol(tr("Sets RetroShare's language.") +
|
||||
"<br>[" + LanguageSupport::languageCodes().join("|") + "]"));
|
||||
out << trow(tcol("--" ARG_OPMODE_L" <" + tr("opmode") + ">") +
|
||||
tcol(tr("Sets RetroShare's operating mode.") +
|
||||
"<br>[full|noturtle|gaming|minimal]"));
|
||||
out << trow(tcol("-" ARG_RSLINK_L" <" + tr("RsLinkURL") + ">") +
|
||||
tcol(tr("Open RsLink with protocol retroshare://")));
|
||||
out << trow(tcol("-" ARG_RSFILE_L" <" + tr("filename") + ">") +
|
||||
tcol(tr("Open RsFile with or without arg.")));
|
||||
out << "</table>";
|
||||
|
||||
VMessageBox::information(0,
|
||||
tr("RetroShare GUI Usage Information"), usage, VMessageBox::Ok);
|
||||
}
|
||||
|
||||
/** Returns true if the specified argument expects a value. */
|
||||
bool
|
||||
Rshare::argNeedsValue(const QString &argName)
|
||||
{
|
||||
return (
|
||||
argName == ARG_DATADIR ||
|
||||
argName == ARG_LOGFILE ||
|
||||
argName == ARG_LOGLEVEL ||
|
||||
argName == ARG_GUISTYLE ||
|
||||
argName == ARG_GUISTYLESHEET ||
|
||||
argName == ARG_LANGUAGE ||
|
||||
argName == ARG_OPMODE_S ||
|
||||
argName == ARG_OPMODE_L ||
|
||||
argName == ARG_RSLINK_S ||
|
||||
argName == ARG_RSLINK_L ||
|
||||
argName == ARG_RSFILE_S ||
|
||||
argName == ARG_RSFILE_L );
|
||||
}
|
||||
|
||||
/** Parses the list of command-line arguments for their argument names and
|
||||
* values. */
|
||||
void
|
||||
Rshare::parseArguments(QStringList args, bool firstRun)
|
||||
{
|
||||
QString arg, argl, value;
|
||||
|
||||
/* Loop through all command-line args/values and put them in a map */
|
||||
for (int iCurs = 0; iCurs < args.size(); ++iCurs) {
|
||||
/* Get the argument name and set a blank value */
|
||||
arg = args.at(iCurs);//.toLower(); Need Upper case for file name.
|
||||
argl = arg.toLower();
|
||||
if (argl == "empty") continue;
|
||||
value = "";
|
||||
|
||||
/* Check if it starts with a - or -- */
|
||||
if (arg.startsWith("-")) {
|
||||
arg = arg.mid((arg.startsWith("--") ? 2 : 1));
|
||||
/* Check if it takes a value and there is one on the command-line */
|
||||
if (iCurs < args.size()-1 && argNeedsValue(arg)) {
|
||||
value = args.at(++iCurs);
|
||||
}
|
||||
} else {
|
||||
/* Check if links or files without arg */
|
||||
if (argl.startsWith("retroshare://")) {
|
||||
value = arg;
|
||||
arg = ARG_RSLINK_L;
|
||||
} else {
|
||||
if (QFile(arg).exists()) {
|
||||
value = arg;
|
||||
arg = ARG_RSFILE_L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* handle opmode that could be change while running.*/
|
||||
QString omValue = QString(value).prepend(";").append(";").toLower();
|
||||
QString omValues = QString(";full;noturtle;gaming;minimal;");
|
||||
if ((arg == ARG_OPMODE_S || arg == ARG_OPMODE_L )
|
||||
&& omValues.contains(omValue)) {
|
||||
_opmode = value;
|
||||
}
|
||||
|
||||
/* Don't send theses argument to _args map to allow multiple. */
|
||||
if (arg == ARG_RSLINK_S || arg == ARG_RSLINK_L) {
|
||||
_links.append(value);
|
||||
} else if (arg == ARG_RSFILE_S || arg == ARG_RSFILE_L) {
|
||||
_files.append(value);
|
||||
} else if (firstRun) {
|
||||
/* Place this arg/value in the map only first time*/
|
||||
_args.insert(arg, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Verifies that all specified arguments were valid. */
|
||||
bool
|
||||
Rshare::validateArguments(QString &errmsg)
|
||||
{
|
||||
/* Check for a writable log file */
|
||||
if (_args.contains(ARG_LOGFILE) && !_log.isOpen()) {
|
||||
errmsg = tr("Unable to open log file '%1': %2")
|
||||
.arg( _args.value(ARG_LOGFILE)
|
||||
, _log.errorString());
|
||||
return false;
|
||||
}
|
||||
/* Check for a valid log level */
|
||||
if (_args.contains(ARG_LOGLEVEL) &&
|
||||
!Log::logLevels().contains(_args.value(ARG_LOGLEVEL))) {
|
||||
errmsg = tr("Invalid log level specified:")+" " + _args.value(ARG_LOGLEVEL);
|
||||
return false;
|
||||
}
|
||||
/* Check for a valid GUI style */
|
||||
if (_args.contains(ARG_GUISTYLE) &&
|
||||
!QStyleFactory::keys().contains(_args.value(ARG_GUISTYLE),
|
||||
Qt::CaseInsensitive)) {
|
||||
errmsg = tr("Invalid GUI style specified:")+" " + _args.value(ARG_GUISTYLE);
|
||||
return false;
|
||||
}
|
||||
/* Check for a language that Retroshare recognizes. */
|
||||
if (_args.contains(ARG_LANGUAGE) &&
|
||||
!LanguageSupport::isValidLanguageCode(_args.value(ARG_LANGUAGE))) {
|
||||
errmsg = tr("Invalid language code specified:")+" " + _args.value(ARG_LANGUAGE);
|
||||
return false;
|
||||
}
|
||||
/* Check for an opmode that Retroshare recognizes. */
|
||||
if (_args.contains(ARG_OPMODE_S) &&
|
||||
!QString(";full;noturtle;gaming;minimal;").contains(QString(_args.value(ARG_OPMODE_S)).prepend(";").append(";").toLower())) {
|
||||
errmsg = tr("Invalid operating mode specified:")+" " + _args.value(ARG_OPMODE_S);
|
||||
return false;
|
||||
}
|
||||
/* Check for an opmode that Retroshare recognizes. */
|
||||
if (_args.contains(ARG_OPMODE_L) &&
|
||||
!QString(";full;noturtle;gaming;minimal;").contains(QString(_args.value(ARG_OPMODE_L)).prepend(";").append(";").toLower())) {
|
||||
errmsg = tr("Invalid operating mode specified:")+" " + _args.value(ARG_OPMODE_L);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Sets the translation RetroShare will use. If one was specified on the
|
||||
* command-line, we will use that. Otherwise, we'll check to see if one was
|
||||
* saved previously. If not, we'll default to one appropriate for the system
|
||||
* locale. */
|
||||
bool
|
||||
Rshare::setLanguage(QString languageCode)
|
||||
RsApplication::setLanguage(QString languageCode)
|
||||
{
|
||||
/* If the language code is empty, use the previously-saved setting */
|
||||
if (languageCode.isEmpty()) {
|
||||
@ -599,7 +278,7 @@ Rshare::setLanguage(QString languageCode)
|
||||
}
|
||||
/* Translate into the desired language */
|
||||
if (LanguageSupport::translate(languageCode)) {
|
||||
_language = languageCode;
|
||||
options.language = languageCode;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -610,7 +289,7 @@ Rshare::setLanguage(QString languageCode)
|
||||
* saved previously. If not, we'll default to the system
|
||||
* locale. */
|
||||
bool
|
||||
Rshare::setLocale(QString languageCode)
|
||||
RsApplication::setLocale(QString languageCode)
|
||||
{
|
||||
bool retVal = false;
|
||||
/* If the language code is empty, use the previously-saved setting */
|
||||
@ -626,20 +305,20 @@ Rshare::setLocale(QString languageCode)
|
||||
}
|
||||
|
||||
/** customize date format for feeds etc. */
|
||||
void Rshare::customizeDateFormat()
|
||||
void RsApplication::customizeDateFormat()
|
||||
{
|
||||
QLocale locale = QLocale(); // set to default locale
|
||||
/* get long date format without weekday */
|
||||
_dateformat = locale.dateFormat(QLocale::LongFormat);
|
||||
_dateformat.replace(QRegExp("^dddd,*[^ ]* *('[^']+' )*"), "");
|
||||
_dateformat.replace(QRegExp(",* *dddd"), "");
|
||||
_dateformat = _dateformat.trimmed();
|
||||
options.dateformat = locale.dateFormat(QLocale::LongFormat);
|
||||
options.dateformat.replace(QRegExp("^dddd,*[^ ]* *('[^']+' )*"), "");
|
||||
options.dateformat.replace(QRegExp(",* *dddd"), "");
|
||||
options.dateformat = options.dateformat.trimmed();
|
||||
}
|
||||
|
||||
/** Get custom date format (defaultlongformat) */
|
||||
QString Rshare::customDateFormat()
|
||||
QString RsApplication::customDateFormat()
|
||||
{
|
||||
return _dateformat;
|
||||
return options.dateformat;
|
||||
}
|
||||
|
||||
/** Sets the GUI style RetroShare will use. If one was specified on the
|
||||
@ -647,49 +326,50 @@ QString Rshare::customDateFormat()
|
||||
* saved previously. If not, we'll default to one appropriate for the
|
||||
* operating system. */
|
||||
bool
|
||||
Rshare::setStyle(QString styleKey)
|
||||
RsApplication::setStyle(QString styleKey)
|
||||
{
|
||||
/* If no style was specified, use the previously-saved setting */
|
||||
if (styleKey.isEmpty()) {
|
||||
styleKey = Settings->getInterfaceStyle();
|
||||
}
|
||||
/* Apply the specified GUI style */
|
||||
if (QApplication::setStyle(styleKey)) {
|
||||
_style = styleKey;
|
||||
if (QApplication::setStyle(styleKey))
|
||||
{
|
||||
options.guiStyle = styleKey;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Rshare::setSheet(QString sheet)
|
||||
RsApplication::setSheet(QString sheet)
|
||||
{
|
||||
/* If no stylesheet was specified, use the previously-saved setting */
|
||||
if (sheet.isEmpty()) {
|
||||
sheet = Settings->getSheetName();
|
||||
}
|
||||
/* Apply the specified GUI stylesheet */
|
||||
_stylesheet = sheet;
|
||||
options.guiStyleSheetFile = sheet;
|
||||
|
||||
/* load the StyleSheet*/
|
||||
loadStyleSheet(_stylesheet);
|
||||
loadStyleSheet(options.guiStyleSheetFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Rshare::resetLanguageAndStyle()
|
||||
void RsApplication::resetLanguageAndStyle()
|
||||
{
|
||||
/** Translate the GUI to the appropriate language. */
|
||||
setLanguage(_args.value(ARG_LANGUAGE));
|
||||
setLanguage(options.language);
|
||||
|
||||
/** Set the locale appropriately. */
|
||||
setLocale(_args.value(ARG_LANGUAGE));
|
||||
setLocale(options.language);
|
||||
|
||||
/** Set the GUI style appropriately. */
|
||||
setStyle(_args.value(ARG_GUISTYLE));
|
||||
setStyle(options.guiStyle);
|
||||
|
||||
/** Set the GUI stylesheet appropriately. */
|
||||
setSheet(_args.value(ARG_GUISTYLESHEET));
|
||||
setSheet(options.guiStyleSheetFile);
|
||||
}
|
||||
|
||||
// RetroShare:
|
||||
@ -714,7 +394,7 @@ void Rshare::resetLanguageAndStyle()
|
||||
// Language depended stylesheet
|
||||
// <Internal|External>_<locale>.lqss
|
||||
|
||||
void Rshare::loadStyleSheet(const QString &sheetName)
|
||||
void RsApplication::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
QString locale = QLocale().name();
|
||||
QString styleSheet;
|
||||
@ -785,7 +465,7 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
||||
}
|
||||
|
||||
/** get list of available stylesheets **/
|
||||
void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
||||
void RsApplication::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
||||
{
|
||||
QFileInfoList fileInfoList = QDir(":/qss/stylesheet/").entryInfoList(QStringList("*.qss"));
|
||||
QFileInfo fileInfo;
|
||||
@ -813,7 +493,7 @@ void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
||||
}
|
||||
}
|
||||
|
||||
void Rshare::refreshStyleSheet(QWidget *widget, bool processChildren)
|
||||
void RsApplication::refreshStyleSheet(QWidget *widget, bool processChildren)
|
||||
{
|
||||
if (widget != NULL) {
|
||||
// force widget to recalculate valid style
|
||||
@ -839,40 +519,35 @@ void Rshare::refreshStyleSheet(QWidget *widget, bool processChildren)
|
||||
}
|
||||
|
||||
/** Initialize plugins. */
|
||||
void Rshare::initPlugins()
|
||||
void RsApplication::initPlugins()
|
||||
{
|
||||
loadStyleSheet(_stylesheet);
|
||||
LanguageSupport::translatePlugins(_language);
|
||||
loadStyleSheet(options.guiStyleSheetFile);
|
||||
LanguageSupport::translatePlugins(options.language);
|
||||
}
|
||||
|
||||
/** Returns the directory RetroShare uses for its data files. */
|
||||
QString
|
||||
Rshare::dataDirectory()
|
||||
QString RsApplication::dataDirectory()
|
||||
{
|
||||
if (useConfigDir)
|
||||
{
|
||||
return configDir;
|
||||
}
|
||||
else if (_args.contains(ARG_DATADIR)) {
|
||||
return _args.value(ARG_DATADIR);
|
||||
}
|
||||
if(!options.optBaseDir.empty())
|
||||
return QString::fromUtf8(options.optBaseDir.c_str());
|
||||
else
|
||||
return defaultDataDirectory();
|
||||
}
|
||||
|
||||
/** Returns the default location of RetroShare's data directory. */
|
||||
QString
|
||||
Rshare::defaultDataDirectory()
|
||||
RsApplication::defaultDataDirectory()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return (win32_app_data_folder() + "\\RetroShare");
|
||||
#else
|
||||
return (QDir::homePath() + "/.RetroShare");
|
||||
return (QDir::homePath() + "/.retroshare");
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Creates Rshare's data directory, if it doesn't already exist. */
|
||||
/** Creates RsApplication's data directory, if it doesn't already exist. */
|
||||
bool
|
||||
Rshare::createDataDirectory(QString *errmsg)
|
||||
RsApplication::createDataDirectory(QString *errmsg)
|
||||
{
|
||||
QDir datadir(dataDirectory());
|
||||
if (!datadir.exists()) {
|
||||
@ -885,33 +560,29 @@ Rshare::createDataDirectory(QString *errmsg)
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set Rshare's data directory - externally */
|
||||
bool Rshare::setConfigDirectory(const QString& dir)
|
||||
/** Set RsApplication's data directory - externally */
|
||||
bool RsApplication::setConfigDirectory(const QString& dir)
|
||||
{
|
||||
useConfigDir = true;
|
||||
configDir = dir;
|
||||
options.optBaseDir = std::string(dir.toUtf8());
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Writes <b>msg</b> with severity <b>level</b> to RetroShare's log. */
|
||||
Log::LogMessage
|
||||
Rshare::log(Log::LogLevel level, QString msg)
|
||||
Log::LogMessage RsApplication::log(Log::LogLevel level, QString msg)
|
||||
{
|
||||
return _log.log(level, msg);
|
||||
return log_output.log(level, msg);
|
||||
}
|
||||
|
||||
/** Creates and binds a shortcut such that when <b>key</b> is pressed in
|
||||
* <b>sender</b>'s context, <b>receiver</b>'s <b>slot</b> will be called. */
|
||||
void
|
||||
Rshare::createShortcut(const QKeySequence &key, QWidget *sender,
|
||||
QWidget *receiver, const char *slot)
|
||||
void RsApplication::createShortcut(const QKeySequence &key, QWidget *sender, QWidget *receiver, const char *slot)
|
||||
{
|
||||
QShortcut *s = new QShortcut(key, sender);
|
||||
connect(s, SIGNAL(activated()), receiver, slot);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
bool Rshare::event(QEvent *event)
|
||||
bool RsApplication::event(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::FileOpen:{
|
||||
@ -933,7 +604,7 @@ bool Rshare::event(QEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void Rshare::blinkTimer()
|
||||
void RsApplication::blinkTimer()
|
||||
{
|
||||
mBlink = !mBlink;
|
||||
emit blink(mBlink);
|
||||
@ -944,7 +615,7 @@ void Rshare::blinkTimer()
|
||||
}
|
||||
}
|
||||
|
||||
bool Rshare::loadCertificate(const RsPeerId &accountId, bool autoLogin)
|
||||
bool RsApplication::loadCertificate(const RsPeerId &accountId, bool autoLogin)
|
||||
{
|
||||
if (!RsAccounts::SelectAccount(accountId))
|
||||
{
|
||||
@ -985,14 +656,14 @@ bool Rshare::loadCertificate(const RsPeerId &accountId, bool autoLogin)
|
||||
// QObject::tr("Login Failure"),
|
||||
// QObject::tr("Maybe password is wrong") );
|
||||
return false;
|
||||
default: std::cerr << "Rshare::loadCertificate() unexpected switch value " << retVal << std::endl;
|
||||
default: std::cerr << "RsApplication::loadCertificate() unexpected switch value " << retVal << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rshare::updateLocalServer()
|
||||
bool RsApplication::updateLocalServer()
|
||||
{
|
||||
if (localServer) {
|
||||
QString serverName = QString(TARGET);
|
||||
|
@ -36,9 +36,10 @@
|
||||
#include "util/log.h"
|
||||
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
/** Pointer to this RetroShare application instance. */
|
||||
#define rApp (static_cast<Rshare *>(qApp))
|
||||
#define rApp (static_cast<RsApplication *>(qApp))
|
||||
|
||||
#define rDebug(fmt) (rApp->log(Log::Debug, (fmt)))
|
||||
#define rInfo(fmt) (rApp->log(Log::Info, (fmt)))
|
||||
@ -46,33 +47,40 @@
|
||||
#define rWarn(fmt) (rApp->log(Log::Warn, (fmt)))
|
||||
#define rError(fmt) (rApp->log(Log::Error, (fmt)))
|
||||
|
||||
struct RsGUIConfigOptions: public RsConfigOptions
|
||||
{
|
||||
RsGUIConfigOptions()
|
||||
: optResetParams(false), logLevel("Off"), argc(0)
|
||||
{}
|
||||
|
||||
class Rshare : public QApplication
|
||||
bool optResetParams; // reset all GUI parameters
|
||||
|
||||
QString dateformat; // The format for dates in feed items etc.
|
||||
QString language; // The current language.
|
||||
|
||||
QString logFileName; // output filename for log
|
||||
QString logLevel; // severity threshold for log output
|
||||
|
||||
QString guiStyle; // CSS Style for the GUI
|
||||
QString guiStyleSheetFile; // CSS Style for the GUI
|
||||
|
||||
int argc ; // stores argc parameter. Only used by the creator of QApplication
|
||||
char *argv[1] ; // stores argv parameter. Only used by the creator of QApplication
|
||||
};
|
||||
|
||||
class RsApplication : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Constructor. */
|
||||
Rshare(QStringList args, int &argc, char **argv, const QString &dir);
|
||||
RsApplication(const RsGUIConfigOptions& conf);
|
||||
/** Destructor. */
|
||||
~Rshare();
|
||||
~RsApplication();
|
||||
|
||||
/** Return the version info */
|
||||
static QString retroshareVersion(bool=true);
|
||||
|
||||
/** Return the map of command-line arguments and values. */
|
||||
static QMap<QString, QString> arguments() { return _args; }
|
||||
/** Parse the list of command-line arguments. */
|
||||
static void parseArguments(QStringList args, bool firstRun = true);
|
||||
/** Validates that all arguments were well-formed. */
|
||||
bool validateArguments(QString &errmsg);
|
||||
/** Prints usage information to the given text stream. */
|
||||
//void printUsage(QString errmsg = QString());
|
||||
/** Displays usage information for command-line args. */
|
||||
static void showUsageMessageBox();
|
||||
/** Returns true if the user wants to see usage information. */
|
||||
static bool showUsage();
|
||||
|
||||
/** Sets the current language. */
|
||||
static bool setLanguage(QString languageCode = QString());
|
||||
/** Sets the current locale. */
|
||||
@ -105,17 +113,22 @@ public:
|
||||
static void initPlugins();
|
||||
|
||||
/** Returns the current GUI style. */
|
||||
static QString style() { return _style; }
|
||||
static QString style() { return options.guiStyle; }
|
||||
/** Returns the current GUI stylesheet. */
|
||||
static QString stylesheet() { return _stylesheet; }
|
||||
static QString stylesheet() { return options.guiStyleSheetFile; }
|
||||
/** Returns the current language. */
|
||||
static QString language() { return _language; }
|
||||
/** Returns the operating mode. */
|
||||
static QString opmode() { return _opmode; }
|
||||
static QString language() { return options.language; }
|
||||
|
||||
/** Sets/Returns the operating mode. */
|
||||
static void setOpMode(const QString& op ) { options.opModeStr = op.toStdString(); }
|
||||
static QString opmode() { return QString::fromStdString(options.opModeStr); }
|
||||
|
||||
#ifdef __APPLE__
|
||||
/** Returns links passed by arguments. */
|
||||
static QStringList* links() { return &_links; }
|
||||
/** Returns files passed by arguments. */
|
||||
static QStringList* files() {return &_files; }
|
||||
#endif
|
||||
/** Returns Rshare's application startup time. */
|
||||
static QDateTime startupTime();
|
||||
|
||||
@ -176,24 +189,20 @@ private:
|
||||
/** customize the date format (defaultlongformat) */
|
||||
static void customizeDateFormat();
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
/** Returns true if the specified arguments wants a value. */
|
||||
static bool argNeedsValue(const QString &argName);
|
||||
#endif
|
||||
|
||||
static QMap<QString, QString> _args; /**< List of command-line arguments. */
|
||||
static Log _log; /**< Logs debugging messages to file or stdout. */
|
||||
static QString _style; /**< The current GUI style. */
|
||||
static QString _stylesheet; /**< The current GUI stylesheet. */
|
||||
static QString _language; /**< The current language. */
|
||||
static QString _dateformat; /**< The format for dates in feed items etc. */
|
||||
static QString _opmode; /**< The operating mode passed by args. */
|
||||
#ifdef __APPLE__
|
||||
static QStringList _links; /**< List of links passed by arguments. */
|
||||
static QStringList _files; /**< List of files passed by arguments. */
|
||||
#endif
|
||||
static QDateTime mStartupTime; // startup time
|
||||
|
||||
static bool useConfigDir;
|
||||
static QString configDir;
|
||||
bool mBlink;
|
||||
static QLocalServer* localServer;
|
||||
static RsGUIConfigOptions options;
|
||||
static Log log_output;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@ QString DateTime::formatLongDate(time_t dateValue)
|
||||
|
||||
QString DateTime::formatLongDate(const QDate &dateValue)
|
||||
{
|
||||
QString customDateFormat = Rshare::customDateFormat();
|
||||
QString customDateFormat = RsApplication::customDateFormat();
|
||||
|
||||
if (customDateFormat.isEmpty()) {
|
||||
return dateValue.toString(Qt::ISODate);
|
||||
|
Loading…
Reference in New Issue
Block a user