mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
RS_ prefix
This commit is contained in:
parent
584b9039c9
commit
50ee33b229
@ -37,6 +37,7 @@
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_CANCEL ":/images/delete.png"
|
||||
@ -123,11 +124,7 @@ void ShareManager::doubleClickedCell(int row,int column)
|
||||
{
|
||||
if(column == COLUMN_PATH)
|
||||
{
|
||||
#ifdef NATIVEDIALOGS
|
||||
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Choose directory"),QString(), QFileDialog::ShowDirsOnly);
|
||||
#else
|
||||
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Choose directory"),QString(),QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly);
|
||||
#endif
|
||||
QString dirname = misc::getExistingDirectory(nullptr,tr("Choose directory"),QString());
|
||||
|
||||
if(!dirname.isNull())
|
||||
{
|
||||
@ -361,11 +358,7 @@ void ShareManager::showEvent(QShowEvent *event)
|
||||
|
||||
void ShareManager::addShare()
|
||||
{
|
||||
#ifdef NATIVEDIALOGS
|
||||
QString fname = QFileDialog::getExistingDirectory(NULL,tr("Choose a directory to share"),QString(), QFileDialog::ShowDirsOnly);
|
||||
#else
|
||||
QString fname = QFileDialog::getExistingDirectory(NULL,tr("Choose a directory to share"),QString(),QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly);
|
||||
#endif
|
||||
QString fname = misc::getExistingDirectory(nullptr,tr("Choose a directory to share"),QString());
|
||||
|
||||
if(fname.isNull())
|
||||
return;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <QApplication>
|
||||
#include <QBuffer>
|
||||
#include <QColorDialog>
|
||||
#include <QFontDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
@ -1487,11 +1486,8 @@ void ChatWidget::chooseFont()
|
||||
{
|
||||
bool ok;
|
||||
//Use NULL as parent as with this QFontDialog don't take care of title nether options.
|
||||
#ifdef NATIVEDIALOGS
|
||||
QFont font = QFontDialog::getFont(&ok, currentFont, NULL, tr("Choose your font.") );
|
||||
#else
|
||||
QFont font = QFontDialog::getFont(&ok, currentFont, NULL, tr("Choose your font."),QFontDialog::DontUseNativeDialog);
|
||||
#endif
|
||||
QFont font = misc::getFont(&ok, currentFont, nullptr, tr("Choose your font."));
|
||||
|
||||
if (ok) {
|
||||
currentFont = font;
|
||||
setFont();
|
||||
|
@ -19,7 +19,6 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QFontDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <time.h>
|
||||
@ -415,11 +414,8 @@ ChatPage::load()
|
||||
void ChatPage::on_pushButtonChangeChatFont_clicked()
|
||||
{
|
||||
bool ok;
|
||||
#ifdef NATIVEDIALOGS
|
||||
QFont font = QFontDialog::getFont(&ok, fontTempChat, this, tr("Choose your default font for Chat.") );
|
||||
#else
|
||||
QFont font = QFontDialog::getFont(&ok, fontTempChat, this, tr("Choose your default font for Chat."),QFontDialog::DontUseNativeDialog);
|
||||
#endif
|
||||
QFont font = misc::getFont(&ok, fontTempChat, this, tr("Choose your default font for Chat."));
|
||||
|
||||
if (ok) {
|
||||
fontTempChat = font;
|
||||
// using fontTempChat.rawname() does not always work!
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QBuffer>
|
||||
#include <time.h>
|
||||
#include <QFontDialog>
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
@ -315,7 +316,7 @@ bool misc::getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type
|
||||
{
|
||||
QString lastDir = Settings->getLastDir(type);
|
||||
|
||||
#ifdef NATIVEDIALOGS
|
||||
#ifdef RS_NATIVEDIALOGS
|
||||
file = QFileDialog::getOpenFileName(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks | options);
|
||||
#else
|
||||
file = QFileDialog::getOpenFileName(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks | QFileDialog::DontUseNativeDialog | options);
|
||||
@ -342,7 +343,7 @@ bool misc::getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type
|
||||
{
|
||||
QString lastDir = Settings->getLastDir(type);
|
||||
|
||||
#ifdef NATIVEDIALOGS
|
||||
#ifdef RS_NATIVEDIALOGS
|
||||
files = QFileDialog::getOpenFileNames(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks | options);
|
||||
#else
|
||||
files = QFileDialog::getOpenFileNames(parent, caption, lastDir, filter, NULL, QFileDialog::DontResolveSymlinks | QFileDialog::DontUseNativeDialog | options);
|
||||
@ -372,7 +373,7 @@ bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
|
||||
{
|
||||
QString lastDir = Settings->getLastDir(type) + "/" + file;
|
||||
|
||||
#ifdef NATIVEDIALOGS
|
||||
#ifdef RS_NATIVEDIALOGS
|
||||
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter, selectedFilter, options);
|
||||
#else
|
||||
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter, selectedFilter, QFileDialog::DontUseNativeDialog | options);
|
||||
@ -386,3 +387,21 @@ bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QFont misc::getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title)
|
||||
{
|
||||
#ifdef RS_NATIVEDIALOGS
|
||||
return QFontDialog::getFont(ok, initial, parent, title);
|
||||
#else
|
||||
return QFontDialog::getFont(ok, initial, parent, title, QFontDialog::DontUseNativeDialog);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString misc::getExistingDirectory(QWidget *parent, const QString &caption, const QString &dir)
|
||||
{
|
||||
#ifdef RS_NATIVEDIALOGS
|
||||
return QFileDialog::getExistingDirectory(parent, caption, dir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
#else
|
||||
return QFileDialog::getExistingDirectory(parent, caption, dir, QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
#endif
|
||||
}
|
||||
|
@ -173,6 +173,15 @@ class misc : public QObject
|
||||
, const QString &caption , const QString &filter
|
||||
, QString &file, QString *selectedFilter = NULL
|
||||
, QFileDialog::Options options = 0);
|
||||
|
||||
static QFont getFont(bool *ok
|
||||
, const QFont &initial
|
||||
, QWidget *parent = nullptr
|
||||
, const QString &title = QString());
|
||||
|
||||
static QString getExistingDirectory(QWidget *parent = nullptr
|
||||
, const QString &caption = QString()
|
||||
, const QString &dir = QString());
|
||||
};
|
||||
|
||||
// Trick to get a portable sleep() function
|
||||
|
@ -186,10 +186,9 @@ rs_deep_search:CONFIG -= no_rs_deep_search
|
||||
# assignation to qmake command line 'RS_EXTRA_VERSION=""'
|
||||
#RS_EXTRA_VERSION=git
|
||||
|
||||
|
||||
# To enable native dialogs append the following assignation to qmake command line
|
||||
# "CONFIG+=use_native_dialogs"
|
||||
use_native_dialogs:DEFINES *= NATIVEDIALOGS
|
||||
# "CONFIG+=rs_use_native_dialogs"
|
||||
rs_use_native_dialogs:DEFINES *= RS_NATIVEDIALOGS
|
||||
|
||||
###########################################################################################################################################################
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user