mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Added three new methods on misc: getOpenFileName, getOpenFileNames and getSaveFileName. Please use this rather than QFileDialog.
Added save and restore of the last used directories for the following types - Extra files - Certificates - History - Images - Messages - Blogs (not tested) It is easy to change. Added attach of multiple files at once in CreateForumMsg. The RetroShare links of the added files in CreateForumMsg are added with new style and as anchor with size information. Added translation to some file dialogs. Removed (commented out) not needed methods in NetworkDialog. Fixed handling of filenames with umlauts when adding extra files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3894 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c1e3947957
commit
f7252fd693
@ -463,6 +463,7 @@ SOURCES += main.cpp \
|
|||||||
util/rsversion.cpp \
|
util/rsversion.cpp \
|
||||||
util/printpreview.cpp \
|
util/printpreview.cpp \
|
||||||
util/log.cpp \
|
util/log.cpp \
|
||||||
|
util/misc.cpp \
|
||||||
gui/bwgraph/bwgraph.cpp \
|
gui/bwgraph/bwgraph.cpp \
|
||||||
gui/profile/ProfileView.cpp \
|
gui/profile/ProfileView.cpp \
|
||||||
gui/profile/ProfileEdit.cpp \
|
gui/profile/ProfileEdit.cpp \
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFileDialog>
|
|
||||||
#include "common/vmessagebox.h"
|
#include "common/vmessagebox.h"
|
||||||
#include "common/StatusDefs.h"
|
#include "common/StatusDefs.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <gpgme.h>
|
#include <gpgme.h>
|
||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
@ -294,51 +293,48 @@ void NetworkDialog::peerdetails()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Open a QFileDialog to browse for a pem/pqi file. */
|
/** Open a QFileDialog to browse for a pem/pqi file. */
|
||||||
void NetworkDialog::loadcert()
|
//void NetworkDialog::loadcert()
|
||||||
{
|
//{
|
||||||
/* Create a new input dialog, which allows users to create files, too */
|
// use misc::getOpenFileName
|
||||||
QFileDialog dialog (this, tr("Select a pem/pqi File"));
|
// /* Create a new input dialog, which allows users to create files, too */
|
||||||
//dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
|
// QFileDialog dialog (this, tr("Select a pem/pqi File"));
|
||||||
//dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
|
// //dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
// //dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
|
||||||
dialog.setReadOnly(false);
|
// dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
// dialog.setReadOnly(false);
|
||||||
/* Prompt the user to select a file or create a new one */
|
//
|
||||||
if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
|
// /* Prompt the user to select a file or create a new one */
|
||||||
return;
|
// if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
|
||||||
}
|
// return;
|
||||||
QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
|
// }
|
||||||
|
// QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
|
||||||
/* Check if the file exists */
|
//
|
||||||
QFile torrcFile(filename);
|
// /* Check if the file exists */
|
||||||
if (!QFileInfo(filename).exists()) {
|
// QFile torrcFile(filename);
|
||||||
/* The given file does not exist. Should we create it? */
|
// if (!QFileInfo(filename).exists()) {
|
||||||
int response = VMessageBox::question(this,
|
// /* The given file does not exist. Should we create it? */
|
||||||
tr("File Not Found"),
|
// int response = VMessageBox::question(this,
|
||||||
tr("%1 does not exist. Would you like to create it?")
|
// tr("File Not Found"),
|
||||||
.arg(filename),
|
// tr("%1 does not exist. Would you like to create it?")
|
||||||
VMessageBox::Yes, VMessageBox::No);
|
// .arg(filename),
|
||||||
|
// VMessageBox::Yes, VMessageBox::No);
|
||||||
if (response == VMessageBox::No) {
|
//
|
||||||
/* Don't create it. Just bail. */
|
// if (response == VMessageBox::No) {
|
||||||
return;
|
// /* Don't create it. Just bail. */
|
||||||
}
|
// return;
|
||||||
/* Attempt to create the specified file */
|
// }
|
||||||
if (!torrcFile.open(QIODevice::WriteOnly)) {
|
// /* Attempt to create the specified file */
|
||||||
VMessageBox::warning(this,
|
// if (!torrcFile.open(QIODevice::WriteOnly)) {
|
||||||
tr("Failed to Create File"),
|
// VMessageBox::warning(this,
|
||||||
tr("Unable to create %1 [%2]").arg(filename)
|
// tr("Failed to Create File"),
|
||||||
.arg(torrcFile.errorString()),
|
// tr("Unable to create %1 [%2]").arg(filename)
|
||||||
VMessageBox::Ok);
|
// .arg(torrcFile.errorString()),
|
||||||
return;
|
// VMessageBox::Ok);
|
||||||
}
|
// return;
|
||||||
}
|
// }
|
||||||
//ui.lineTorConfig->setText(filename);
|
// }
|
||||||
}
|
// //ui.lineTorConfig->setText(filename);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
void NetworkDialog::updateDisplay()
|
void NetworkDialog::updateDisplay()
|
||||||
{
|
{
|
||||||
@ -580,128 +576,131 @@ RsCertId getNeighRsCertId(QTreeWidgetItem *i)
|
|||||||
* All of these rely on the finding of the current Id.
|
* All of these rely on the finding of the current Id.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
std::string NetworkDialog::loadneighbour()
|
//std::string NetworkDialog::loadneighbour()
|
||||||
{
|
//{
|
||||||
#ifdef NET_DEBUG
|
//#ifdef NET_DEBUG
|
||||||
std::cerr << "NetworkDialog::loadneighbour()" << std::endl;
|
// std::cerr << "NetworkDialog::loadneighbour()" << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Certificate"), "",
|
// use misc::getOpenFileName
|
||||||
tr("Certificates (*.pqi *.pem)"));
|
// QString fileName = QFileDialog::getOpenFileName(this, tr("Select Certificate"), "",
|
||||||
|
// tr("Certificates (*.pqi *.pem)"));
|
||||||
|
//
|
||||||
|
// std::string file = fileName.toStdString();
|
||||||
|
// std::string id;
|
||||||
|
// std::string gpg_id;
|
||||||
|
// if (file != "")
|
||||||
|
// {
|
||||||
|
// rsPeers->loadCertificateFromFile(file, id, gpg_id);
|
||||||
|
// }
|
||||||
|
// return id;
|
||||||
|
//}
|
||||||
|
|
||||||
std::string file = fileName.toStdString();
|
//void NetworkDialog::addneighbour()
|
||||||
std::string id;
|
//{
|
||||||
std::string gpg_id;
|
//// QTreeWidgetItem *c = getCurrentNeighbour();
|
||||||
if (file != "")
|
//#ifdef NET_DEBUG
|
||||||
{
|
// std::cerr << "NetworkDialog::addneighbour()" << std::endl;
|
||||||
rsPeers->loadCertificateFromFile(file, id, gpg_id);
|
//#endif
|
||||||
}
|
// /*
|
||||||
return id;
|
// rsServer->NeighAddFriend(getNeighRsCertId(c));
|
||||||
}
|
// */
|
||||||
|
//}
|
||||||
|
|
||||||
void NetworkDialog::addneighbour()
|
//void NetworkDialog::authneighbour()
|
||||||
{
|
//{
|
||||||
// QTreeWidgetItem *c = getCurrentNeighbour();
|
//// QTreeWidgetItem *c = getCurrentNeighbour();
|
||||||
#ifdef NET_DEBUG
|
//#ifdef NET_DEBUG
|
||||||
std::cerr << "NetworkDialog::addneighbour()" << std::endl;
|
// std::cerr << "NetworkDialog::authneighbour()" << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
/*
|
// /*
|
||||||
rsServer->NeighAddFriend(getNeighRsCertId(c));
|
// RsAuthId code;
|
||||||
*/
|
// rsServer->NeighAuthFriend(getNeighRsCertId(c), code);
|
||||||
}
|
// */
|
||||||
|
//}
|
||||||
void NetworkDialog::authneighbour()
|
|
||||||
{
|
|
||||||
// QTreeWidgetItem *c = getCurrentNeighbour();
|
|
||||||
#ifdef NET_DEBUG
|
|
||||||
std::cerr << "NetworkDialog::authneighbour()" << std::endl;
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
RsAuthId code;
|
|
||||||
rsServer->NeighAuthFriend(getNeighRsCertId(c), code);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Open a QFileDialog to browse for a pem/pqi file. */
|
/** Open a QFileDialog to browse for a pem/pqi file. */
|
||||||
void NetworkDialog::on_actionAddFriend_activated()
|
void NetworkDialog::on_actionAddFriend_activated()
|
||||||
{
|
{
|
||||||
/* Create a new input dialog, which allows users to create files, too */
|
// /* Create a new input dialog, which allows users to create files, too */
|
||||||
QFileDialog dialog (this, tr("Select a pem/pqi File"));
|
// use misc::getOpenFileName
|
||||||
//dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
|
// QFileDialog dialog (this, tr("Select a pem/pqi File"));
|
||||||
//dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
|
// //dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
// //dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
|
||||||
dialog.setReadOnly(false);
|
// dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
// dialog.setReadOnly(false);
|
||||||
/* Prompt the user to select a file or create a new one */
|
//
|
||||||
if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
|
// /* Prompt the user to select a file or create a new one */
|
||||||
return;
|
// if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
|
||||||
}
|
// return;
|
||||||
QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
|
// }
|
||||||
|
// QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
|
||||||
/* Check if the file exists */
|
//
|
||||||
QFile torrcFile(filename);
|
// /* Check if the file exists */
|
||||||
if (!QFileInfo(filename).exists()) {
|
// QFile torrcFile(filename);
|
||||||
/* The given file does not exist. Should we create it? */
|
// if (!QFileInfo(filename).exists()) {
|
||||||
int response = VMessageBox::question(this,
|
// /* The given file does not exist. Should we create it? */
|
||||||
tr("File Not Found"),
|
// int response = VMessageBox::question(this,
|
||||||
tr("%1 does not exist. Would you like to create it?")
|
// tr("File Not Found"),
|
||||||
.arg(filename),
|
// tr("%1 does not exist. Would you like to create it?")
|
||||||
VMessageBox::Yes, VMessageBox::No);
|
// .arg(filename),
|
||||||
|
// VMessageBox::Yes, VMessageBox::No);
|
||||||
if (response == VMessageBox::No) {
|
//
|
||||||
/* Don't create it. Just bail. */
|
// if (response == VMessageBox::No) {
|
||||||
return;
|
// /* Don't create it. Just bail. */
|
||||||
}
|
// return;
|
||||||
/* Attempt to create the specified file */
|
// }
|
||||||
if (!torrcFile.open(QIODevice::WriteOnly)) {
|
// /* Attempt to create the specified file */
|
||||||
VMessageBox::warning(this,
|
// if (!torrcFile.open(QIODevice::WriteOnly)) {
|
||||||
tr("Failed to Create File"),
|
// VMessageBox::warning(this,
|
||||||
tr("Unable to create %1 [%2]").arg(filename)
|
// tr("Failed to Create File"),
|
||||||
.arg(torrcFile.errorString()),
|
// tr("Unable to create %1 [%2]").arg(filename)
|
||||||
VMessageBox::Ok);
|
// .arg(torrcFile.errorString()),
|
||||||
return;
|
// VMessageBox::Ok);
|
||||||
}
|
// return;
|
||||||
}
|
// }
|
||||||
//ui.lineTorConfig->setText(filename);
|
// }
|
||||||
|
// //ui.lineTorConfig->setText(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NetworkDialog::on_actionExportKey_activated()
|
void NetworkDialog::on_actionExportKey_activated()
|
||||||
{
|
{
|
||||||
qDebug() << " exportcert";
|
// qDebug() << " exportcert";
|
||||||
|
//
|
||||||
std::string cert = rsPeers->GetRetroshareInvite();
|
// std::string cert = rsPeers->GetRetroshareInvite();
|
||||||
if (cert.empty()) {
|
// if (cert.empty()) {
|
||||||
QMessageBox::information(this, tr("RetroShare"),
|
// QMessageBox::information(this, tr("RetroShare"),
|
||||||
tr("Sorry, create certificate failed"),
|
// tr("Sorry, create certificate failed"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
// QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
QString qdir = QFileDialog::getSaveFileName(this,
|
// use misc::getSaveFileName
|
||||||
tr("Please choose a filename"),
|
// QString qdir = QFileDialog::getSaveFileName(this,
|
||||||
QDir::homePath(),
|
// tr("Please choose a filename"),
|
||||||
tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
// QDir::homePath(),
|
||||||
//Todo: move save to file to p3Peers::SaveCertificateToFile
|
// tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
||||||
|
// //Todo: move save to file to p3Peers::SaveCertificateToFile
|
||||||
if (qdir.isEmpty() == false) {
|
//
|
||||||
QFile CertFile (qdir);
|
// if (qdir.isEmpty() == false) {
|
||||||
if (CertFile.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
// QFile CertFile (qdir);
|
||||||
if (CertFile.write(QByteArray(cert.c_str())) > 0) {
|
// if (CertFile.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
||||||
QMessageBox::information(this, tr("RetroShare"),
|
// if (CertFile.write(QByteArray(cert.c_str())) > 0) {
|
||||||
tr("Certificate file successfully created"),
|
// QMessageBox::information(this, tr("RetroShare"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
// tr("Certificate file successfully created"),
|
||||||
} else {
|
// QMessageBox::Ok, QMessageBox::Ok);
|
||||||
QMessageBox::information(this, tr("RetroShare"),
|
// } else {
|
||||||
tr("Sorry, certificate file creation failed"),
|
// QMessageBox::information(this, tr("RetroShare"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
// tr("Sorry, certificate file creation failed"),
|
||||||
}
|
// QMessageBox::Ok, QMessageBox::Ok);
|
||||||
CertFile.close();
|
// }
|
||||||
} else {
|
// CertFile.close();
|
||||||
QMessageBox::information(this, tr("RetroShare"),
|
// } else {
|
||||||
tr("Sorry, certificate file creation failed"),
|
// QMessageBox::information(this, tr("RetroShare"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
// tr("Sorry, certificate file creation failed"),
|
||||||
}
|
// QMessageBox::Ok, QMessageBox::Ok);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkDialog::on_actionCreate_New_Profile_activated()
|
void NetworkDialog::on_actionCreate_New_Profile_activated()
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void insertConnect();
|
void insertConnect();
|
||||||
std::string loadneighbour();
|
// std::string loadneighbour();
|
||||||
/* void loadneighbour(); */
|
/* void loadneighbour(); */
|
||||||
void updateNewDiscoveryInfo() ;
|
void updateNewDiscoveryInfo() ;
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ private slots:
|
|||||||
//void unvalidGPGkeyWidgetCostumPopupMenu( QPoint point );
|
//void unvalidGPGkeyWidgetCostumPopupMenu( QPoint point );
|
||||||
|
|
||||||
/** Called when user clicks "Load Cert" to choose location of a Cert file */
|
/** Called when user clicks "Load Cert" to choose location of a Cert file */
|
||||||
void loadcert();
|
// void loadcert();
|
||||||
|
|
||||||
void authneighbour();
|
// void authneighbour();
|
||||||
void addneighbour();
|
// void addneighbour();
|
||||||
|
|
||||||
void on_actionAddFriend_activated();
|
void on_actionAddFriend_activated();
|
||||||
//void on_actionCopyKey_activated();
|
//void on_actionCopyKey_activated();
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QFileDialog>
|
|
||||||
#include "common/vmessagebox.h"
|
#include "common/vmessagebox.h"
|
||||||
#include "common/StatusDefs.h"
|
#include "common/StatusDefs.h"
|
||||||
#include "common/GroupDefs.h"
|
#include "common/GroupDefs.h"
|
||||||
@ -64,6 +63,7 @@
|
|||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "NewsFeed.h"
|
#include "NewsFeed.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -1103,18 +1103,15 @@ void PeersDialog::exportfriend()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string id = getPeerRsCertId(c);
|
std::string id = getPeerRsCertId(c);
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Certificate"), "",
|
|
||||||
tr("Certificates (*.pqi)"));
|
|
||||||
|
|
||||||
std::string file = fileName.toStdString();
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT, tr("Save Certificate"), tr("Certificates (*.pqi)"), fileName))
|
||||||
if (file != "")
|
|
||||||
{
|
{
|
||||||
#ifdef PEERS_DEBUG
|
#ifdef PEERS_DEBUG
|
||||||
std::cerr << "PeersDialog::exportfriend() Saving to: " << file << std::endl;
|
std::cerr << "PeersDialog::exportfriend() Saving to: " << file << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (rsPeers)
|
if (rsPeers)
|
||||||
{
|
{
|
||||||
rsPeers->saveCertificateToFile(id, file);
|
rsPeers->saveCertificateToFile(id, fileName.toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1727,8 +1724,8 @@ void PeersDialog::updateAvatar()
|
|||||||
|
|
||||||
void PeersDialog::getAvatar()
|
void PeersDialog::getAvatar()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg *.tiff *.gif)");
|
QString fileName;
|
||||||
if(!fileName.isEmpty())
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg *.tiff *.gif)"), fileName))
|
||||||
{
|
{
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
picture = QPixmap(fileName).scaled(96,96, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
picture = QPixmap(fileName).scaled(96,96, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||||
@ -1794,13 +1791,9 @@ void PeersDialog::statusmessage()
|
|||||||
|
|
||||||
void PeersDialog::addExtraFile()
|
void PeersDialog::addExtraFile()
|
||||||
{
|
{
|
||||||
// select a file
|
QString file;
|
||||||
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", file)) {
|
||||||
QFileDialog::DontResolveSymlinks);
|
addAttachment(file.toUtf8().constData());
|
||||||
std::string filePath = qfile.toStdString();
|
|
||||||
if (filePath != "")
|
|
||||||
{
|
|
||||||
PeersDialog::addAttachment(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1950,12 +1943,13 @@ bool PeersDialog::fileSave()
|
|||||||
|
|
||||||
bool PeersDialog::fileSaveAs()
|
bool PeersDialog::fileSaveAs()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
QString fn;
|
||||||
QString(), tr("Text File (*.txt );;All Files (*)"));
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_HISTORY, tr("Save as..."), tr("Text File (*.txt );;All Files (*)"), fn)) {
|
||||||
if (fn.isEmpty())
|
|
||||||
return false;
|
|
||||||
setCurrentFileName(fn);
|
setCurrentFileName(fn);
|
||||||
return fileSave();
|
return fileSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeersDialog::setCurrentFileName(const QString &fileName)
|
void PeersDialog::setCurrentFileName(const QString &fileName)
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
|
#include <QPainter.h>
|
||||||
#include <util/misc.h>
|
#include <util/misc.h>
|
||||||
|
|
||||||
class RSHumanReadableDelegate: public QAbstractItemDelegate
|
class RSHumanReadableDelegate: public QAbstractItemDelegate
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "SearchDialog.h"
|
#include "SearchDialog.h"
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -244,8 +243,8 @@ void CreateChannel::cancelChannel()
|
|||||||
|
|
||||||
void CreateChannel::addChannelLogo()
|
void CreateChannel::addChannelLogo()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), QDir::homePath(), tr("Pictures (*.png *.xpm *.jpg)"));
|
QString fileName;
|
||||||
if(!fileName.isEmpty())
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName))
|
||||||
{
|
{
|
||||||
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
@ -293,11 +292,12 @@ void CreateChannelMsg::addExtraFile()
|
|||||||
std::cerr << "CreateChannelMsg::addExtraFile() opening file dialog";
|
std::cerr << "CreateChannelMsg::addExtraFile() opening file dialog";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
// select a file
|
QStringList files;
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Add Extra File"), "", "", 0, QFileDialog::DontResolveSymlinks);
|
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||||
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
||||||
addAttachment((*fileIt).toUtf8().constData());
|
addAttachment((*fileIt).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -563,8 +563,8 @@ void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::
|
|||||||
|
|
||||||
void CreateChannelMsg::addThumbnail()
|
void CreateChannelMsg::addThumbnail()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), QDir::homePath(), tr("Pictures (*.png *.xpm *.jpg)"));
|
QString fileName;
|
||||||
if(!fileName.isEmpty())
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName))
|
||||||
{
|
{
|
||||||
picture = QPixmap(fileName).scaled(156,107, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
picture = QPixmap(fileName).scaled(156,107, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QSound>
|
#include <QSound>
|
||||||
@ -37,6 +36,7 @@
|
|||||||
#include "PopupChatDialog.h"
|
#include "PopupChatDialog.h"
|
||||||
#include "PopupChatWindow.h"
|
#include "PopupChatWindow.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
|
#include "util/misc.h"
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
@ -889,25 +889,18 @@ void PopupChatDialog::updateAvatar()
|
|||||||
|
|
||||||
void PopupChatDialog::addExtraFile()
|
void PopupChatDialog::addExtraFile()
|
||||||
{
|
{
|
||||||
// select a file
|
QString file;
|
||||||
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", file)) {
|
||||||
QFileDialog::DontResolveSymlinks);
|
addAttachment(file.toUtf8().constData(), 0);
|
||||||
std::string filePath = qfile.toStdString();
|
|
||||||
if (filePath != "")
|
|
||||||
{
|
|
||||||
addAttachment(filePath,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::addExtraPicture()
|
void PopupChatDialog::addExtraPicture()
|
||||||
{
|
{
|
||||||
// select a picture file
|
// select a picture file
|
||||||
QString qfile = QFileDialog::getOpenFileName(this, "Load Picture File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)",0,
|
QString file;
|
||||||
QFileDialog::DontResolveSymlinks);
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg)", file)) {
|
||||||
std::string filePath=qfile.toStdString();
|
addAttachment(file.toUtf8().constData(), 1);
|
||||||
if(filePath!="")
|
|
||||||
{
|
|
||||||
PopupChatDialog::addAttachment(filePath,1); //picture
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,12 +1108,13 @@ bool PopupChatDialog::fileSave()
|
|||||||
|
|
||||||
bool PopupChatDialog::fileSaveAs()
|
bool PopupChatDialog::fileSaveAs()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
QString fn;
|
||||||
QString(), tr("Text File (*.txt );;All Files (*)"));
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_HISTORY, tr("Save as..."), tr("Text File (*.txt );;All Files (*)"), fn)) {
|
||||||
if (fn.isEmpty())
|
|
||||||
return false;
|
|
||||||
setCurrentFileName(fn);
|
setCurrentFileName(fn);
|
||||||
return fileSave();
|
return fileSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::setCurrentFileName(const QString &fileName)
|
void PopupChatDialog::setCurrentFileName(const QString &fileName)
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include "PopupChatWindow.h"
|
#include "PopupChatWindow.h"
|
||||||
#include "PopupChatDialog.h"
|
#include "PopupChatDialog.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/settings/RsharePeerSettings.h"
|
#include "gui/settings/RsharePeerSettings.h"
|
||||||
#include "gui/common/StatusDefs.h"
|
#include "gui/common/StatusDefs.h"
|
||||||
|
#include"util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rsmsgs.h>
|
#include <retroshare/rsmsgs.h>
|
||||||
#include <retroshare/rsnotify.h>
|
#include <retroshare/rsnotify.h>
|
||||||
@ -262,9 +262,9 @@ void PopupChatWindow::calculateTitle(PopupChatDialog *dialog)
|
|||||||
|
|
||||||
void PopupChatWindow::getAvatar()
|
void PopupChatWindow::getAvatar()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)");
|
QString fileName;
|
||||||
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg *.tiff *.gif)"), fileName))
|
||||||
if(!fileName.isEmpty()) {
|
{
|
||||||
QPixmap picture = QPixmap(fileName).scaled(96,96, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
QPixmap picture = QPixmap(fileName).scaled(96,96, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||||
|
|
||||||
std::cerr << "Sending avatar image down the pipe" << std::endl;
|
std::cerr << "Sending avatar image down the pipe" << std::endl;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
|
|
||||||
@ -195,13 +194,11 @@ void CreateForumMsg::addSmileys()
|
|||||||
|
|
||||||
void CreateForumMsg::addFile()
|
void CreateForumMsg::addFile()
|
||||||
{
|
{
|
||||||
// select a file
|
QStringList files;
|
||||||
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
|
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||||
QFileDialog::DontResolveSymlinks);
|
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
||||||
std::string filePath = qfile.toStdString();
|
addAttachment((*fileIt).toUtf8().constData());
|
||||||
if (filePath != "")
|
}
|
||||||
{
|
|
||||||
CreateForumMsg::addAttachment(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,21 +233,18 @@ void CreateForumMsg::fileHashingFinished(AttachFileItem* file) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//convert fileSize from uint_64 to string for html link
|
RetroShareLink link(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()));
|
||||||
char fileSizeChar [100];
|
if (link.valid()) {
|
||||||
sprintf(fileSizeChar, "%llu", (unsigned long long int)file->FileSize());
|
QString mesgString = link.toHtmlSize() + "<br>";
|
||||||
std::string fileSize = *(&fileSizeChar);
|
|
||||||
|
|
||||||
std::string mesgString = "<a href='retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "'>"
|
|
||||||
+ "retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "</a>" + "<br>";
|
|
||||||
#ifdef CHAT_DEBUG
|
#ifdef CHAT_DEBUG
|
||||||
std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString << std::endl;
|
std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui.forumMessage->textCursor().insertHtml(QString::fromStdString(mesgString));
|
ui.forumMessage->textCursor().insertHtml(mesgString);
|
||||||
|
|
||||||
ui.forumMessage->setFocus( Qt::OtherFocusReason );
|
ui.forumMessage->setFocus( Qt::OtherFocusReason );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateForumMsg::dropEvent(QDropEvent *event)
|
void CreateForumMsg::dropEvent(QDropEvent *event)
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QTextList>
|
#include <QTextList>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QTextDocumentFragment>
|
#include <QTextDocumentFragment>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
|
#include <QItemDelegate>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -1894,10 +1894,10 @@ void MessageComposer::fileNew()
|
|||||||
|
|
||||||
void MessageComposer::fileOpen()
|
void MessageComposer::fileOpen()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
|
QString fn;
|
||||||
QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Open File..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
|
||||||
if (!fn.isEmpty())
|
|
||||||
load(fn);
|
load(fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessageComposer::fileSave()
|
bool MessageComposer::fileSave()
|
||||||
@ -1917,12 +1917,13 @@ bool MessageComposer::fileSave()
|
|||||||
|
|
||||||
bool MessageComposer::fileSaveAs()
|
bool MessageComposer::fileSaveAs()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
QString fn;
|
||||||
QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Save as..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
|
||||||
if (fn.isEmpty())
|
|
||||||
return false;
|
|
||||||
setCurrentFileName(fn);
|
setCurrentFileName(fn);
|
||||||
return fileSave();
|
return fileSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::saveasDraft()
|
void MessageComposer::saveasDraft()
|
||||||
@ -1949,9 +1950,8 @@ void MessageComposer::filePrint()
|
|||||||
void MessageComposer::filePrintPdf()
|
void MessageComposer::filePrintPdf()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_PRINTER
|
#ifndef QT_NO_PRINTER
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
|
QString fileName;
|
||||||
QString(), "*.pdf");
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Export PDF"), "*.pdf", fileName)) {
|
||||||
if (!fileName.isEmpty()) {
|
|
||||||
if (QFileInfo(fileName).suffix().isEmpty())
|
if (QFileInfo(fileName).suffix().isEmpty())
|
||||||
fileName.append(".pdf");
|
fileName.append(".pdf");
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
@ -2024,19 +2024,15 @@ void MessageComposer::on_contactsdockWidget_visibilityChanged(bool visible)
|
|||||||
|
|
||||||
void MessageComposer::addImage()
|
void MessageComposer::addImage()
|
||||||
{
|
{
|
||||||
QString fileimg = QFileDialog::getOpenFileName( this, tr( "Choose Image" ),
|
QString fileimg;
|
||||||
QString(Settings->valueFromGroup("MessageComposer", "LastDir").toString()) ,tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"));
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Choose Image"), tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"), fileimg)) {
|
||||||
|
|
||||||
if ( fileimg.isEmpty() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage base(fileimg);
|
QImage base(fileimg);
|
||||||
|
|
||||||
QString pathimage = fileimg.left(fileimg.lastIndexOf("/"))+"/";
|
QString pathimage = fileimg.left(fileimg.lastIndexOf("/"))+"/";
|
||||||
Settings->setValueToGroup("MessageComposer", "LastDir", pathimage);
|
Settings->setValueToGroup("MessageComposer", "LastDir", pathimage);
|
||||||
|
|
||||||
Create_New_Image_Tag(fileimg);
|
Create_New_Image_Tag(fileimg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::Create_New_Image_Tag( const QString urlremoteorlocal )
|
void MessageComposer::Create_New_Image_Tag( const QString urlremoteorlocal )
|
||||||
@ -2139,9 +2135,11 @@ void MessageComposer::addPostSplitter()
|
|||||||
void MessageComposer::attachFile()
|
void MessageComposer::attachFile()
|
||||||
{
|
{
|
||||||
// select a file
|
// select a file
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Add Extra File"), "", "", 0, QFileDialog::DontResolveSymlinks);
|
QStringList files;
|
||||||
|
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||||
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
||||||
MessageComposer::addAttachment((*fileIt).toUtf8().constData());
|
addAttachment((*fileIt).toUtf8().constData());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,11 +21,12 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileDialog>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
#include "CryptoPage.h"
|
#include "CryptoPage.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h> //for rsPeers variable
|
#include <retroshare/rspeers.h> //for rsPeers variable
|
||||||
|
|
||||||
@ -115,12 +116,12 @@ bool CryptoPage::fileSave()
|
|||||||
|
|
||||||
bool CryptoPage::fileSaveAs()
|
bool CryptoPage::fileSaveAs()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
QString fn;
|
||||||
QString(), tr("RetroShare Certificate (*.rsc );;All Files (*)"));
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT, tr("Save as..."), tr("RetroShare Certificate (*.rsc );;All Files (*)"), fn)) {
|
||||||
if (fn.isEmpty())
|
|
||||||
return false;
|
|
||||||
setCurrentFileName(fn);
|
setCurrentFileName(fn);
|
||||||
return fileSave();
|
return fileSave();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CryptoPage::setCurrentFileName(const QString &fileName)
|
void CryptoPage::setCurrentFileName(const QString &fileName)
|
||||||
|
@ -173,6 +173,45 @@ void RshareSettings::setSheetName(QString sheet)
|
|||||||
setValue(SETTING_SHEETNAME, sheet);
|
setValue(SETTING_SHEETNAME, sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString getKeyForLastDir(RshareSettings::enumLastDir type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case RshareSettings::LASTDIR_EXTRAFILE:
|
||||||
|
return "ExtraFile";
|
||||||
|
case RshareSettings::LASTDIR_CERT:
|
||||||
|
return "Certificate";
|
||||||
|
case RshareSettings::LASTDIR_HISTORY:
|
||||||
|
return "History";
|
||||||
|
case RshareSettings::LASTDIR_IMAGES:
|
||||||
|
return "Images";
|
||||||
|
case RshareSettings::LASTDIR_MESSAGES:
|
||||||
|
return "Messages";
|
||||||
|
case RshareSettings::LASTDIR_BLOGS:
|
||||||
|
return "Messages";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RshareSettings::getLastDir(enumLastDir type)
|
||||||
|
{
|
||||||
|
QString key = getKeyForLastDir(type);
|
||||||
|
if (key.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return valueFromGroup("LastDir", key).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RshareSettings::setLastDir(enumLastDir type, const QString &lastDir)
|
||||||
|
{
|
||||||
|
QString key = getKeyForLastDir(type);
|
||||||
|
if (key.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setValueToGroup("LastDir", key, lastDir);
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the bandwidth line filter. */
|
/** Returns the bandwidth line filter. */
|
||||||
uint RshareSettings::getBWGraphFilter()
|
uint RshareSettings::getBWGraphFilter()
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,16 @@ class QMainWindow;
|
|||||||
*/
|
*/
|
||||||
class RshareSettings : public RSettings
|
class RshareSettings : public RSettings
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
enum enumLastDir
|
||||||
|
{
|
||||||
|
LASTDIR_EXTRAFILE,
|
||||||
|
LASTDIR_CERT,
|
||||||
|
LASTDIR_HISTORY,
|
||||||
|
LASTDIR_IMAGES,
|
||||||
|
LASTDIR_MESSAGES,
|
||||||
|
LASTDIR_BLOGS
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* create settings object */
|
/* create settings object */
|
||||||
@ -92,6 +102,9 @@ public:
|
|||||||
/** Set the destination log file. */
|
/** Set the destination log file. */
|
||||||
void setLogFile(QString file);
|
void setLogFile(QString file);
|
||||||
|
|
||||||
|
QString getLastDir(enumLastDir type);
|
||||||
|
void setLastDir(enumLastDir type, const QString &lastDir);
|
||||||
|
|
||||||
/* Get the bandwidth graph line filter. */
|
/* Get the bandwidth graph line filter. */
|
||||||
uint getBWGraphFilter();
|
uint getBWGraphFilter();
|
||||||
/** Set the bandwidth graph line filter. */
|
/** Set the bandwidth graph line filter. */
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
||||||
#include "CreateBlog.h"
|
#include "CreateBlog.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rsblogs.h>
|
#include <retroshare/rsblogs.h>
|
||||||
|
|
||||||
@ -143,8 +143,8 @@ void CreateBlog::createBlog()
|
|||||||
|
|
||||||
void CreateBlog::addBlogLogo(){
|
void CreateBlog::addBlogLogo(){
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)");
|
QString fileName;
|
||||||
if(!fileName.isEmpty())
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName))
|
||||||
{
|
{
|
||||||
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QFontComboBox>
|
#include <QFontComboBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileInfo>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "CreateBlogMsg.h"
|
#include "CreateBlogMsg.h"
|
||||||
#include "gui/msgs/textformat.h"
|
#include "gui/msgs/textformat.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rsblogs.h>
|
#include <retroshare/rsblogs.h>
|
||||||
|
|
||||||
@ -803,9 +804,8 @@ void CreateBlogMsg::fileNew()
|
|||||||
|
|
||||||
void CreateBlogMsg::fileOpen()
|
void CreateBlogMsg::fileOpen()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
|
QString fn;
|
||||||
QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Open File..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn))
|
||||||
if (!fn.isEmpty())
|
|
||||||
load(fn);
|
load(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,14 +823,15 @@ bool CreateBlogMsg::fileSave()
|
|||||||
|
|
||||||
bool CreateBlogMsg::fileSaveAs()
|
bool CreateBlogMsg::fileSaveAs()
|
||||||
{
|
{
|
||||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
QString fn;
|
||||||
QString(), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"));
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Save as..."), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
|
||||||
if (fn.isEmpty())
|
|
||||||
return false;
|
|
||||||
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
|
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
|
||||||
fn += ".odt"; // default
|
fn += ".odt"; // default
|
||||||
setCurrentFileName(fn);
|
setCurrentFileName(fn);
|
||||||
return fileSave();
|
return fileSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateBlogMsg::filePrint()
|
void CreateBlogMsg::filePrint()
|
||||||
@ -872,9 +873,8 @@ void CreateBlogMsg::filePrintPdf()
|
|||||||
{
|
{
|
||||||
#ifndef QT_NO_PRINTER
|
#ifndef QT_NO_PRINTER
|
||||||
//! [0]
|
//! [0]
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF",
|
QString fileName;
|
||||||
QString(), "*.pdf");
|
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Export PDF"), "*.pdf", fileName)) {
|
||||||
if (!fileName.isEmpty()) {
|
|
||||||
if (QFileInfo(fileName).suffix().isEmpty())
|
if (QFileInfo(fileName).suffix().isEmpty())
|
||||||
fileName.append(".pdf");
|
fileName.append(".pdf");
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
@ -903,20 +903,12 @@ void CreateBlogMsg::setCurrentFileName(const QString &fileName)
|
|||||||
|
|
||||||
void CreateBlogMsg::addImage()
|
void CreateBlogMsg::addImage()
|
||||||
{
|
{
|
||||||
|
QString fileimg;
|
||||||
QString fileimg = QFileDialog::getOpenFileName( this, tr( "Choose Image" ),
|
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Choose Image"), tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"), fileimg)) {
|
||||||
QString(setter.value("LastDir").toString()) ,tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"));
|
|
||||||
|
|
||||||
if ( fileimg.isEmpty() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage base(fileimg);
|
QImage base(fileimg);
|
||||||
|
|
||||||
QString pathimage = fileimg.left(fileimg.lastIndexOf("/"))+"/";
|
|
||||||
setter.setValue("LastDir",pathimage);
|
|
||||||
|
|
||||||
Create_New_Image_Tag(fileimg);
|
Create_New_Image_Tag(fileimg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateBlogMsg::Create_New_Image_Tag( const QString urlremoteorlocal )
|
void CreateBlogMsg::Create_New_Image_Tag( const QString urlremoteorlocal )
|
||||||
|
Binary file not shown.
@ -1742,6 +1742,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
<source>Please add a Name</source>
|
<source>Please add a Name</source>
|
||||||
<translation>Bitte Name hinzufügen</translation>
|
<translation>Bitte Name hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+53"/>
|
||||||
|
<source>Load File</source>
|
||||||
|
<translation type="unfinished">Lade Datei</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+0"/>
|
||||||
|
<source>Pictures (*.png *.xpm *.jpg)</source>
|
||||||
|
<translation type="unfinished">Bilder (*.png *.xpm *.jpg)</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/unfinished/blogs/CreateBlog.ui" line="-137"/>
|
<location filename="../gui/unfinished/blogs/CreateBlog.ui" line="-137"/>
|
||||||
<source>Authemticated Messages</source>
|
<source>Authemticated Messages</source>
|
||||||
@ -1876,7 +1886,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Rückgängig</translation>
|
<translation>Rückgängig</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/unfinished/blogs/CreateBlogMsg.cpp" line="+197"/>
|
<location filename="../gui/unfinished/blogs/CreateBlogMsg.cpp" line="+198"/>
|
||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2036,12 +2046,12 @@ Do you want to save your changes?</source>
|
|||||||
Möchten Sie die Änderungen speichern?</translation>
|
Möchten Sie die Änderungen speichern?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+21"/>
|
<location line="+22"/>
|
||||||
<source>Open File...</source>
|
<source>Open File...</source>
|
||||||
<translation>Datei öffnen...</translation>
|
<translation>Datei öffnen...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>HTML-Files (*.htm *.html);;All Files (*)</source>
|
<source>HTML-Files (*.htm *.html);;All Files (*)</source>
|
||||||
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
|
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2051,22 +2061,27 @@ Möchten Sie die Änderungen speichern?</translation>
|
|||||||
<translation>Speichern unter...</translation>
|
<translation>Speichern unter...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)</source>
|
<source>ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+16"/>
|
<location line="+17"/>
|
||||||
<source>Print Document</source>
|
<source>Print Document</source>
|
||||||
<translation>Dokument drucken</translation>
|
<translation>Dokument drucken</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+64"/>
|
<location line="+33"/>
|
||||||
|
<source>Export PDF</source>
|
||||||
|
<translation type="unfinished">PDF exportieren</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+30"/>
|
||||||
<source>Choose Image</source>
|
<source>Choose Image</source>
|
||||||
<translation>Bild wählen</translation>
|
<translation>Bild wählen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>Image Files supported (*.png *.jpeg *.jpg *.gif)</source>
|
<source>Image Files supported (*.png *.jpeg *.jpg *.gif)</source>
|
||||||
<translation>Unterstützte Bilddateien (*.png *.jpeg *.jpg *.gif)</translation>
|
<translation>Unterstützte Bilddateien (*.png *.jpeg *.jpg *.gif)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2174,7 +2189,7 @@ Möchten Sie die Änderungen speichern?</translation>
|
|||||||
<translation>Erstellen</translation>
|
<translation>Erstellen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/channels/CreateChannel.cpp" line="+164"/>
|
<location filename="../gui/channels/CreateChannel.cpp" line="+163"/>
|
||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2184,7 +2199,7 @@ Möchten Sie die Änderungen speichern?</translation>
|
|||||||
<translation>Bitte einen Name hinzufügen</translation>
|
<translation>Bitte einen Name hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+83"/>
|
<location line="+84"/>
|
||||||
<source>Load File</source>
|
<source>Load File</source>
|
||||||
<translation>Lade Datei</translation>
|
<translation>Lade Datei</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2285,12 +2300,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Drag'n'Drop Dateien aus den Suchergebnissen</translation>
|
<translation>Drag'n'Drop Dateien aus den Suchergebnissen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/channels/CreateChannelMsg.cpp" line="+297"/>
|
<location filename="../gui/channels/CreateChannelMsg.cpp" line="+296"/>
|
||||||
<source>Add Extra File</source>
|
<source>Add Extra File</source>
|
||||||
<translation>Zusätzlich eine Datei hinzufügen</translation>
|
<translation>Zusätzlich eine Datei hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+26"/>
|
<location line="+27"/>
|
||||||
<location line="+202"/>
|
<location line="+202"/>
|
||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
@ -2306,7 +2321,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Bitte Subjekt nicht vergessen</translation>
|
<translation>Bitte Subjekt nicht vergessen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+40"/>
|
<location line="+41"/>
|
||||||
<source>Load File</source>
|
<source>Load File</source>
|
||||||
<translation>Lade Datei</translation>
|
<translation>Lade Datei</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2436,7 +2451,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+173"/>
|
<location line="+173"/>
|
||||||
<location filename="../gui/forums/CreateForumMsg.cpp" line="+72"/>
|
<location filename="../gui/forums/CreateForumMsg.cpp" line="+71"/>
|
||||||
<source>Paste RetroShare Link</source>
|
<source>Paste RetroShare Link</source>
|
||||||
<translation>RetroShare Link einfügen</translation>
|
<translation>RetroShare Link einfügen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2481,7 +2496,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Du kannst Dateien mit Drag'n'Drop anhängen</translation>
|
<translation>Du kannst Dateien mit Drag'n'Drop anhängen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/forums/CreateForumMsg.cpp" line="+93"/>
|
<location filename="../gui/forums/CreateForumMsg.cpp" line="+88"/>
|
||||||
<location line="+4"/>
|
<location line="+4"/>
|
||||||
<source>Drop file error.</source>
|
<source>Drop file error.</source>
|
||||||
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
||||||
@ -2542,7 +2557,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<context>
|
<context>
|
||||||
<name>CryptoPage</name>
|
<name>CryptoPage</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/settings/CryptoPage.cpp" line="+93"/>
|
<location filename="../gui/settings/CryptoPage.cpp" line="+94"/>
|
||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2552,12 +2567,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Dein öffentlicher Schlüssel ist in die Zwischenablage kopiert worden</translation>
|
<translation>Dein öffentlicher Schlüssel ist in die Zwischenablage kopiert worden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+24"/>
|
<location line="+25"/>
|
||||||
<source>Save as...</source>
|
<source>Save as...</source>
|
||||||
<translation>Speichern unter...</translation>
|
<translation>Speichern unter...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>RetroShare Certificate (*.rsc );;All Files (*)</source>
|
<source>RetroShare Certificate (*.rsc );;All Files (*)</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -5827,18 +5842,18 @@ Möchtest Du die Nachricht in den Entwürfen speichern?</translation>
|
|||||||
<translation>&Format</translation>
|
<translation>&Format</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+257"/>
|
<location line="+258"/>
|
||||||
<source>Open File...</source>
|
<source>Open File...</source>
|
||||||
<translation>Datei öffnen...</translation>
|
<translation>Datei öffnen...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<location line="+23"/>
|
<location line="+23"/>
|
||||||
<source>HTML-Files (*.htm *.html);;All Files (*)</source>
|
<source>HTML-Files (*.htm *.html);;All Files (*)</source>
|
||||||
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
|
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-1"/>
|
<location line="+0"/>
|
||||||
<source>Save as...</source>
|
<source>Save as...</source>
|
||||||
<translation>Speichern unter...</translation>
|
<translation>Speichern unter...</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -5848,29 +5863,34 @@ Möchtest Du die Nachricht in den Entwürfen speichern?</translation>
|
|||||||
<translation>Dokument drucken</translation>
|
<translation>Dokument drucken</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+62"/>
|
<location line="+12"/>
|
||||||
|
<source>Export PDF</source>
|
||||||
|
<translation>PDF exportieren</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+49"/>
|
||||||
<source>Message has not been Sent.
|
<source>Message has not been Sent.
|
||||||
Do you want to save message ?</source>
|
Do you want to save message ?</source>
|
||||||
<translation>Nachricht noch nicht versandt.
|
<translation>Nachricht noch nicht versandt.
|
||||||
Willst Du die Nachricht speichern ?</translation>
|
Willst Du die Nachricht speichern ?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+24"/>
|
<location line="+25"/>
|
||||||
<source>Choose Image</source>
|
<source>Choose Image</source>
|
||||||
<translation>Bild wählen</translation>
|
<translation>Bild wählen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>Image Files supported (*.png *.jpeg *.jpg *.gif)</source>
|
<source>Image Files supported (*.png *.jpeg *.jpg *.gif)</source>
|
||||||
<translation>Unterstützte Bilddateien (*.png *.jpeg *.jpg *.gif)</translation>
|
<translation>Unterstützte Bilddateien (*.png *.jpeg *.jpg *.gif)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+114"/>
|
<location line="+111"/>
|
||||||
<source>Add Extra File</source>
|
<source>Add Extra File</source>
|
||||||
<translation>Zusätzliche Datei hinzufügen</translation>
|
<translation>Zusätzliche Datei hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+273"/>
|
<location line="+274"/>
|
||||||
<location line="+6"/>
|
<location line="+6"/>
|
||||||
<source>Drop file error.</source>
|
<source>Drop file error.</source>
|
||||||
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
||||||
@ -5886,7 +5906,7 @@ Willst Du die Nachricht speichern ?</translation>
|
|||||||
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
|
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-2014"/>
|
<location line="-2012"/>
|
||||||
<source>Friend Recommendation(s)</source>
|
<source>Friend Recommendation(s)</source>
|
||||||
<translation>Freundempfehlung(en)</translation>
|
<translation>Freundempfehlung(en)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -6372,7 +6392,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<context>
|
<context>
|
||||||
<name>MessengerWindow</name>
|
<name>MessengerWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/MessengerWindow.cpp" line="+293"/>
|
<location filename="../gui/MessengerWindow.cpp" line="+292"/>
|
||||||
<source>Expand all</source>
|
<source>Expand all</source>
|
||||||
<translation>Alle erweitern</translation>
|
<translation>Alle erweitern</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -6587,37 +6607,27 @@ p, li { white-space: pre-wrap; }
|
|||||||
<context>
|
<context>
|
||||||
<name>NetworkDialog</name>
|
<name>NetworkDialog</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/NetworkDialog.cpp" line="+300"/>
|
|
||||||
<location line="+328"/>
|
|
||||||
<source>Select a pem/pqi File</source>
|
<source>Select a pem/pqi File</source>
|
||||||
<translation>Wählen einer PEM- oder PQI-Datei</translation>
|
<translation type="obsolete">Wählen einer PEM- oder PQI-Datei</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-311"/>
|
|
||||||
<location line="+328"/>
|
|
||||||
<source>File Not Found</source>
|
<source>File Not Found</source>
|
||||||
<translation>Datei nicht gefunden</translation>
|
<translation type="obsolete">Datei nicht gefunden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-327"/>
|
|
||||||
<location line="+328"/>
|
|
||||||
<source>%1 does not exist. Would you like to create it?</source>
|
<source>%1 does not exist. Would you like to create it?</source>
|
||||||
<translation>%1 ist nicht vorhanden. Möchten Sie es jetzt erstellen?</translation>
|
<translation type="obsolete">%1 ist nicht vorhanden. Möchten Sie es jetzt erstellen?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-317"/>
|
|
||||||
<location line="+328"/>
|
|
||||||
<source>Failed to Create File</source>
|
<source>Failed to Create File</source>
|
||||||
<translation>Es ist nicht gelungen, die Datei zu erstellen</translation>
|
<translation type="obsolete">Es ist nicht gelungen, die Datei zu erstellen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-327"/>
|
|
||||||
<location line="+328"/>
|
|
||||||
<source>Unable to create %1 [%2]</source>
|
<source>Unable to create %1 [%2]</source>
|
||||||
<translation>Kann %1 [%2] nicht erstellen</translation>
|
<translation type="obsolete">Kann %1 [%2] nicht erstellen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-218"/>
|
<location filename="../gui/NetworkDialog.cpp" line="+436"/>
|
||||||
<source>Personal signature</source>
|
<source>Personal signature</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -6654,14 +6664,12 @@ Right-click and select 'make friend' to be able to connect.</source>
|
|||||||
Rechtsklick und als Freund hinzufügen um zu verbinden.</translation>
|
Rechtsklick und als Freund hinzufügen um zu verbinden.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+97"/>
|
|
||||||
<source>Select Certificate</source>
|
<source>Select Certificate</source>
|
||||||
<translation>Zertifikat auswählen</translation>
|
<translation type="obsolete">Zertifikat auswählen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
|
||||||
<source>Certificates (*.pqi *.pem)</source>
|
<source>Certificates (*.pqi *.pem)</source>
|
||||||
<translation>Zertifikate (*.pqi *.pem)</translation>
|
<translation type="obsolete">Zertifikate (*.pqi *.pem)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/NetworkDialog.ui" line="+111"/>
|
<location filename="../gui/NetworkDialog.ui" line="+111"/>
|
||||||
@ -6772,7 +6780,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Leeren</translation>
|
<translation>Leeren</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/NetworkDialog.cpp" line="-364"/>
|
<location filename="../gui/NetworkDialog.cpp" line="-263"/>
|
||||||
<source>Deny friend</source>
|
<source>Deny friend</source>
|
||||||
<translation>Blockiere Freund</translation>
|
<translation>Blockiere Freund</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -6797,12 +6805,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Nachbar-Details...</translation>
|
<translation>Nachbar-Details...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+201"/>
|
<location line="+198"/>
|
||||||
<source>Unknown</source>
|
<source>Unknown</source>
|
||||||
<translation>Unbekannt</translation>
|
<translation>Unbekannt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-301"/>
|
<location line="-298"/>
|
||||||
<source>Authentication matrix</source>
|
<source>Authentication matrix</source>
|
||||||
<translation>Authentifizierungsmatrix</translation>
|
<translation>Authentifizierungsmatrix</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -6812,28 +6820,17 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Netzwerk Ansicht</translation>
|
<translation>Netzwerk Ansicht</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+377"/>
|
<location line="+374"/>
|
||||||
<source>yourself</source>
|
<source>yourself</source>
|
||||||
<translation>selbst</translation>
|
<translation>selbst</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+142"/>
|
|
||||||
<location line="+16"/>
|
|
||||||
<location line="+4"/>
|
|
||||||
<location line="+6"/>
|
|
||||||
<source>RetroShare</source>
|
|
||||||
<translation></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location line="-9"/>
|
|
||||||
<source>Certificate file successfully created</source>
|
<source>Certificate file successfully created</source>
|
||||||
<translation>Zertifikat-Datei erfolgreich erstellt</translation>
|
<translation type="obsolete">Zertifikat-Datei erfolgreich erstellt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+4"/>
|
|
||||||
<location line="+6"/>
|
|
||||||
<source>Sorry, certificate file creation failed</source>
|
<source>Sorry, certificate file creation failed</source>
|
||||||
<translation>Zertifikat-Datei konnte nicht erstellt werden</translation>
|
<translation type="obsolete">Zertifikat-Datei konnte nicht erstellt werden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/NetworkDialog.ui" line="-179"/>
|
<location filename="../gui/NetworkDialog.ui" line="-179"/>
|
||||||
@ -6889,19 +6886,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Peer ID</translation>
|
<translation>Peer ID</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/NetworkDialog.cpp" line="-26"/>
|
|
||||||
<source>Sorry, create certificate failed</source>
|
<source>Sorry, create certificate failed</source>
|
||||||
<translation>Zertifikat-Datei konnte nicht erstellt werden</translation>
|
<translation type="obsolete">Zertifikat-Datei konnte nicht erstellt werden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+6"/>
|
|
||||||
<source>Please choose a filename</source>
|
<source>Please choose a filename</source>
|
||||||
<translation>Bitte wählen sie einen Dateinamen</translation>
|
<translation type="obsolete">Bitte wählen sie einen Dateinamen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+2"/>
|
|
||||||
<source>RetroShare Certificate (*.rsc );;All Files (*)</source>
|
<source>RetroShare Certificate (*.rsc );;All Files (*)</source>
|
||||||
<translation>RetroShare Zertifikat (*.rsc );;Alle Dateien (*)</translation>
|
<translation type="obsolete">RetroShare Zertifikat (*.rsc );;Alle Dateien (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -7315,12 +7309,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Chat</translation>
|
<translation>Chat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+674"/>
|
<location line="+675"/>
|
||||||
<source>Save Certificate</source>
|
<source>Save Certificate</source>
|
||||||
<translation>Zertifikat speichern</translation>
|
<translation>Zertifikat speichern</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>Certificates (*.pqi)</source>
|
<source>Certificates (*.pqi)</source>
|
||||||
<translation>Zertifikate (*.pqi)</translation>
|
<translation>Zertifikate (*.pqi)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7435,18 +7429,28 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Verfügbar</translation>
|
<translation>Verfügbar</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+422"/>
|
<location line="+419"/>
|
||||||
<location line="+2"/>
|
<location line="+2"/>
|
||||||
<source>New group chat</source>
|
<source>New group chat</source>
|
||||||
<translation>Neuer Gruppenchat</translation>
|
<translation>Neuer Gruppenchat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+352"/>
|
<location line="+285"/>
|
||||||
|
<source>Load File</source>
|
||||||
|
<translation>Lade Datei</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+0"/>
|
||||||
|
<source>Pictures (*.png *.xpm *.jpg *.tiff *.gif)</source>
|
||||||
|
<translation>Bilder (*.png *.xpm *.jpg *.tiff *.gif)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+67"/>
|
||||||
<source>Add Extra File</source>
|
<source>Add Extra File</source>
|
||||||
<translation>Zusätzliche Datei hinzufügen</translation>
|
<translation>Zusätzliche Datei hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+99"/>
|
<location line="+95"/>
|
||||||
<location line="+6"/>
|
<location line="+6"/>
|
||||||
<source>Drop file error.</source>
|
<source>Drop file error.</source>
|
||||||
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
||||||
@ -7554,7 +7558,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-107"/>
|
<location line="-107"/>
|
||||||
<location filename="../gui/PeersDialog.cpp" line="-1479"/>
|
<location filename="../gui/PeersDialog.cpp" line="-1472"/>
|
||||||
<source>Add Friend</source>
|
<source>Add Friend</source>
|
||||||
<translation>Freund hinzufügen</translation>
|
<translation>Freund hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7609,12 +7613,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/PeersDialog.cpp" line="-40"/>
|
<location filename="../gui/PeersDialog.cpp" line="-40"/>
|
||||||
<location line="+846"/>
|
<location line="+843"/>
|
||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-807"/>
|
<location line="-804"/>
|
||||||
<source>Message Group</source>
|
<source>Message Group</source>
|
||||||
<translation>Gruppe anschreiben</translation>
|
<translation>Gruppe anschreiben</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7629,17 +7633,17 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Gruppe entfernen</translation>
|
<translation>Gruppe entfernen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+799"/>
|
<location line="+796"/>
|
||||||
<source>Do you want to remove this Friend?</source>
|
<source>Do you want to remove this Friend?</source>
|
||||||
<translation>Willst du diesen Freund entfernen?</translation>
|
<translation>Willst du diesen Freund entfernen?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+729"/>
|
<location line="+726"/>
|
||||||
<source>Save as...</source>
|
<source>Save as...</source>
|
||||||
<translation>Speichern unter...</translation>
|
<translation>Speichern unter...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>Text File (*.txt );;All Files (*)</source>
|
<source>Text File (*.txt );;All Files (*)</source>
|
||||||
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
|
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7667,12 +7671,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Status Spalte ausblenden</translation>
|
<translation>Status Spalte ausblenden</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/PeersDialog.cpp" line="-1805"/>
|
<location filename="../gui/PeersDialog.cpp" line="-1798"/>
|
||||||
<source>Friends Storm</source>
|
<source>Friends Storm</source>
|
||||||
<translation>Aktivitäten</translation>
|
<translation>Aktivitäten</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1160"/>
|
<location line="+1157"/>
|
||||||
<source>is typing...</source>
|
<source>is typing...</source>
|
||||||
<translation>tippt...</translation>
|
<translation>tippt...</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -7692,7 +7696,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Freunde</translation>
|
<translation>Freunde</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/PeersDialog.cpp" line="-862"/>
|
<location filename="../gui/PeersDialog.cpp" line="-859"/>
|
||||||
<location line="+80"/>
|
<location line="+80"/>
|
||||||
<source>Paste Friend Link</source>
|
<source>Paste Friend Link</source>
|
||||||
<translation>RetroShare Link einfügen</translation>
|
<translation>RetroShare Link einfügen</translation>
|
||||||
@ -7969,7 +7973,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<context>
|
<context>
|
||||||
<name>PluginFrame</name>
|
<name>PluginFrame</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/PluginManagerWidget.cpp" line="+62"/>
|
<location filename="../gui/PluginManagerWidget.cpp" line="+61"/>
|
||||||
<source>Remove</source>
|
<source>Remove</source>
|
||||||
<translation>Entfernen</translation>
|
<translation>Entfernen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -8005,12 +8009,17 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Avatar zeigen</translation>
|
<translation>Avatar zeigen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+315"/>
|
<location line="+153"/>
|
||||||
|
<source>Load Picture File</source>
|
||||||
|
<translation>Lade Bilddatei</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+155"/>
|
||||||
<source>File not found or file name not accepted.</source>
|
<source>File not found or file name not accepted.</source>
|
||||||
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
|
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+90"/>
|
<location line="+91"/>
|
||||||
<source>Messages you send will be delivered after Friend is again Online</source>
|
<source>Messages you send will be delivered after Friend is again Online</source>
|
||||||
<translation>Nachrichten, die Du versendest gehen bei diesem Freund erst wieder ein wenn er Online ist</translation>
|
<translation>Nachrichten, die Du versendest gehen bei diesem Freund erst wieder ein wenn er Online ist</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -8078,12 +8087,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Durchgestrichen</translation>
|
<translation>Durchgestrichen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/chat/PopupChatDialog.cpp" line="-261"/>
|
<location filename="../gui/chat/PopupChatDialog.cpp" line="-255"/>
|
||||||
<source>Add Extra File</source>
|
<source>Add Extra File</source>
|
||||||
<translation>Zusätzlich eine Datei hinzufügen</translation>
|
<translation>Zusätzlich eine Datei hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+165"/>
|
<location line="+158"/>
|
||||||
<location line="+6"/>
|
<location line="+6"/>
|
||||||
<source>Drop file error.</source>
|
<source>Drop file error.</source>
|
||||||
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
||||||
@ -8105,17 +8114,17 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation>Chat Verlauf speichern</translation>
|
<translation>Chat Verlauf speichern</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/chat/PopupChatDialog.cpp" line="+60"/>
|
<location filename="../gui/chat/PopupChatDialog.cpp" line="+61"/>
|
||||||
<source>Save as...</source>
|
<source>Save as...</source>
|
||||||
<translation>Speichern unter...</translation>
|
<translation>Speichern unter...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+1"/>
|
<location line="+0"/>
|
||||||
<source>Text File (*.txt );;All Files (*)</source>
|
<source>Text File (*.txt );;All Files (*)</source>
|
||||||
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
|
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-719"/>
|
<location line="-712"/>
|
||||||
<source>Your Friend is offline
|
<source>Your Friend is offline
|
||||||
Do you want to send them a Message instead</source>
|
Do you want to send them a Message instead</source>
|
||||||
<translation>Dein Freund ist Offline willst du ihm stattdessen eine Nachricht senden</translation>
|
<translation>Dein Freund ist Offline willst du ihm stattdessen eine Nachricht senden</translation>
|
||||||
@ -8126,7 +8135,7 @@ Do you want to send them a Message instead</source>
|
|||||||
<translation>Bild anhängen</translation>
|
<translation>Bild anhängen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/chat/PopupChatDialog.cpp" line="+761"/>
|
<location filename="../gui/chat/PopupChatDialog.cpp" line="+755"/>
|
||||||
<source>is Idle and may not reply</source>
|
<source>is Idle and may not reply</source>
|
||||||
<translation>antwortet möglicherweise nicht, da der Status auf "Untätig" gesetzt wurde</translation>
|
<translation>antwortet möglicherweise nicht, da der Status auf "Untätig" gesetzt wurde</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -8146,7 +8155,7 @@ Do you want to send them a Message instead</source>
|
|||||||
<translation>ist Offline.</translation>
|
<translation>ist Offline.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-719"/>
|
<location line="-713"/>
|
||||||
<source>Paste RetroShare Link</source>
|
<source>Paste RetroShare Link</source>
|
||||||
<translation>RetroShare Link einfügen</translation>
|
<translation>RetroShare Link einfügen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -8195,6 +8204,16 @@ Do you want to send them a Message instead</source>
|
|||||||
<source>RetroShare</source>
|
<source>RetroShare</source>
|
||||||
<translation>RetroShare</translation>
|
<translation>RetroShare</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+7"/>
|
||||||
|
<source>Load File</source>
|
||||||
|
<translation>Lade Datei</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+0"/>
|
||||||
|
<source>Pictures (*.png *.xpm *.jpg *.tiff *.gif)</source>
|
||||||
|
<translation>Bilder (*.png *.xpm *.jpg *.tiff *.gif)</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrintPreview</name>
|
<name>PrintPreview</name>
|
||||||
@ -8336,7 +8355,7 @@ Do you want to send them a Message instead</source>
|
|||||||
<context>
|
<context>
|
||||||
<name>ProfileView</name>
|
<name>ProfileView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui/profile/ProfileView.cpp" line="+72"/>
|
<location filename="../gui/profile/ProfileView.cpp" line="+70"/>
|
||||||
<source>Clear Photo</source>
|
<source>Clear Photo</source>
|
||||||
<translation>Photo entfernen</translation>
|
<translation>Photo entfernen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -8743,17 +8762,17 @@ p, li { white-space: pre-wrap; }
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../gui/elastic/node.cpp" line="+320"/>
|
<location filename="../gui/elastic/node.cpp" line="+320"/>
|
||||||
<source>Deny friend</source>
|
<source>Deny friend</source>
|
||||||
<translation type="unfinished">Blockiere Freund</translation>
|
<translation>Blockiere Freund</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+2"/>
|
<location line="+2"/>
|
||||||
<source>Make friend</source>
|
<source>Make friend</source>
|
||||||
<translation type="unfinished">Freund hinzufügen</translation>
|
<translation>Freund hinzufügen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+2"/>
|
<location line="+2"/>
|
||||||
<source>Peer details</source>
|
<source>Peer details</source>
|
||||||
<translation type="unfinished">Nachbar Details</translation>
|
<translation>Nachbar Details</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -9281,7 +9300,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+196"/>
|
<location line="+196"/>
|
||||||
<location filename="../gui/SearchDialog.cpp" line="+218"/>
|
<location filename="../gui/SearchDialog.cpp" line="+219"/>
|
||||||
<source>Download</source>
|
<source>Download</source>
|
||||||
<translation>Herunterladen</translation>
|
<translation>Herunterladen</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -10694,7 +10713,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+26"/>
|
<location line="+26"/>
|
||||||
<location filename="../gui/feeds/SubFileItem.cpp" line="+578"/>
|
<location filename="../gui/feeds/SubFileItem.cpp" line="+576"/>
|
||||||
<location line="+6"/>
|
<location line="+6"/>
|
||||||
<source>Play File</source>
|
<source>Play File</source>
|
||||||
<translation>Datei abspielen</translation>
|
<translation>Datei abspielen</translation>
|
||||||
@ -11473,7 +11492,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<context>
|
<context>
|
||||||
<name>misc</name>
|
<name>misc</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../util/misc.h" line="+118"/>
|
<location filename="../util/misc.cpp" line="+36"/>
|
||||||
<source>Unknown</source>
|
<source>Unknown</source>
|
||||||
<comment>Unknown (size)</comment>
|
<comment>Unknown (size)</comment>
|
||||||
<translation>Unbekannt</translation>
|
<translation>Unbekannt</translation>
|
||||||
@ -11509,7 +11528,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+179"/>
|
<location line="+124"/>
|
||||||
<source>Unknown</source>
|
<source>Unknown</source>
|
||||||
<translation>Unbekannt</translation>
|
<translation>Unbekannt</translation>
|
||||||
</message>
|
</message>
|
||||||
|
286
retroshare-gui/src/util/misc.cpp
Normal file
286
retroshare-gui/src/util/misc.cpp
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* This file is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, defnax
|
||||||
|
* Copyright (C) 2006 Christophe Dumez
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
// return best userfriendly storage unit (B, KiB, MiB, GiB, TiB)
|
||||||
|
// use Binary prefix standards from IEC 60027-2
|
||||||
|
// see http://en.wikipedia.org/wiki/Kilobyte
|
||||||
|
// value must be given in bytes
|
||||||
|
QString misc::friendlyUnit(float val)
|
||||||
|
{
|
||||||
|
if(val < 0) {
|
||||||
|
return tr("Unknown", "Unknown (size)");
|
||||||
|
}
|
||||||
|
const QString units[4] = {tr(" B", "bytes"), tr(" KiB", "kibibytes (1024 bytes)"), tr(" MiB", "mebibytes (1024 kibibytes)"), tr(" GiB", "gibibytes (1024 mibibytes)")};
|
||||||
|
for(unsigned int i=0; i<5; ++i) {
|
||||||
|
if (val < 1024.) {
|
||||||
|
return QString(QByteArray::number(val, 'f', 1)) + units[i];
|
||||||
|
}
|
||||||
|
val /= 1024.;
|
||||||
|
}
|
||||||
|
return QString(QByteArray::number(val, 'f', 1)) + tr(" TiB", "tebibytes (1024 gibibytes)");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool misc::isPreviewable(QString extension)
|
||||||
|
{
|
||||||
|
extension = extension.toUpper();
|
||||||
|
if(extension == "AVI") return true;
|
||||||
|
if(extension == "MP3") return true;
|
||||||
|
if(extension == "OGG") return true;
|
||||||
|
if(extension == "OGM") return true;
|
||||||
|
if(extension == "WMV") return true;
|
||||||
|
if(extension == "WMA") return true;
|
||||||
|
if(extension == "MPEG") return true;
|
||||||
|
if(extension == "MPG") return true;
|
||||||
|
if(extension == "ASF") return true;
|
||||||
|
if(extension == "QT") return true;
|
||||||
|
if(extension == "RM") return true;
|
||||||
|
if(extension == "RMVB") return true;
|
||||||
|
if(extension == "RMV") return true;
|
||||||
|
if(extension == "SWF") return true;
|
||||||
|
if(extension == "FLV") return true;
|
||||||
|
if(extension == "WAV") return true;
|
||||||
|
if(extension == "MOV") return true;
|
||||||
|
if(extension == "VOB") return true;
|
||||||
|
if(extension == "MID") return true;
|
||||||
|
if(extension == "AC3") return true;
|
||||||
|
if(extension == "MP4") return true;
|
||||||
|
if(extension == "MP2") return true;
|
||||||
|
if(extension == "AVI") return true;
|
||||||
|
if(extension == "FLAC") return true;
|
||||||
|
if(extension == "AU") return true;
|
||||||
|
if(extension == "MPE") return true;
|
||||||
|
if(extension == "MOV") return true;
|
||||||
|
if(extension == "MKV") return true;
|
||||||
|
if(extension == "AIF") return true;
|
||||||
|
if(extension == "AIFF") return true;
|
||||||
|
if(extension == "AIFC") return true;
|
||||||
|
if(extension == "RA") return true;
|
||||||
|
if(extension == "RAM") return true;
|
||||||
|
if(extension == "M4P") return true;
|
||||||
|
if(extension == "M4A") return true;
|
||||||
|
if(extension == "3GP") return true;
|
||||||
|
if(extension == "AAC") return true;
|
||||||
|
if(extension == "SWA") return true;
|
||||||
|
if(extension == "MPC") return true;
|
||||||
|
if(extension == "MPP") return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return qBittorrent config path
|
||||||
|
QString misc::qBittorrentPath()
|
||||||
|
{
|
||||||
|
QString qBtPath = QDir::homePath()+QDir::separator()+QString::fromUtf8(".qbittorrent") + QDir::separator();
|
||||||
|
// Create dir if it does not exist
|
||||||
|
if(!QFile::exists(qBtPath)){
|
||||||
|
QDir dir(qBtPath);
|
||||||
|
dir.mkpath(qBtPath);
|
||||||
|
}
|
||||||
|
return qBtPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString misc::findFileInDir(QString dir_path, QString fileName)
|
||||||
|
{
|
||||||
|
QDir dir(dir_path);
|
||||||
|
if(dir.exists(fileName)) {
|
||||||
|
return dir.filePath(fileName);
|
||||||
|
}
|
||||||
|
QStringList subDirs = dir.entryList(QDir::Dirs);
|
||||||
|
QString subdir_name;
|
||||||
|
foreach(subdir_name, subDirs) {
|
||||||
|
QString result = findFileInDir(dir.path()+QDir::separator()+subdir_name, fileName);
|
||||||
|
if(!result.isNull()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't use template class for QString because >,< use unicode code for sorting
|
||||||
|
// which is not what a human would expect when sorting strings.
|
||||||
|
void misc::insertSortString(QList<QPair<int, QString> > &list, QPair<int, QString> value, Qt::SortOrder sortOrder)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
if(sortOrder == Qt::AscendingOrder) {
|
||||||
|
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) > 0) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) < 0) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.insert(i, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
float misc::getPluginVersion(QString filePath)
|
||||||
|
{
|
||||||
|
QFile plugin(filePath);
|
||||||
|
if(!plugin.exists()){
|
||||||
|
qDebug("%s plugin does not exist, returning 0.0", filePath.toUtf8().data());
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
if(!plugin.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
float version = 0.0;
|
||||||
|
while (!plugin.atEnd()){
|
||||||
|
QByteArray line = plugin.readLine();
|
||||||
|
if(line.startsWith("#VERSION: ")){
|
||||||
|
line = line.split(' ').last();
|
||||||
|
line.replace("\n", "");
|
||||||
|
version = line.toFloat();
|
||||||
|
qDebug("plugin %s version: %.2f", filePath.toUtf8().data(), version);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take a number of seconds and return an user-friendly
|
||||||
|
// time duration like "1d 2h 10m".
|
||||||
|
QString misc::userFriendlyDuration(qlonglong seconds)
|
||||||
|
{
|
||||||
|
if(seconds < 0) {
|
||||||
|
return tr("Unknown");
|
||||||
|
}
|
||||||
|
if(seconds < 60) {
|
||||||
|
return tr("< 1m", "< 1 minute");
|
||||||
|
}
|
||||||
|
int minutes = seconds / 60;
|
||||||
|
if(minutes < 60) {
|
||||||
|
return tr("%1 minutes","e.g: 10minutes").arg(QString::QString::fromUtf8(misc::toString(minutes).c_str()));
|
||||||
|
}
|
||||||
|
int hours = minutes / 60;
|
||||||
|
minutes = minutes - hours*60;
|
||||||
|
if(hours < 24) {
|
||||||
|
return tr("%1h %2m", "e.g: 3hours 5minutes").arg(QString::fromUtf8(misc::toString(hours).c_str())).arg(QString::fromUtf8(misc::toString(minutes).c_str()));
|
||||||
|
}
|
||||||
|
int days = hours / 24;
|
||||||
|
hours = hours - days * 24;
|
||||||
|
if(days < 365) {
|
||||||
|
return tr("%1d %2h", "e.g: 2days 10hours").arg(QString::fromUtf8(misc::toString(days).c_str())).arg(QString::fromUtf8(misc::toString(hours).c_str()));
|
||||||
|
}
|
||||||
|
int years = days / 365;
|
||||||
|
days = days - years * 365;
|
||||||
|
return tr("%1y %2d", "e.g: 2 years 2days ").arg(QString::fromUtf8(misc::toString(years).c_str())).arg(QString::fromUtf8(misc::toString(days).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString misc::userFriendlyUnit(double count, unsigned int decimal, double factor)
|
||||||
|
{
|
||||||
|
if (count <= 0.0) {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString output;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
if (count < factor) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
count /= factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString unit;
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
decimal = 0; // no decimal
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
unit = tr("k", "e.g: 3.1 k");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
unit = tr("M", "e.g: 3.1 M");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
unit = tr("G", "e.g: 3.1 G");
|
||||||
|
break;
|
||||||
|
default: // >= 4
|
||||||
|
unit = tr("T", "e.g: 3.1 T");
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString("%1 %2").arg(count, 0, 'f', decimal).arg(unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString misc::removeNewLine(const QString &text)
|
||||||
|
{
|
||||||
|
return QString(text).replace("\n", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString misc::removeNewLine(const std::string &text)
|
||||||
|
{
|
||||||
|
return QString::fromUtf8(text.c_str()).replace("\n", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString misc::removeNewLine(const std::wstring &text)
|
||||||
|
{
|
||||||
|
return QString::fromStdWString(text).replace("\n", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool misc::getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file)
|
||||||
|
{
|
||||||
|
QString lastDir = Settings->getLastDir(type);
|
||||||
|
|
||||||
|
file = QFileDialog::getOpenFileName(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
|
if (file.isEmpty() == false) {
|
||||||
|
lastDir = QFileInfo(file).absoluteDir().absolutePath();
|
||||||
|
Settings->setLastDir(type, lastDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !file.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool misc::getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QStringList &files)
|
||||||
|
{
|
||||||
|
QString lastDir = Settings->getLastDir(type);
|
||||||
|
|
||||||
|
files = QFileDialog::getOpenFileNames(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
|
if (files.isEmpty() == false) {
|
||||||
|
lastDir = QFileInfo(*files.begin()).absoluteDir().absolutePath();
|
||||||
|
Settings->setLastDir(type, lastDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !files.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file)
|
||||||
|
{
|
||||||
|
QString lastDir = Settings->getLastDir(type);
|
||||||
|
|
||||||
|
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter);
|
||||||
|
|
||||||
|
if (file.isEmpty() == false) {
|
||||||
|
lastDir = QFileInfo(file).absoluteDir().absolutePath();
|
||||||
|
Settings->setLastDir(type, lastDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !file.isEmpty();
|
||||||
|
}
|
@ -26,26 +26,14 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QList>
|
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <QItemDelegate>
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include <QStyleOptionProgressBarV2>
|
|
||||||
#include <QStyleOptionViewItemV2>
|
|
||||||
#include <QModelIndex>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QProgressBar>
|
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Miscellaneaous functions that can be useful */
|
/* Miscellaneaous functions that can be useful */
|
||||||
class misc : public QObject{
|
class misc : public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -113,272 +101,65 @@ class misc : public QObject{
|
|||||||
// use Binary prefix standards from IEC 60027-2
|
// use Binary prefix standards from IEC 60027-2
|
||||||
// see http://en.wikipedia.org/wiki/Kilobyte
|
// see http://en.wikipedia.org/wiki/Kilobyte
|
||||||
// value must be given in bytes
|
// value must be given in bytes
|
||||||
static QString friendlyUnit(float val) {
|
static QString friendlyUnit(float val);
|
||||||
if(val < 0) {
|
|
||||||
return tr("Unknown", "Unknown (size)");
|
|
||||||
}
|
|
||||||
const QString units[4] = {tr(" B", "bytes"), tr(" KiB", "kibibytes (1024 bytes)"), tr(" MiB", "mebibytes (1024 kibibytes)"), tr(" GiB", "gibibytes (1024 mibibytes)")};
|
|
||||||
for(unsigned int i=0; i<5; ++i) {
|
|
||||||
if (val < 1024.) {
|
|
||||||
return QString(QByteArray::number(val, 'f', 1)) + units[i];
|
|
||||||
}
|
|
||||||
val /= 1024.;
|
|
||||||
}
|
|
||||||
return QString(QByteArray::number(val, 'f', 1)) + tr(" TiB", "tebibytes (1024 gibibytes)");
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isPreviewable(QString extension){
|
static bool isPreviewable(QString extension);
|
||||||
extension = extension.toUpper();
|
|
||||||
if(extension == "AVI") return true;
|
|
||||||
if(extension == "MP3") return true;
|
|
||||||
if(extension == "OGG") return true;
|
|
||||||
if(extension == "OGM") return true;
|
|
||||||
if(extension == "WMV") return true;
|
|
||||||
if(extension == "WMA") return true;
|
|
||||||
if(extension == "MPEG") return true;
|
|
||||||
if(extension == "MPG") return true;
|
|
||||||
if(extension == "ASF") return true;
|
|
||||||
if(extension == "QT") return true;
|
|
||||||
if(extension == "RM") return true;
|
|
||||||
if(extension == "RMVB") return true;
|
|
||||||
if(extension == "RMV") return true;
|
|
||||||
if(extension == "SWF") return true;
|
|
||||||
if(extension == "FLV") return true;
|
|
||||||
if(extension == "WAV") return true;
|
|
||||||
if(extension == "MOV") return true;
|
|
||||||
if(extension == "VOB") return true;
|
|
||||||
if(extension == "MID") return true;
|
|
||||||
if(extension == "AC3") return true;
|
|
||||||
if(extension == "MP4") return true;
|
|
||||||
if(extension == "MP2") return true;
|
|
||||||
if(extension == "AVI") return true;
|
|
||||||
if(extension == "FLAC") return true;
|
|
||||||
if(extension == "AU") return true;
|
|
||||||
if(extension == "MPE") return true;
|
|
||||||
if(extension == "MOV") return true;
|
|
||||||
if(extension == "MKV") return true;
|
|
||||||
if(extension == "AIF") return true;
|
|
||||||
if(extension == "AIFF") return true;
|
|
||||||
if(extension == "AIFC") return true;
|
|
||||||
if(extension == "RA") return true;
|
|
||||||
if(extension == "RAM") return true;
|
|
||||||
if(extension == "M4P") return true;
|
|
||||||
if(extension == "M4A") return true;
|
|
||||||
if(extension == "3GP") return true;
|
|
||||||
if(extension == "AAC") return true;
|
|
||||||
if(extension == "SWA") return true;
|
|
||||||
if(extension == "MPC") return true;
|
|
||||||
if(extension == "MPP") return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return qBittorrent config path
|
// return qBittorrent config path
|
||||||
static QString qBittorrentPath() {
|
static QString qBittorrentPath();
|
||||||
QString qBtPath = QDir::homePath()+QDir::separator()+QString::fromUtf8(".qbittorrent") + QDir::separator();
|
|
||||||
// Create dir if it does not exist
|
|
||||||
if(!QFile::exists(qBtPath)){
|
|
||||||
QDir dir(qBtPath);
|
|
||||||
dir.mkpath(qBtPath);
|
|
||||||
}
|
|
||||||
return qBtPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not used anymore because it is not safe
|
|
||||||
// static bool removePath(QString path) {
|
|
||||||
// qDebug((QString::fromUtf8("file to delete:") + path).toUtf8());
|
|
||||||
// if(!QFile::remove(path)) {
|
|
||||||
// // Probably a folder
|
|
||||||
// QDir current_dir(path);
|
|
||||||
// if(current_dir.exists()) {
|
|
||||||
// //Remove sub items
|
|
||||||
// QStringList subItems = current_dir.entryList();
|
|
||||||
// QString item;
|
|
||||||
// foreach(item, subItems) {
|
|
||||||
// if(item != QString::fromUtf8(".") && item != QString::fromUtf8("..")) {
|
|
||||||
// qDebug("-> Removing "+(path+QDir::separator()+item).toUtf8());
|
|
||||||
// removePath(path+QDir::separator()+item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // Remove empty folder
|
|
||||||
// if(current_dir.rmdir(path)) {
|
|
||||||
// return true;
|
|
||||||
// }else{
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
static QString findFileInDir(QString dir_path, QString fileName) {
|
|
||||||
QDir dir(dir_path);
|
|
||||||
if(dir.exists(fileName)) {
|
|
||||||
return dir.filePath(fileName);
|
|
||||||
}
|
|
||||||
QStringList subDirs = dir.entryList(QDir::Dirs);
|
|
||||||
QString subdir_name;
|
|
||||||
foreach(subdir_name, subDirs) {
|
|
||||||
QString result = findFileInDir(dir.path()+QDir::separator()+subdir_name, fileName);
|
|
||||||
if(!result.isNull()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static QString findFileInDir(QString dir_path, QString fileName);
|
||||||
|
|
||||||
// Insertion sort, used instead of bubble sort because it is
|
// Insertion sort, used instead of bubble sort because it is
|
||||||
// approx. 5 times faster.
|
// approx. 5 times faster.
|
||||||
template <class T> static void insertSort(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder) {
|
// template <class T> static void insertSort(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder) {
|
||||||
int i = 0;
|
// int i = 0;
|
||||||
if(sortOrder == Qt::AscendingOrder) {
|
// if(sortOrder == Qt::AscendingOrder) {
|
||||||
while(i < list.size() and value.second > list.at(i).second) {
|
// while(i < list.size() and value.second > list.at(i).second) {
|
||||||
++i;
|
// ++i;
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
while(i < list.size() and value.second < list.at(i).second) {
|
// while(i < list.size() and value.second < list.at(i).second) {
|
||||||
++i;
|
// ++i;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
list.insert(i, value);
|
// list.insert(i, value);
|
||||||
}
|
// }
|
||||||
|
|
||||||
template <class T> static void insertSort2(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder) {
|
// template <class T> static void insertSort2(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder) {
|
||||||
int i = 0;
|
// int i = 0;
|
||||||
if(sortOrder == Qt::AscendingOrder) {
|
// if(sortOrder == Qt::AscendingOrder) {
|
||||||
while(i < list.size() and value.first > list.at(i).first) {
|
// while(i < list.size() and value.first > list.at(i).first) {
|
||||||
++i;
|
// ++i;
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
while(i < list.size() and value.first < list.at(i).first) {
|
// while(i < list.size() and value.first < list.at(i).first) {
|
||||||
++i;
|
// ++i;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
list.insert(i, value);
|
// list.insert(i, value);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Can't use template class for QString because >,< use unicode code for sorting
|
// Can't use template class for QString because >,< use unicode code for sorting
|
||||||
// which is not what a human would expect when sorting strings.
|
// which is not what a human would expect when sorting strings.
|
||||||
static void insertSortString(QList<QPair<int, QString> > &list, QPair<int, QString> value, Qt::SortOrder sortOrder) {
|
static void insertSortString(QList<QPair<int, QString> > &list, QPair<int, QString> value, Qt::SortOrder sortOrder);
|
||||||
int i = 0;
|
|
||||||
if(sortOrder == Qt::AscendingOrder) {
|
|
||||||
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) > 0) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) < 0) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.insert(i, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static float getPluginVersion(QString filePath) {
|
static float getPluginVersion(QString filePath);
|
||||||
QFile plugin(filePath);
|
|
||||||
if(!plugin.exists()){
|
|
||||||
qDebug("%s plugin does not exist, returning 0.0", filePath.toUtf8().data());
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
if(!plugin.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
float version = 0.0;
|
|
||||||
while (!plugin.atEnd()){
|
|
||||||
QByteArray line = plugin.readLine();
|
|
||||||
if(line.startsWith("#VERSION: ")){
|
|
||||||
line = line.split(' ').last();
|
|
||||||
line.replace("\n", "");
|
|
||||||
version = line.toFloat();
|
|
||||||
qDebug("plugin %s version: %.2f", filePath.toUtf8().data(), version);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take a number of seconds and return an user-friendly
|
// Take a number of seconds and return an user-friendly
|
||||||
// time duration like "1d 2h 10m".
|
// time duration like "1d 2h 10m".
|
||||||
static QString userFriendlyDuration(qlonglong seconds)
|
static QString userFriendlyDuration(qlonglong seconds);
|
||||||
{
|
|
||||||
if(seconds < 0) {
|
|
||||||
return tr("Unknown");
|
|
||||||
}
|
|
||||||
if(seconds < 60) {
|
|
||||||
return tr("< 1m", "< 1 minute");
|
|
||||||
}
|
|
||||||
int minutes = seconds / 60;
|
|
||||||
if(minutes < 60) {
|
|
||||||
return tr("%1 minutes","e.g: 10minutes").arg(QString::QString::fromUtf8(misc::toString(minutes).c_str()));
|
|
||||||
}
|
|
||||||
int hours = minutes / 60;
|
|
||||||
minutes = minutes - hours*60;
|
|
||||||
if(hours < 24) {
|
|
||||||
return tr("%1h %2m", "e.g: 3hours 5minutes").arg(QString::fromUtf8(misc::toString(hours).c_str())).arg(QString::fromUtf8(misc::toString(minutes).c_str()));
|
|
||||||
}
|
|
||||||
int days = hours / 24;
|
|
||||||
hours = hours - days * 24;
|
|
||||||
if(days < 365) {
|
|
||||||
return tr("%1d %2h", "e.g: 2days 10hours").arg(QString::fromUtf8(misc::toString(days).c_str())).arg(QString::fromUtf8(misc::toString(hours).c_str()));
|
|
||||||
}
|
|
||||||
int years = days / 365;
|
|
||||||
days = days - years * 365;
|
|
||||||
return tr("%1y %2d", "e.g: 2 years 2days ").arg(QString::fromUtf8(misc::toString(years).c_str())).arg(QString::fromUtf8(misc::toString(days).c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString userFriendlyUnit(double count, unsigned int decimal, double factor = 1000)
|
static QString userFriendlyUnit(double count, unsigned int decimal, double factor = 1000);
|
||||||
{
|
|
||||||
if (count <= 0.0) {
|
|
||||||
return "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString output;
|
static QString removeNewLine(const QString &text);
|
||||||
|
static QString removeNewLine(const std::string &text);
|
||||||
|
static QString removeNewLine(const std::wstring &text);
|
||||||
|
|
||||||
int i;
|
static bool getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file);
|
||||||
for (i = 0; i < 5; i++) {
|
static bool getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QStringList &files);
|
||||||
if (count < factor) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
count /= factor;
|
static bool getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file);
|
||||||
}
|
|
||||||
|
|
||||||
QString unit;
|
|
||||||
switch (i) {
|
|
||||||
case 0:
|
|
||||||
decimal = 0; // no decimal
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
unit = tr("k", "e.g: 3.1 k");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
unit = tr("M", "e.g: 3.1 M");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
unit = tr("G", "e.g: 3.1 G");
|
|
||||||
break;
|
|
||||||
default: // >= 4
|
|
||||||
unit = tr("T", "e.g: 3.1 T");
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString("%1 %2").arg(count, 0, 'f', decimal).arg(unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString removeNewLine(const QString &text)
|
|
||||||
{
|
|
||||||
return QString(text).replace("\n", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString removeNewLine(const std::string &text)
|
|
||||||
{
|
|
||||||
return QString::fromUtf8(text.c_str()).replace("\n", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString removeNewLine(const std::wstring &text)
|
|
||||||
{
|
|
||||||
return QString::fromStdWString(text).replace("\n", " ");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Trick to get a portable sleep() function
|
// Trick to get a portable sleep() function
|
||||||
|
Loading…
Reference in New Issue
Block a user