mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-01 04:46:47 -05:00
commit
dd7de312a1
104 changed files with 1252 additions and 408 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include <retroshare/rsdisc.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "settings/rsharesettings.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QSysInfo>
|
||||
|
|
@ -42,6 +43,9 @@
|
|||
#include <QMessageBox>
|
||||
#include <QStyle>
|
||||
#include <assert.h>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
AboutWidget::AboutWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
|
|
@ -211,7 +215,7 @@ void AWidget::initImages()
|
|||
if(height() == 0) return ;
|
||||
|
||||
image1 = QImage(width(),height(),QImage::Format_ARGB32);
|
||||
image1.fill(palette().color(QPalette::Background));
|
||||
image1.fill(palette().color(QPalette::Window));
|
||||
|
||||
//QImage image(":/images/logo/logo_info.png");
|
||||
QPixmap image(":/images/logo/logo_splash.png");
|
||||
|
|
@ -267,7 +271,7 @@ void AWidget::initGoL()
|
|||
|
||||
void AWidget::drawBitField()
|
||||
{
|
||||
image2.fill(palette().color(QPalette::Background));
|
||||
image2.fill(palette().color(QPalette::Window));
|
||||
QPainter p(&image2) ;
|
||||
|
||||
p.setPen(QColor(200,200,200));
|
||||
|
|
@ -306,7 +310,7 @@ void AWidget::drawBitField()
|
|||
AWidget::AWidget()
|
||||
: page(0), density(5)
|
||||
, mImagesReady(false), mState(0), mTimerId(0)
|
||||
, mStep(1.0f), mMaxStep(QFontMetricsF(font()).width(' '))
|
||||
, mStep(1.0f), mMaxStep(QFontMetrics_horizontalAdvance(QFontMetricsF(font()), ' '))
|
||||
{
|
||||
setMouseTracking(true);
|
||||
//startTimer(15);
|
||||
|
|
@ -774,7 +778,7 @@ void TBoard::showNextPiece() {
|
|||
|
||||
QPixmap pixmap(dx * squareWidth(), dy * squareHeight());
|
||||
QPainter painter(&pixmap);
|
||||
painter.fillRect(pixmap.rect(), nextPieceLabel->palette().background());
|
||||
painter.fillRect(pixmap.rect(), nextPieceLabel->palette().window());
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
int x = nextPiece.x(i) - nextPiece.minX();
|
||||
|
|
@ -809,18 +813,23 @@ void TBoard::drawSquare(QPainter &painter, int x, int y, TPiece::Shape shape) {
|
|||
QColor color = colorTable[int(shape)];
|
||||
painter.fillRect(x + 1, y + 1, squareWidth() - 2, squareHeight() - 2, color);
|
||||
|
||||
painter.setPen(color.light());
|
||||
painter.setPen(color.lighter());
|
||||
painter.drawLine(x, y + squareHeight() - 1, x, y);
|
||||
painter.drawLine(x, y, x + squareWidth() - 1, y);
|
||||
|
||||
painter.setPen(color.dark());
|
||||
painter.setPen(color.darker());
|
||||
painter.drawLine(x + 1, y + squareHeight() - 1, x + squareWidth() - 1, y + squareHeight() - 1);
|
||||
painter.drawLine(x + squareWidth() - 1, y + squareHeight() - 1, x + squareWidth() - 1, y + 1);
|
||||
}
|
||||
|
||||
|
||||
void TPiece::setRandomShape() {
|
||||
setShape(TPiece::Shape(qrand() % 7 + 1));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int rand = QRandomGenerator::global()->generate();
|
||||
#else
|
||||
int rand = qrand();
|
||||
#endif
|
||||
setShape(TPiece::Shape(rand % 7 + 1));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -905,7 +914,7 @@ TPiece TPiece::rotatedRight() const {
|
|||
NextPieceLabel::NextPieceLabel( QWidget* parent /* = 0*/ ) : QLabel(parent)
|
||||
{
|
||||
QPalette p = palette();
|
||||
p.setColor(QPalette::Background, Qt::white);
|
||||
p.setColor(QPalette::Window, Qt::white);
|
||||
setPalette(p);
|
||||
setFrameShape(QFrame::Box);
|
||||
setAlignment(Qt::AlignCenter);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
#include "gui/Identity/IdEditDialog.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
//#define DEBUG_CREATE_CIRCLE_DIALOG 1
|
||||
|
||||
|
|
@ -74,7 +75,7 @@ CreateCircleDialog::CreateCircleDialog()
|
|||
ui.IdFilter->addFilter(QIcon(), headerText, RSCIRCLEID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
|
||||
|
||||
/* Set initial column width */
|
||||
int fontWidth = QFontMetricsF(ui.treeWidget_IdList->font()).width("W");
|
||||
int fontWidth = QFontMetrics_horizontalAdvance(QFontMetricsF(ui.treeWidget_IdList->font()), "W");
|
||||
ui.treeWidget_IdList->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth);
|
||||
ui.treeWidget_membership->setColumnWidth(RSCIRCLEID_COL_NICKNAME, 17 * fontWidth);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <retroshare/rstypes.h>
|
||||
#include <QModelIndex>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionProgressBarV2>
|
||||
#include <QStyleOptionProgressBar>
|
||||
#include <QProgressBar>
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "DLListDelegate.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
Q_DECLARE_METATYPE(FileProgressInfo)
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
{
|
||||
QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")};
|
||||
QStyleOptionViewItem opt = option;
|
||||
QStyleOptionProgressBarV2 newopt;
|
||||
QStyleOptionProgressBar newopt;
|
||||
QRect pixmapRect;
|
||||
QPixmap pixmap;
|
||||
qlonglong fileSize;
|
||||
|
|
@ -60,7 +61,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
painter->setClipRect(opt.rect);
|
||||
|
||||
//set text color
|
||||
QVariant value = index.data(Qt::TextColorRole);
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||
}
|
||||
|
|
@ -278,7 +279,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
|
||||
QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
{
|
||||
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
|
||||
float w = QFontMetrics_horizontalAdvance(QFontMetricsF(option.font), index.data(Qt::DisplayRole).toString());
|
||||
|
||||
int S = QFontMetricsF(option.font).height()*1.5 ;
|
||||
return QSize(w,S);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void FileTransferInfoWidget::updateDisplay()
|
|||
setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&pixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
|
||||
float S = QFontMetricsF(font()).height();
|
||||
int chunk_square_size = S*chunk_square_size_factor;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public:
|
|||
{
|
||||
Q_ASSERT(index.isValid());
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
// disable default icon
|
||||
opt.icon = QIcon();
|
||||
|
|
@ -199,7 +199,7 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
|||
tree_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
||||
tree_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME);
|
||||
tree_proxyModel->setFilterRole(RetroshareDirModel::FilterRole);
|
||||
tree_proxyModel->setFilterRegExp(QRegExp(QString(SHARED_FILES_DIALOG_FILTER_STRING))) ;
|
||||
QSortFilterProxyModel_setFilterRegularExpression(tree_proxyModel, QString(SHARED_FILES_DIALOG_FILTER_STRING)) ;
|
||||
|
||||
flat_proxyModel = new SFDSortFilterProxyModel(flat_model, this);
|
||||
flat_proxyModel->setSourceModel(flat_model);
|
||||
|
|
@ -207,7 +207,7 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
|||
flat_proxyModel->setSortRole(RetroshareDirModel::SortRole);
|
||||
flat_proxyModel->sort(SHARED_FILES_DIALOG_COLUMN_NAME);
|
||||
flat_proxyModel->setFilterRole(RetroshareDirModel::FilterRole);
|
||||
flat_proxyModel->setFilterRegExp(QRegExp(QString(SHARED_FILES_DIALOG_FILTER_STRING))) ;
|
||||
QSortFilterProxyModel_setFilterRegularExpression(flat_proxyModel, QString(SHARED_FILES_DIALOG_FILTER_STRING)) ;
|
||||
|
||||
connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||
connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter()));
|
||||
|
|
@ -1018,7 +1018,7 @@ void SharedFilesDialog::recursExpandAll(const QModelIndex& index)
|
|||
|
||||
for(int row=0;row<ui.dirTreeView->model()->rowCount(index);++row)
|
||||
{
|
||||
QModelIndex idx(index.child(row,0)) ;
|
||||
QModelIndex idx(ui.dirTreeView->model()->index(row,0,index)) ;
|
||||
|
||||
if(ui.dirTreeView->model()->rowCount(idx) > 0)
|
||||
recursExpandAll(idx) ;
|
||||
|
|
@ -1131,7 +1131,10 @@ void SharedFilesDialog::postModDirectories(bool local)
|
|||
#ifdef DEBUG_SHARED_FILES_DIALOG
|
||||
std::cerr << "****** updated directories! Re-enabling sorting ******" << std::endl;
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
|
||||
QCoreApplication::flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
class ChannelCompare
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "util/RsQtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "retroshare/rsdisc.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
|
|
@ -286,7 +287,7 @@ public:
|
|||
{
|
||||
case Qt::SizeHintRole: return sizeHintRole(index.column()) ;
|
||||
case Qt::TextAlignmentRole:
|
||||
case Qt::TextColorRole:
|
||||
case Qt::ForegroundRole:
|
||||
case Qt::WhatsThisRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::ToolTipRole:
|
||||
|
|
@ -434,7 +435,7 @@ public:
|
|||
|
||||
//Get Last Access on File
|
||||
if (file.exists())
|
||||
qi64LastDL = file.lastModified().toTime_t();
|
||||
qi64LastDL = DateTime::DateTimeToTime_t(file.lastModified());
|
||||
}
|
||||
return QVariant(qi64LastDL) ;
|
||||
}
|
||||
|
|
@ -2646,5 +2647,5 @@ void TransfersDialog::filterChanged(const QString& /*text*/)
|
|||
int filterColumn = ui.filterLineEdit->currentFilter();
|
||||
QString text = ui.filterLineEdit->text();
|
||||
DLLFilterModel->setFilterKeyColumn(filterColumn);
|
||||
DLLFilterModel->setFilterRegExp(text);
|
||||
QSortFilterProxyModel_setFilterRegularExpression(DLLFilterModel, text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "ULListDelegate.h"
|
||||
#include "xprogressbar.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
Q_DECLARE_METATYPE(FileProgressInfo)
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
{
|
||||
QString byteUnits[4] = {tr("B"), tr("KB"), tr("MB"), tr("GB")};
|
||||
QStyleOptionViewItem opt = option;
|
||||
QStyleOptionProgressBarV2 newopt;
|
||||
QStyleOptionProgressBar newopt;
|
||||
QRect pixmapRect;
|
||||
QPixmap pixmap;
|
||||
qlonglong fileSize;
|
||||
|
|
@ -52,7 +53,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
painter->setClipRect(opt.rect);
|
||||
|
||||
//set text color
|
||||
QVariant value = index.data(Qt::TextColorRole);
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||
}
|
||||
|
|
@ -179,7 +180,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
|
||||
QSize ULListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
{
|
||||
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
|
||||
float w = QFontMetrics_horizontalAdvance(QFontMetricsF(option.font), index.data(Qt::DisplayRole).toString());
|
||||
|
||||
int S = QFontMetricsF(option.font).height()*1.5 ;
|
||||
return QSize(w,S);
|
||||
|
|
|
|||
|
|
@ -613,7 +613,9 @@ void GenCertDialog::genPerson()
|
|||
std::cout << "Waiting ed->processEvents()" << std::endl;
|
||||
#endif
|
||||
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
|
||||
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
|
||||
if (ed->hasPendingEvents())
|
||||
#endif
|
||||
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));
|
||||
|
||||
std::string email_str = "" ;
|
||||
|
|
|
|||
|
|
@ -332,95 +332,8 @@ void GetStartedDialog::emailSupport()
|
|||
QString text = QString("Hello") + "\n";
|
||||
text += "\n";
|
||||
|
||||
QString sysVersion;
|
||||
QString sysVersion = QSysInfo::prettyProductName();
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
switch(QSysInfo::MacintoshVersion)
|
||||
{
|
||||
case QSysInfo::MV_9:
|
||||
sysVersion = "Mac OS 9";
|
||||
break;
|
||||
case QSysInfo::MV_10_0:
|
||||
sysVersion = "Mac OSX 10.0";
|
||||
break;
|
||||
case QSysInfo::MV_10_1:
|
||||
sysVersion = "Mac OSX 10.1";
|
||||
break;
|
||||
case QSysInfo::MV_10_2:
|
||||
sysVersion = "Mac OSX 10.2";
|
||||
break;
|
||||
case QSysInfo::MV_10_3:
|
||||
sysVersion = "Mac OSX 10.3";
|
||||
break;
|
||||
case QSysInfo::MV_10_4:
|
||||
sysVersion = "Mac OSX 10.4";
|
||||
break;
|
||||
case QSysInfo::MV_10_5:
|
||||
sysVersion = "Mac OSX 10.5";
|
||||
break;
|
||||
case QSysInfo::MV_10_6:
|
||||
sysVersion = "Mac OSX 10.6";
|
||||
break;
|
||||
// case QSysInfo::MV_10_7:
|
||||
// sysVersion = "Mac OSX 10.7";
|
||||
// break;
|
||||
default:
|
||||
sysVersion = "Mac Unknown";
|
||||
break;
|
||||
}
|
||||
#else
|
||||
sysVersion = "OSX Unknown";
|
||||
#endif
|
||||
#else
|
||||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
// Windows
|
||||
#ifdef Q_OS_WIN
|
||||
switch(QSysInfo::windowsVersion())
|
||||
{
|
||||
case QSysInfo::WV_32s:
|
||||
sysVersion = "Windows 2.1";
|
||||
break;
|
||||
case QSysInfo::WV_95:
|
||||
sysVersion = "Windows 95";
|
||||
break;
|
||||
case QSysInfo::WV_98:
|
||||
sysVersion = "Windows 98";
|
||||
break;
|
||||
case QSysInfo::WV_Me:
|
||||
sysVersion = "Windows Me";
|
||||
break;
|
||||
case QSysInfo::WV_NT:
|
||||
sysVersion = "Windows NT";
|
||||
break;
|
||||
case QSysInfo::WV_2000:
|
||||
sysVersion = "Windows 2000";
|
||||
break;
|
||||
case QSysInfo::WV_XP:
|
||||
sysVersion = "Windows XP";
|
||||
break;
|
||||
case QSysInfo::WV_2003:
|
||||
sysVersion = "Windows 2003";
|
||||
break;
|
||||
case QSysInfo::WV_VISTA:
|
||||
sysVersion = "Windows Vista";
|
||||
break;
|
||||
case QSysInfo::WV_WINDOWS7:
|
||||
sysVersion = "Windows 7";
|
||||
break;
|
||||
default:
|
||||
sysVersion = "Windows";
|
||||
break;
|
||||
}
|
||||
#else
|
||||
sysVersion = "Windows Unknown";
|
||||
#endif
|
||||
#else
|
||||
// Linux
|
||||
sysVersion = "Linux";
|
||||
#endif
|
||||
#endif
|
||||
text += QString("My RetroShare Configuration is: (%1, %2, %3)").arg(RsApplication::retroshareVersion(true)
|
||||
, sysVersion
|
||||
).arg(static_cast<typename std::underlying_type<RsConfigUserLvl>::type>(userLevel)) + "\n";
|
||||
|
|
|
|||
|
|
@ -352,7 +352,11 @@ void HomePage::saveCert()
|
|||
//Todo: move save to file to p3Peers::SaveCertificateToFile
|
||||
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
ts << ui->retroshareid->text();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
|
|
@ -148,7 +149,7 @@ void IdDetailsDialog::loadIdentity(RsGxsIdGroup data)
|
|||
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
|
||||
ui->banoption_label->setVisible(!data.mPgpId.isNull()) ;
|
||||
|
||||
ui->lineEdit_Created->setText(QDateTime::fromMSecsSinceEpoch(qint64(1000)*data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate));
|
||||
ui->lineEdit_Created->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "util/RsQtVersion.h"
|
||||
#include "util/rstime.h"
|
||||
#include "util/rsdebug.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsmsgs.h"
|
||||
|
|
@ -230,7 +231,7 @@ IdDialog::IdDialog(QWidget *parent)
|
|||
mProxyModel->setSortRole(RsIdentityListModel::SortRole);
|
||||
mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
mProxyModel->setFilterRole(RsIdentityListModel::FilterRole);
|
||||
mProxyModel->setFilterRegExp(QRegExp(RsIdentityListModel::FilterString));
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, RsIdentityListModel::FilterString);
|
||||
|
||||
ui->idTreeWidget->setModel(mProxyModel);
|
||||
//ui->idTreeWidget->setSelectionModel(new QItemSelectionModel(mProxyModel));// useless in Qt5.
|
||||
|
|
@ -393,7 +394,7 @@ IdDialog::IdDialog(QWidget *parent)
|
|||
|
||||
/* Set initial section sizes */
|
||||
QHeaderView * circlesheader = ui->treeWidget_membership->header () ;
|
||||
circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, fm.width("Circle name")*1.5) ;
|
||||
circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QFontMetrics_horizontalAdvance(fm, "Circle name")*1.5) ;
|
||||
ui->treeWidget_membership->setColumnWidth(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 270);
|
||||
|
||||
/* Setup tree */
|
||||
|
|
@ -1653,7 +1654,7 @@ void IdDialog::loadIdentity(RsGxsIdGroup data)
|
|||
/* get GPG Details from rsPeers */
|
||||
RsPgpId ownPgpId = rsPeers->getGPGOwnId();
|
||||
|
||||
ui->lineEdit_PublishTS->setText(QDateTime::fromMSecsSinceEpoch(qint64(1000)*data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate));
|
||||
ui->lineEdit_PublishTS->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
|
||||
//ui->lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
|
||||
ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString()));
|
||||
//ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString()));
|
||||
|
|
@ -2719,7 +2720,7 @@ void IdDialog::recursSaveExpandedItems_idTreeView(const QModelIndex& proxy_index
|
|||
expanded.insert(local_path) ;
|
||||
|
||||
for(int row=0;row<mProxyModel->rowCount(proxy_index);++row)
|
||||
recursSaveExpandedItems_idTreeView(proxy_index.child(row,0),local_path,expanded,selected) ;
|
||||
recursSaveExpandedItems_idTreeView(mProxyModel->index(row,0,proxy_index),local_path,expanded,selected) ;
|
||||
}
|
||||
|
||||
if(ui->idTreeWidget->selectionModel()->isSelected(proxy_index))
|
||||
|
|
@ -2751,7 +2752,7 @@ void IdDialog::recursRestoreExpandedItems_idTreeView(const QModelIndex& proxy_in
|
|||
ui->idTreeWidget->setExpanded(proxy_index,true) ;
|
||||
|
||||
for(int row=0;row<mProxyModel->rowCount(proxy_index);++row)
|
||||
recursRestoreExpandedItems_idTreeView(proxy_index.child(row,0),local_path,expanded,selected) ;
|
||||
recursRestoreExpandedItems_idTreeView(mProxyModel->index(row,0,proxy_index),local_path,expanded,selected) ;
|
||||
}
|
||||
|
||||
if(selected.find(local_path) != selected.end())
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "retroshare/rspeers.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/imageutil.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -700,7 +701,7 @@ void IdEditDialog::removeAvatar()
|
|||
|
||||
void IdEditDialog::updateInterface()
|
||||
{
|
||||
QPixmap pixmap = ui->avatarLabel->pixmap(Qt::ReturnByValue);
|
||||
QPixmap pixmap = QLabel_pixmap(ui->avatarLabel);
|
||||
if (!pixmap.isNull()) {
|
||||
ui->removeButton->setEnabled(true);
|
||||
} else if (mEditGroup.mImage.mSize > 0) {
|
||||
|
|
|
|||
|
|
@ -939,7 +939,9 @@ void MainWindow::postModDirectories(bool /*update_local*/)
|
|||
{
|
||||
//RSettingsPage::postModDirectories(update_local);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
|
||||
QCoreApplication::flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pgpid_item_proxy::pgpid_item_proxy(QObject *parent) :
|
|||
void pgpid_item_proxy::use_only_trusted_keys(bool val)
|
||||
{
|
||||
only_trusted_keys = val;
|
||||
filterChanged();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
bool pgpid_item_proxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "util/HandleRichText.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "ui_BoardPostDisplayWidget_compact.h"
|
||||
#include "ui_BoardPostDisplayWidget_card.h"
|
||||
|
|
@ -194,16 +195,14 @@ void BoardPostDisplayWidgetBase::baseSetup()
|
|||
voteDownButton()->setDisabled(true);
|
||||
fromLabel()->setId(mPost.mMeta.mAuthorId);
|
||||
titleLabel()->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
dateLabel()->setText(timestamp);
|
||||
pictureLabel()->setDisabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago");
|
||||
dateLabel()->setText(timestamp);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "ui_PostedCardView.h"
|
||||
|
||||
|
|
@ -186,8 +187,7 @@ void PostedCardView::fill()
|
|||
ui->picture_frame->hide();
|
||||
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
|
||||
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
ui->dateLabel->setText(timestamp);
|
||||
} else {
|
||||
|
|
@ -198,8 +198,7 @@ void PostedCardView::fill()
|
|||
//int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
|
||||
//int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
|
||||
ui->dateLabel->setText(timestamp2);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "PhotoView.h"
|
||||
#include "gui/Posted/PostedDialog.h"
|
||||
#include "ui_PostedItem.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
|
|
@ -498,8 +499,7 @@ void PostedItem::fill()
|
|||
ui->thumbnailLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
|
||||
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
|
||||
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
ui->dateLabel->setText(timestamp);
|
||||
} else {
|
||||
|
|
@ -514,8 +514,7 @@ void PostedItem::fill()
|
|||
|
||||
ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mPost.mMeta.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
|
||||
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
|
||||
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
|
||||
ui->dateLabel->setText(timestamp2);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
|
|||
// This part of the code is copied from DLListDelegate.cpp
|
||||
//
|
||||
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
QVariant value = index.data(Qt::TextColorRole);
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
|
||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
||||
option.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||
|
|
@ -75,7 +75,7 @@ class RSHumanReadableDelegate: public QAbstractItemDelegate
|
|||
}
|
||||
else
|
||||
{
|
||||
value = index.data(Qt::BackgroundColorRole);
|
||||
value = index.data(Qt::BackgroundRole);
|
||||
|
||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid())
|
||||
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||
if (role == RetroshareDirModel::FileNameRole) /* end of FileNameRole */
|
||||
return QString::fromUtf8(details.name.c_str()) ;
|
||||
|
||||
if (role == Qt::TextColorRole)
|
||||
if (role == Qt::ForegroundRole)
|
||||
{
|
||||
if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull())
|
||||
return QVariant(QColor(Qt::green)) ;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void ShareManager::load()
|
|||
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
|
||||
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackground(QColor(183,236,181)) ;
|
||||
|
||||
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,22 @@
|
|||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QSound>
|
||||
#include <QDir>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QAudioDevice>
|
||||
#include <QMediaDevices>
|
||||
#include <QUrl>
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
#include <QAudioDeviceInfo>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QSound>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
#include <QAudio>
|
||||
#include <QAudioDeviceInfo>
|
||||
#endif
|
||||
|
||||
// #ifdef QMEDIAPLAYER
|
||||
|
|
@ -241,15 +251,25 @@ void SoundManager::playFile(const QString &filename)
|
|||
|
||||
QString playFilename = realFilename(filename);
|
||||
bool played = false ;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
if (!QMediaDevices::audioOutputs().isEmpty())
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
|
||||
if (!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty())
|
||||
#else
|
||||
if (QSound::isAvailable())
|
||||
#endif
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
if (soundManager) {
|
||||
soundManager->mSoundEffect.setSource(QUrl::fromLocalFile(playFilename));
|
||||
soundManager->mSoundEffect.play();
|
||||
played = true;
|
||||
}
|
||||
#else
|
||||
QSound::play(playFilename);
|
||||
played = true ;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(!played) // let's go for the hard core stuff
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@
|
|||
#include <QObject>
|
||||
#include <QMap>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QSoundEffect>
|
||||
#endif
|
||||
|
||||
#define SOUND_NEW_CHAT_MESSAGE "NewChatMessage"
|
||||
#define SOUND_USER_ONLINE "User_go_Online"
|
||||
#define SOUND_MESSAGE_ARRIVED "MessageArrived"
|
||||
|
|
@ -91,6 +95,10 @@ public:
|
|||
|
||||
private:
|
||||
SoundManager();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
QSoundEffect mSoundEffect;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern SoundManager *soundManager;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gui/WikiPoos/WikiEditDialog.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -727,10 +728,9 @@ void WikiEditDialog::loadBaseHistory(const uint32_t &token)
|
|||
|
||||
{
|
||||
// From Forum stuff.
|
||||
QDateTime qtime;
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(page.mMeta.mPublishTs);
|
||||
QString text;
|
||||
QString sort;
|
||||
qtime.setTime_t(page.mMeta.mPublishTs);
|
||||
sort = qtime.toString("yyyyMMdd_hhmmss");
|
||||
text = qtime.toString("dd/MM/yy hh:mm");
|
||||
|
||||
|
|
@ -841,10 +841,9 @@ void WikiEditDialog::loadEditTreeData(const uint32_t &token)
|
|||
|
||||
{
|
||||
// From Forum stuff.
|
||||
QDateTime qtime;
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(snapshot.mMeta.mPublishTs);
|
||||
QString text;
|
||||
QString sort;
|
||||
qtime.setTime_t(snapshot.mMeta.mPublishTs);
|
||||
sort = qtime.toString("yyyyMMdd_hhmmss");
|
||||
text = qtime.toString("dd/MM/yy hh:mm");
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@
|
|||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "guiexprelement.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#define STR_FIELDS_MIN_WFACTOR 20.0
|
||||
#define SIZE_FIELDS_MIN_WFACTOR 8.0
|
||||
#define DATE_FIELDS_MIN_WFACTOR 10.0
|
||||
|
|
@ -398,10 +402,10 @@ void ExprParamElement::adjustForSearchType(ExprSearchType type)
|
|||
{
|
||||
// record which search type is active
|
||||
searchType = type;
|
||||
QRegExp regExp("0|[1-9][0-9]*");
|
||||
numValidator = new QRegExpValidator(regExp, this);
|
||||
QRegExp hexRegExp("[A-Fa-f0-9]*");
|
||||
hexValidator = new QRegExpValidator(hexRegExp, this);
|
||||
QRegularExpression regExp("0|[1-9][0-9]*");
|
||||
numValidator = new QRegularExpressionValidator(regExp, this);
|
||||
QRegularExpression hexRegExp("[A-Fa-f0-9]*");
|
||||
hexValidator = new QRegularExpressionValidator(hexRegExp, this);
|
||||
|
||||
QHBoxLayout* hbox = static_cast<QHBoxLayout*>(layout());
|
||||
clearLayout(hbox);
|
||||
|
|
@ -607,7 +611,7 @@ uint64_t ExprParamElement::getIntValueFromField(QString fieldName, bool isToFiel
|
|||
#else
|
||||
QDateTime time = dateEdit->date().startOfDay();
|
||||
#endif
|
||||
val = (uint64_t)time.toTime_t();
|
||||
val = (uint64_t) DateTime::DateTimeToTime_t(time);
|
||||
break;
|
||||
}
|
||||
case SizeSearch:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
class QRegularExpressionValidator;
|
||||
|
||||
enum ExprSearchType
|
||||
{
|
||||
NameSearch,
|
||||
|
|
@ -191,8 +193,8 @@ public:
|
|||
virtual QString toString();
|
||||
|
||||
private:
|
||||
QRegExpValidator * numValidator;
|
||||
QRegExpValidator * hexValidator;
|
||||
QRegularExpressionValidator * numValidator;
|
||||
QRegularExpressionValidator * hexValidator;
|
||||
QFrame * rangeParamsFrame;
|
||||
bool inRangedConfig;
|
||||
uint64_t getIntValueFromField(QString fieldName, bool isToField=false,bool *ok = NULL);
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ void ChatLobbyUserNotify::iconClicked()
|
|||
QString strName=tr("Remove All");
|
||||
QAction *pAction = new QAction( QIcon(), strName, trayMenu);
|
||||
ActionTag actionTag={0x0, "", true};
|
||||
pAction->setData(qVariantFromValue(actionTag));
|
||||
pAction->setData(QVariant::fromValue(actionTag));
|
||||
trayMenu->addAction(pAction);
|
||||
|
||||
trayMenu->exec(QCursor::pos());
|
||||
|
|
@ -268,14 +268,14 @@ void ChatLobbyUserNotify::makeSubMenu(QMenu* parentMenu, QIcon icoLobby, QString
|
|||
QAction *pAction = new QAction( icoLobby, strName, lobbyMenu);
|
||||
pAction->setToolTip(doc.toPlainText());
|
||||
ActionTag actionTag={itCL->first, itMsg->first, false};
|
||||
pAction->setData(qVariantFromValue(actionTag));
|
||||
pAction->setData(QVariant::fromValue(actionTag));
|
||||
lobbyMenu->addAction(pAction);
|
||||
}
|
||||
|
||||
QString strName=tr("Remove All");
|
||||
QAction *pAction = new QAction( icoLobby, strName, lobbyMenu);
|
||||
ActionTag actionTag={itCL->first, "", true};
|
||||
pAction->setData(qVariantFromValue(actionTag));
|
||||
pAction->setData(QVariant::fromValue(actionTag));
|
||||
lobbyMenu->addAction(pAction);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
#include <QXmlStreamReader>
|
||||
#include <QDomDocument>
|
||||
#include <QTextStream>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "ChatStyle.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
|
@ -376,7 +377,7 @@ QString ChatStyle::formatMessage(enumFormatMessage type
|
|||
QString strDate = DateTime::formatDate(timestamp.date()).prepend(QString("<a name=\"date\">")).append(QString("</a>"));
|
||||
QString strTime = DateTime::formatTime(timestamp.time()).prepend(QString("<a name=\"time\">")).append(QString("</a>"));
|
||||
|
||||
int bi = name.lastIndexOf(QRegExp(" \\(.*\\)")); //trim location from the end
|
||||
int bi = name.lastIndexOf(QRegularExpression(" \\(.*\\)")); //trim location from the end
|
||||
QString strShortName = RsHtml::plainText(name.left(bi)).prepend(QString("<a name=\"name\">")).append(QString("</a>"));
|
||||
|
||||
//handle /me
|
||||
|
|
@ -384,9 +385,9 @@ QString ChatStyle::formatMessage(enumFormatMessage type
|
|||
//meName class for modifying the style of the name in the palce of /me
|
||||
if(me){
|
||||
messageBody = messageBody.replace(messageBody.indexOf("/me "), 3, strShortName.prepend(QString("<span class=\"meName\">")).append(QString("</span>"))); //replace only the first /me
|
||||
style = style.remove(QRegExp("%nome%.*%/nome%")).remove("%me%").remove("%/me%");
|
||||
style = style.remove(QRegularExpression("%nome%.*%/nome%")).remove("%me%").remove("%/me%");
|
||||
} else {
|
||||
style = style.remove(QRegExp("%me%.*%/me%")).remove("%nome%").remove("%/nome%");
|
||||
style = style.remove(QRegularExpression("%me%.*%/me%")).remove("%nome%").remove("%/nome%");
|
||||
}
|
||||
|
||||
QString formatMsg = style.replace("%name%", strName)
|
||||
|
|
@ -425,8 +426,8 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle
|
|||
while (reader.atEnd() == false) {
|
||||
reader.readNext();
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == "RetroShare_Style") {
|
||||
if (reader.attributes().value("version") == "1.0") {
|
||||
if (reader.name() == QString("RetroShare_Style")) {
|
||||
if (reader.attributes().value("version") == QString("1.0")) {
|
||||
info.stylePath = stylePathRelative;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -438,22 +439,22 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle
|
|||
continue;
|
||||
}
|
||||
|
||||
if (reader.name() == "style") {
|
||||
if (reader.name() == QString("style")) {
|
||||
// read style information
|
||||
while (reader.atEnd() == false) {
|
||||
reader.readNext();
|
||||
if (reader.isEndElement()) {
|
||||
if (reader.name() == "style") {
|
||||
if (reader.name() == QString("style")) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == "name") {
|
||||
if (reader.name() == QString("name")) {
|
||||
info.styleName = reader.readElementText();
|
||||
continue;
|
||||
}
|
||||
if (reader.name() == "description") {
|
||||
if (reader.name() == QString("description")) {
|
||||
info.styleDescription = reader.readElementText();
|
||||
continue;
|
||||
}
|
||||
|
|
@ -463,22 +464,22 @@ static bool getStyleInfo(QString stylePath, QString stylePathRelative, ChatStyle
|
|||
continue;
|
||||
}
|
||||
|
||||
if (reader.name() == "author") {
|
||||
if (reader.name() == QString("author")) {
|
||||
// read author information
|
||||
while (reader.atEnd() == false) {
|
||||
reader.readNext();
|
||||
if (reader.isEndElement()) {
|
||||
if (reader.name() == "author") {
|
||||
if (reader.name() == QString("author")) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == "name") {
|
||||
if (reader.name() == QString("name")) {
|
||||
info.authorName = reader.readElementText();
|
||||
continue;
|
||||
}
|
||||
if (reader.name() == "email") {
|
||||
if (reader.name() == QString("email")) {
|
||||
info.authorEmail = reader.readElementText();
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
#include <QTimer>
|
||||
#include <QToolTip>
|
||||
#include <QInputDialog>
|
||||
#include <QRegExp>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
|
@ -1507,10 +1508,9 @@ void ChatWidget::on_markButton_clicked(bool bValue)
|
|||
|
||||
void ChatWidget::chooseColor()
|
||||
{
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(currentColor.rgba(), &ok, window());
|
||||
if (ok) {
|
||||
currentColor = QColor(color);
|
||||
QColor color = QColorDialog::getColor(currentColor, window(), "", QColorDialog::ShowAlphaChannel);
|
||||
if (color.isValid()) {
|
||||
currentColor = color;
|
||||
PeerSettings->setPrivateChatColor(chatId, currentColor.name());
|
||||
colorChanged();
|
||||
setColorAndFont(false);
|
||||
|
|
@ -1763,7 +1763,11 @@ bool ChatWidget::fileSave()
|
|||
if (!file.open(QFile::WriteOnly))
|
||||
return false;
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
ts << ui->textBrowser->document()->toPlainText();
|
||||
ui->textBrowser->document()->setModified(false);
|
||||
return true;
|
||||
|
|
@ -1930,7 +1934,7 @@ void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QStr
|
|||
|
||||
void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent)
|
||||
{
|
||||
ui->typingLabel->setText(QString(statusMask).arg(trUtf8(statusString.toUtf8()))); // displays info for 5 secs.
|
||||
ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toUtf8()))); // displays info for 5 secs.
|
||||
ui->typingPixmapLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":icons/png/typing.png") );
|
||||
|
||||
if (statusString == "is typing...") {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
#include <QPixmap>
|
||||
#include <QCloseEvent>
|
||||
#include <QMenu>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "PopupChatWindow.h"
|
||||
|
|
@ -205,7 +208,14 @@ void PopupChatWindow::showEvent(QShowEvent */*event*/)
|
|||
if (tabbedWindow) {
|
||||
Settings->loadWidgetInformation(this);
|
||||
} else {
|
||||
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int x = QRandomGenerator::global()->generate();
|
||||
int y = QRandomGenerator::global()->generate();
|
||||
#else
|
||||
int x = qrand();
|
||||
int y = qrand();
|
||||
#endif
|
||||
this->move(x % 100, y % 100); //avoid to stack multiple popup chat windows on the same position
|
||||
PeerSettings->loadWidgetInformation(chatId, this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/imageutil.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#define ICONNAME "groupicon.png"
|
||||
|
|
@ -107,7 +108,7 @@ void AvatarDialog::removeAvatar()
|
|||
|
||||
void AvatarDialog::updateInterface()
|
||||
{
|
||||
QPixmap pixmap = ui->avatarLabel->pixmap(Qt::ReturnByValue);
|
||||
QPixmap pixmap = QLabel_pixmap(ui->avatarLabel);
|
||||
if (!pixmap.isNull()) {
|
||||
ui->removeButton->setEnabled(true);
|
||||
} else {
|
||||
|
|
@ -123,7 +124,7 @@ void AvatarDialog::setAvatar(const QPixmap &avatar)
|
|||
|
||||
void AvatarDialog::getAvatar(QPixmap &avatar)
|
||||
{
|
||||
avatar = ui->avatarLabel->pixmap(Qt::ReturnByValue);
|
||||
avatar = QLabel_pixmap(ui->avatarLabel);
|
||||
}
|
||||
|
||||
void AvatarDialog::getAvatar(QByteArray &avatar)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <QtGui>
|
||||
#include <QScrollBar>
|
||||
#include <QDebug>
|
||||
#include <QMargins>
|
||||
|
||||
//*** FlowLayoutItem **********************************************************
|
||||
|
||||
|
|
@ -598,7 +599,8 @@ QSize FlowLayout::minimumSize() const
|
|||
foreach (item, m_itemList)
|
||||
size = size.expandedTo(item->minimumSize());
|
||||
|
||||
size += QSize(2*margin(), 2*margin());
|
||||
QMargins margins = contentsMargins();
|
||||
size += QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
@ -645,7 +647,7 @@ void FlowLayout::performDrag()
|
|||
if (curs==0) dragPixmap = itemPixmap;
|
||||
QPixmap oldPixmap = dragPixmap;
|
||||
if (curs!=0) dragPixmap = QPixmap(oldPixmap.width() + 20 , oldPixmap.height());
|
||||
dragPixmap.fill(widget->palette().background().color());
|
||||
dragPixmap.fill(widget->palette().window().color());
|
||||
QPainter painter(&dragPixmap);
|
||||
painter.drawPixmap(0, 0, oldPixmap);
|
||||
if (curs!=0) painter.drawPixmap((20 * curs), 0, itemPixmap);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public:
|
|||
void paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
opt.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ QVariant RsFriendListModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::SizeHintRole: return sizeHintRole(entry,index.column()) ;
|
||||
case Qt::DisplayRole: return displayRole(entry,index.column()) ;
|
||||
case Qt::FontRole: return fontRole(entry,index.column()) ;
|
||||
case Qt::TextColorRole: return textColorRole(entry,index.column()) ;
|
||||
case Qt::ForegroundRole: return textColorRole(entry,index.column()) ;
|
||||
case Qt::DecorationRole: return decorationRole(entry,index.column()) ;
|
||||
|
||||
case FilterRole: return filterRole(entry,index.column()) ;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void GroupSelectionBox::fillGroups()
|
|||
for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
|
||||
QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
|
||||
item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
|
||||
item->setBackgroundColor(QColor(183,236,181));
|
||||
item->setBackground(QColor(183,236,181));
|
||||
addItem(item);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
|
|||
else
|
||||
{
|
||||
item->setText(GTW_COLUMN_LAST_POST, itemInfo.lastpost.toString(Qt::ISODate).replace("T"," "));
|
||||
item->setData(GTW_COLUMN_LAST_POST, ROLE_SORT, itemInfo.lastpost.toTime_t());
|
||||
item->setData(GTW_COLUMN_LAST_POST, ROLE_SORT, (qint64) DateTime::DateTimeToTime_t(itemInfo.lastpost));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void HashBox::addAttachments(const QStringList& files,TransferRequestFlags tfl,
|
|||
hashingInfo.item = file;
|
||||
hashingInfo.flag = flag;
|
||||
mHashingInfos.push_back(hashingInfo);
|
||||
ui->verticalLayout->addWidget(file, 1, 0);
|
||||
ui->verticalLayout->addWidget(file, 1);
|
||||
}
|
||||
QApplication::processEvents();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "LineEditClear.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QStyle>
|
||||
|
|
@ -237,7 +238,7 @@ void LineEditClear::setFilterButtonIcon(const QIcon &icon)
|
|||
ensurePolished();
|
||||
#if !defined(Q_OS_DARWIN)
|
||||
QFontMetrics fm(this->font());
|
||||
QSize size(fm.width("___"), fm.height());
|
||||
QSize size(QFontMetrics_horizontalAdvance(fm, "___"), fm.height());
|
||||
mFilterButton->setFixedSize(size);
|
||||
mFilterButton->setIconSize(size);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
|||
mProxyModel->setSortRole(RsFriendListModel::SortRole);
|
||||
mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
mProxyModel->setFilterRole(RsFriendListModel::FilterRole);
|
||||
mProxyModel->setFilterRegExp(QRegExp(RsFriendListModel::FilterString));
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, RsFriendListModel::FilterString);
|
||||
|
||||
ui->peerTreeWidget->setModel(mProxyModel);
|
||||
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
|
||||
|
|
@ -448,7 +448,7 @@ void NewFriendList::recursSaveExpandedItems(const QModelIndex& index,const QMode
|
|||
exp.insert(local_path) ;
|
||||
|
||||
for(int row=0;row<mProxyModel->rowCount(index);++row)
|
||||
recursSaveExpandedItems(index.child(row,0),current_index,local_path,exp,sel,indx+1) ;
|
||||
recursSaveExpandedItems(mProxyModel->index(row,0,index),current_index,local_path,exp,sel,indx+1) ;
|
||||
}
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
else
|
||||
|
|
@ -479,7 +479,7 @@ void NewFriendList::recursRestoreExpandedItems(const QModelIndex& index, const Q
|
|||
ui->peerTreeWidget->setExpanded(index,true) ;
|
||||
|
||||
for(int row=0;row<mProxyModel->rowCount(index);++row)
|
||||
recursRestoreExpandedItems(index.child(row,0),local_path,exp,sel,selected_index,indx+1) ;
|
||||
recursRestoreExpandedItems(mProxyModel->index(row,0,index),local_path,exp,sel,selected_index,indx+1) ;
|
||||
}
|
||||
#ifdef DEBUG_NEW_FRIEND_LIST
|
||||
else
|
||||
|
|
@ -558,7 +558,7 @@ void NewFriendList::processSettings(bool load)
|
|||
void NewFriendList::toggleSortByState(bool sort)
|
||||
{
|
||||
mProxyModel->setSortByState(sort);
|
||||
mProxyModel->setFilterRegExp(QRegExp(QString(RsFriendListModel::FilterString))) ;// triggers a re-display.
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, QString(RsFriendListModel::FilterString)) ;// triggers a re-display.
|
||||
processSettings(false);
|
||||
}
|
||||
|
||||
|
|
@ -1419,7 +1419,11 @@ bool NewFriendList::exportFriendlist(QString &fileName)
|
|||
root.appendChild(groups);
|
||||
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
ts.setCodec("UTF-8");
|
||||
#endif
|
||||
ts << doc.toString();
|
||||
file.close();
|
||||
|
||||
|
|
@ -1468,7 +1472,7 @@ bool NewFriendList::importFriendlist(QString &fileName, bool &errorPeers, bool &
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ok = doc.setContent(&file);
|
||||
bool ok = (bool) doc.setContent(&file);
|
||||
file.close();
|
||||
|
||||
if(!ok) {
|
||||
|
|
@ -1623,7 +1627,7 @@ bool NewFriendList::getOrCreateGroup(const std::string& name, uint flag, RsNodeG
|
|||
void NewFriendList::setShowUnconnected(bool show)
|
||||
{
|
||||
mProxyModel->setShowOfflineNodes(show);
|
||||
mProxyModel->setFilterRegExp(QRegExp(QString(RsFriendListModel::FilterString))) ;// triggers a re-display.
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, QString(RsFriendListModel::FilterString)) ;// triggers a re-display.
|
||||
}
|
||||
|
||||
bool NewFriendList::isColumnVisible(int col) const
|
||||
|
|
@ -1682,7 +1686,7 @@ void NewFriendList::filterItems(const QString &text)
|
|||
mModel->setFilter(RsFriendListModel::FILTER_TYPE_ID,lst);
|
||||
|
||||
// We do this in order to trigger a new filtering action in the proxy model.
|
||||
mProxyModel->setFilterRegExp(QRegExp(QString(RsFriendListModel::FilterString))) ;
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, QString(RsFriendListModel::FilterString)) ;
|
||||
|
||||
if(!lst.empty())
|
||||
ui->peerTreeWidget->expandAll();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||
#include "rshare.h"
|
||||
#include "RSGraphWidget.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#if QT_VERSION < 0x040700
|
||||
#include <sys/time.h>
|
||||
|
|
@ -655,12 +656,12 @@ void RSGraphWidget::paintScale1()
|
|||
|
||||
if (_flags & RSGRAPH_FLAGS_DARK_STYLE){
|
||||
_painter->setPen(SCALE_COLOR_DARK);
|
||||
_painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text);
|
||||
_painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetrics_horizontalAdvance(QFontMetricsF(font()), text) - 4*fact, pos+0.4*FS), text);
|
||||
_painter->setPen(GRID_COLOR_DARK);
|
||||
_painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos));
|
||||
}else{
|
||||
_painter->setPen(SCALE_COLOR);
|
||||
_painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text);
|
||||
_painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetrics_horizontalAdvance(QFontMetricsF(font()), text) - 4*fact, pos+0.4*FS), text);
|
||||
_painter->setPen(GRID_COLOR);
|
||||
_painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos));
|
||||
}
|
||||
|
|
@ -696,18 +697,24 @@ void RSGraphWidget::paintScale2()
|
|||
|
||||
void RSGraphWidget::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int delta = e->angleDelta().y();
|
||||
#else
|
||||
int delta = e->delta();
|
||||
#endif
|
||||
|
||||
if(e->modifiers() & Qt::ShiftModifier)
|
||||
if(e->delta() > 0)
|
||||
if(delta > 0)
|
||||
_time_filter *= 1.1 ;
|
||||
else
|
||||
_time_filter /= 1.1 ;
|
||||
else if(e->modifiers() & Qt::ControlModifier)
|
||||
if(e->delta() > 0)
|
||||
if(delta > 0)
|
||||
_linewidthscale *= 1.2 ;
|
||||
else
|
||||
_linewidthscale /= 1.2 ;
|
||||
else
|
||||
if(e->delta() > 0)
|
||||
if(delta > 0)
|
||||
_time_scale *= 1.1 ;
|
||||
else
|
||||
_time_scale /= 1.1 ;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <QPlainTextEdit>
|
||||
#include <QTextDocumentFragment>
|
||||
#include <QScrollBar>
|
||||
#include <QRegExp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -284,10 +285,10 @@ void RSTextBrowser::contextMenuEvent(QContextMenuEvent *event)
|
|||
|
||||
QMenu *RSTextBrowser::createStandardContextMenuFromPoint(const QPoint &widgetPos)
|
||||
{
|
||||
QMatrix matrix;
|
||||
matrix.translate(horizontalScrollBar()->value(), verticalScrollBar()->value());
|
||||
QTransform transform;
|
||||
transform.translate(horizontalScrollBar()->value(), verticalScrollBar()->value());
|
||||
|
||||
QMenu *menu = QTextBrowser::createStandardContextMenu(matrix.map(widgetPos));
|
||||
QMenu *menu = QTextBrowser::createStandardContextMenu(transform.map(widgetPos));
|
||||
|
||||
menu->addSeparator();
|
||||
QAction *a = menu->addAction(FilesDefs::getIconFromQtResourcePath("://icons/textedit/code.png"), tr("View &Source"), this, SLOT(viewSource()));
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ RsCollection::RsCollection(const QString& fileName, RsCollectionErrorCode& error
|
|||
}
|
||||
|
||||
QDomDocument xml_doc;
|
||||
bool ok = xml_doc.setContent(&file) ;
|
||||
bool ok = (bool) xml_doc.setContent(&file);
|
||||
|
||||
if(!ok)
|
||||
{
|
||||
|
|
@ -311,7 +311,11 @@ bool RsCollection::save(const QString& fileName) const
|
|||
xml_doc.appendChild(root);
|
||||
|
||||
QTextStream stream(&file) ;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
stream.setCodec("UTF-8") ;
|
||||
#endif
|
||||
|
||||
stream << xml_doc.toString() ;
|
||||
file.close();
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ QVariant RsCollectionModel::data(const QModelIndex& index, int role) const
|
|||
case Qt::DisplayRole: return displayRole(i,index.column());
|
||||
case Qt::DecorationRole: return decorationRole(i,index.column());
|
||||
case Qt::CheckStateRole: return checkStateRole(i,index.column());
|
||||
case Qt::TextColorRole: return textColorRole(i,index.column());
|
||||
case Qt::ForegroundRole: return textColorRole(i,index.column());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "edge.h"
|
||||
#include "elnode.h"
|
||||
#include "graphwidget.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#define IMAGE_AUTHED ":/images/accepted16.png"
|
||||
#define IMAGE_DENIED ":/images/denied16.png"
|
||||
|
|
@ -318,7 +319,7 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||
|
||||
if (!mDeterminedBB)
|
||||
{
|
||||
QRect textBox = painter->boundingRect(-10, 5*f, QFontMetricsF(graph->font()).width(txt), 1.5*m, Qt::AlignVCenter, QString::fromUtf8(_desc_string.c_str()));
|
||||
QRect textBox = painter->boundingRect(-10, 5*f, QFontMetrics_horizontalAdvance(QFontMetricsF(graph->font()), txt), 1.5*m, Qt::AlignVCenter, QString::fromUtf8(_desc_string.c_str()));
|
||||
mBBWidth = textBox.width()+40*f;
|
||||
mDeterminedBB = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@
|
|||
#include <QDebug>
|
||||
#include <QGraphicsScene>
|
||||
#include <QWheelEvent>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
@ -131,8 +134,16 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
|
|||
case Qt::Key_Space:
|
||||
case Qt::Key_Enter:
|
||||
foreach (QGraphicsItem *item, scene()->items()) {
|
||||
if (qgraphicsitem_cast<Node *>(item))
|
||||
item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
|
||||
if (qgraphicsitem_cast<Node *>(item)) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int x = QRandomGenerator::global()->generate();
|
||||
int y = QRandomGenerator::global()->generate();
|
||||
#else
|
||||
int x = qrand();
|
||||
int y = qrand();
|
||||
#endif
|
||||
item->setPos(-150 + x % 300, -150 + y % 300);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -331,12 +342,18 @@ void GraphWidget::resizeEvent(QResizeEvent *event)
|
|||
|
||||
void GraphWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
scaleView(pow((double)2, -event->delta() / 240.0));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int delta = event->angleDelta().y();
|
||||
#else
|
||||
int delta = event->delta();
|
||||
#endif
|
||||
|
||||
scaleView(pow((double)2, -delta / 240.0));
|
||||
}
|
||||
|
||||
void GraphWidget::scaleView(qreal scaleFactor)
|
||||
{
|
||||
qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
|
||||
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
|
||||
if (factor < 0.07 || factor > 100)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void SecurityIpItem::updateItemStatic()
|
|||
}
|
||||
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
ui->timeLabel->setText(DateTime::formatLongDateTime(currentTime.toTime_t()));
|
||||
ui->timeLabel->setText(DateTime::formatLongDateTime(currentTime));
|
||||
}
|
||||
|
||||
void SecurityIpItem::updateItem()
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void SecurityItem::updateItemStatic()
|
|||
titleLabel->setText(title);
|
||||
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
timeLabel->setText(DateTime::formatLongDateTime(currentTime.toTime_t()));
|
||||
timeLabel->setText(DateTime::formatLongDateTime(currentTime));
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "gui/gxs/GxsCreateCommentDialog.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
|
|
@ -798,8 +799,7 @@ void GxsCommentTreeWidget::insertComments(const std::vector<RsGxsComment>& comme
|
|||
QString text;
|
||||
|
||||
{
|
||||
QDateTime qtime ;
|
||||
qtime.setTime_t(comment.mMeta.mPublishTs) ;
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(comment.mMeta.mPublishTs) ;
|
||||
|
||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss") ;
|
||||
item->setText(PCITEM_COLUMN_DATE, text) ;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "gui/common/GroupTreeWidget.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
// class GxsChannelGroupInfoData : public RsUserdata
|
||||
// {
|
||||
|
|
|
|||
|
|
@ -283,7 +283,13 @@ void ZoomableLabel::wheelEvent(QWheelEvent *me)
|
|||
if(!mZoomEnabled)
|
||||
return;
|
||||
|
||||
float new_zoom_factor = (me->delta() > 0)?(mZoomFactor*1.05):(mZoomFactor/1.05);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int delta = me->angleDelta().y();
|
||||
#else
|
||||
int delta = me->delta();
|
||||
#endif
|
||||
|
||||
float new_zoom_factor = (delta > 0)?(mZoomFactor*1.05):(mZoomFactor/1.05);
|
||||
float new_center_x = mCenterX;
|
||||
float new_center_y = mCenterY;
|
||||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||
y += font_height;
|
||||
y += font_height/2.0;
|
||||
|
||||
QString info_text = QDateTime::fromMSecsSinceEpoch(qint64(1000)*post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate);
|
||||
QString info_text = QLocale::system().toString(DateTime::DateTimeFromTime_t(post.mMeta.mPublishTs), QLocale::ShortFormat);
|
||||
|
||||
if(post.mAttachmentCount > 0)
|
||||
info_text += ", " + QString::number(post.mAttachmentCount)+ " " +((post.mAttachmentCount>1)?tr("files"):tr("file")) + " (" + misc::friendlyUnit(qulonglong(post.mSize)) + ")" ;
|
||||
|
|
@ -355,9 +355,9 @@ QSize ChannelPostFilesDelegate::sizeHint(const QStyleOptionViewItem& option, con
|
|||
|
||||
switch(index.column())
|
||||
{
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_NAME: return QSize(1.1*fm.width(QString::fromUtf8(file.mName.c_str())),fm.height());
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE: return QSize(1.1*fm.width(misc::friendlyUnit(qulonglong(file.mSize))),fm.height());
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE: return QSize(1.1*fm.width(QDateTime::fromMSecsSinceEpoch(file.mPublishTime*1000).toString("MM/dd/yyyy, hh:mm")),fm.height());
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_NAME: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, QString::fromUtf8(file.mName.c_str())),fm.height());
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, misc::friendlyUnit(qulonglong(file.mSize))),fm.height());
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, QDateTime::fromMSecsSinceEpoch(file.mPublishTime*1000).toString("MM/dd/yyyy, hh:mm")),fm.height());
|
||||
default:
|
||||
case RsGxsChannelPostFilesModel::COLUMN_FILES_FILE: return QSize(option.rect.width(),GxsChannelFilesStatusWidget(file).height());
|
||||
}
|
||||
|
|
@ -463,8 +463,8 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
|||
QHeaderView * channelpostfilesheader = ui->channelPostFiles_TV->header () ;
|
||||
QHeaderView * channelfilesheader = ui->channelFiles_TV->header () ;
|
||||
|
||||
channelpostfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, fm.width("RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z"));
|
||||
channelfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, fm.width("RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z"));
|
||||
channelpostfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, QFontMetrics_horizontalAdvance(fm, "RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z"));
|
||||
channelfilesheader->resizeSection (RsGxsChannelPostFilesModel::COLUMN_FILES_NAME, QFontMetrics_horizontalAdvance(fm, "RetroShare-v0.6.5-1487-g6714648e5-Windows-x64-portable-20200518-Qt-5.14.2.7z"));
|
||||
|
||||
/* Initialize feed widget */
|
||||
//ui->feedWidget->setSortRole(ROLE_PUBLISH, Qt::DescendingOrder);
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
||||
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
||||
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
||||
case Qt::TextColorRole: return textColorRole (fmpe,index.column()) ;
|
||||
case Qt::ForegroundRole: return textColorRole (fmpe,index.column()) ;
|
||||
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
||||
|
||||
case FilterRole: return filterRole (fmpe,index.column()) ;
|
||||
|
|
@ -670,8 +670,7 @@ QVariant RsGxsForumModel::displayRole(const ForumModelPostEntry& fmpe,int col) c
|
|||
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING)
|
||||
return QVariant(QString());
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(fmpe.mPublishTs);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(fmpe.mPublishTs);
|
||||
|
||||
return QVariant(DateTime::formatDateTime(qtime));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,11 @@ public:
|
|||
if(left_is_not_pinned ^ right_is_not_pinned)
|
||||
return (m_header->sortIndicatorOrder()==Qt::AscendingOrder)?right_is_not_pinned:left_is_not_pinned ; // always put pinned posts on top
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
return QVariant::compare(left.data(RsGxsForumModel::SortRole), right.data(RsGxsForumModel::SortRole)) < 0;
|
||||
#else
|
||||
return left.data(RsGxsForumModel::SortRole) < right.data(RsGxsForumModel::SortRole) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
|
||||
|
|
@ -264,7 +268,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||
ui->threadTreeWidget->setModel(mThreadProxyModel);
|
||||
|
||||
mThreadProxyModel->setFilterRole(RsGxsForumModel::FilterRole);
|
||||
mThreadProxyModel->setFilterRegExp(QRegExp(QString(RsGxsForumModel::FilterString))) ;
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mThreadProxyModel, QString(RsGxsForumModel::FilterString)) ;
|
||||
|
||||
ui->threadTreeWidget->setSortingEnabled(true);
|
||||
|
||||
|
|
@ -540,7 +544,7 @@ void GxsForumThreadWidget::recursSaveExpandedItems(const QModelIndex& index, QLi
|
|||
if(ui->threadTreeWidget->isExpanded(index))
|
||||
{
|
||||
for(int row=0;row<mThreadProxyModel->rowCount(index);++row)
|
||||
recursSaveExpandedItems(index.child(row,0),expanded_items) ;
|
||||
recursSaveExpandedItems(mThreadProxyModel->index(row,0,index),expanded_items) ;
|
||||
|
||||
RsGxsMessageId message_id(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_MSGID).data(Qt::UserRole).toString().toStdString());
|
||||
expanded_items.push_back(message_id);
|
||||
|
|
@ -1854,7 +1858,7 @@ void GxsForumThreadWidget::filterItems(const QString& text)
|
|||
mThreadModel->setFilter(filterColumn,lst,count) ;
|
||||
|
||||
// We do this in order to trigger a new filtering action in the proxy model.
|
||||
mThreadProxyModel->setFilterRegExp(QRegExp(QString(RsGxsForumModel::FilterString))) ;
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mThreadProxyModel, QString(RsGxsForumModel::FilterString)) ;
|
||||
|
||||
if(!lst.empty())
|
||||
ui->threadTreeWidget->expandAll();
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ HelpBrowser::HelpBrowser(QWidget *parent)
|
|||
|
||||
/* Show the first help topic in the tree */
|
||||
ui.treeContents->setCurrentItem(ui.treeContents->topLevelItem(0));
|
||||
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
|
||||
ui.treeContents->topLevelItem(0)->setExpanded(true);
|
||||
}
|
||||
|
||||
HelpBrowser::~HelpBrowser()
|
||||
|
|
@ -231,7 +231,7 @@ HelpBrowser::contentsItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev
|
|||
QList<QTreeWidgetItem *> selected = ui.treeSearch->selectedItems();
|
||||
/* Deselect the selection in the search tree */
|
||||
if (!selected.isEmpty()) {
|
||||
ui.treeSearch->setItemSelected(selected[0], false);
|
||||
selected[0]->setSelected(false);
|
||||
}
|
||||
currentItemChanged(current, prev);
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ HelpBrowser::searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev)
|
|||
QList<QTreeWidgetItem *> selected = ui.treeContents->selectedItems();
|
||||
/* Deselect the selection in the contents tree */
|
||||
if (!selected.isEmpty()) {
|
||||
ui.treeContents->setItemSelected(selected[0], false);
|
||||
selected[0]->setSelected(false);
|
||||
}
|
||||
|
||||
/* Change to selected page */
|
||||
|
|
@ -288,7 +288,7 @@ HelpBrowser::findTopicItem(QTreeWidgetItem *startItem, QString topic)
|
|||
|
||||
if (subtopic == item->data(0, ROLE_TOPIC_ID).toString().toLower()) {
|
||||
/* Found a subtopic match, so expand this item */
|
||||
ui.treeContents->setItemExpanded(item, true);
|
||||
item->setSelected(true);
|
||||
if (!topic.contains(".")) {
|
||||
/* Found the exact topic */
|
||||
return item;
|
||||
|
|
@ -314,10 +314,10 @@ HelpBrowser::showTopic(QString topic)
|
|||
* tree item. */
|
||||
QTreeWidgetItem* selected = ui.treeContents->selectedItems()[0];
|
||||
if (selected) {
|
||||
ui.treeContents->setItemSelected(selected, false);
|
||||
selected->setSelected(false);
|
||||
}
|
||||
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
|
||||
ui.treeContents->setItemSelected(item, true);
|
||||
ui.treeContents->topLevelItem(0)->setExpanded(true);
|
||||
item->setSelected(true);
|
||||
currentItemChanged(item, selected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void IMHistoryItemPainter::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
// if (mode == Editable) {
|
||||
// painter->setBrush(option.palette.highlight());
|
||||
// } else {
|
||||
painter->setBrush(option.palette.foreground());
|
||||
painter->setBrush(option.palette.windowText());
|
||||
// }
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
painter->fillRect(option.rect, option.palette.highlight());
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ void ImHistoryBrowser::fillItem(QListWidgetItem *itemWidget, HistoryMsg& msg)
|
|||
QColor backgroundColor = ui.listWidget->palette().base().color();
|
||||
QString formatMsg = style.formatMessage(type, name, DateTime::DateTimeFromTime_t(msg.sendTime), messageText, 0, backgroundColor);
|
||||
|
||||
itemWidget->setData(Qt::DisplayRole, qVariantFromValue(IMHistoryItemPainter(formatMsg)));
|
||||
itemWidget->setData(Qt::DisplayRole, QVariant::fromValue(IMHistoryItemPainter(formatMsg)));
|
||||
itemWidget->setData(ROLE_MSGID, msg.msgId);
|
||||
|
||||
/* calculate plain text */
|
||||
|
|
|
|||
|
|
@ -2403,8 +2403,13 @@ bool MessageComposer::fileSave()
|
|||
if (!file.open(QFile::WriteOnly))
|
||||
return false;
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
ts << ui.msgText->document()->toHtml();
|
||||
#else
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
ts << ui.msgText->document()->toHtml("UTF-8");
|
||||
#endif
|
||||
std::cerr << "Setting modified 002 = false" << std::endl;
|
||||
ui.msgText->document()->setModified(false);
|
||||
return true;
|
||||
|
|
@ -2433,7 +2438,7 @@ void MessageComposer::filePrint()
|
|||
printer.setFullPage(true);
|
||||
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
||||
if (ui.msgText->textCursor().hasSelection())
|
||||
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
|
||||
dlg->setOption(QPrintDialog::PrintSelection);
|
||||
dlg->setWindowTitle(tr("Print Document"));
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
ui.msgText->print(&printer);
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::DecorationRole: return decorationRole(fmpe,index.column()) ;
|
||||
case Qt::ToolTipRole: return toolTipRole (fmpe,index.column()) ;
|
||||
case Qt::UserRole: return userRole (fmpe,index.column()) ;
|
||||
case Qt::TextColorRole: return textColorRole (fmpe,index.column()) ;
|
||||
case Qt::ForegroundRole: return textColorRole (fmpe,index.column()) ;
|
||||
case Qt::BackgroundRole: return backgroundRole(fmpe,index.column()) ;
|
||||
|
||||
case FilterRole: return filterRole (fmpe,index.column()) ;
|
||||
|
|
@ -504,8 +504,7 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
|||
case COLUMN_THREAD_SPAM:
|
||||
case COLUMN_THREAD_READ:return QVariant();
|
||||
case COLUMN_THREAD_DATE:{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(fmpe.ts);
|
||||
QDateTime qtime = DateTime::DateTimeFromTime_t(fmpe.ts);
|
||||
|
||||
return QVariant(DateTime::formatDateTime(qtime));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -640,7 +640,7 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
|
||||
ui.trans_ToText->setText(to_text);
|
||||
|
||||
int recipientsCount = ui.trans_ToText->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QtSkipEmptyParts).count();
|
||||
int recipientsCount = ui.trans_ToText->toPlainText().split(QRegularExpression("(\\s|\\n|\\r)+"), QtSkipEmptyParts).count();
|
||||
ui.expandButton->setText( QString::number(recipientsCount)+ " " + tr("more"));
|
||||
|
||||
if (recipientsCount >=20) {
|
||||
|
|
@ -775,7 +775,7 @@ void MessageWidget::print()
|
|||
printer.setFullPage(true);
|
||||
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
||||
if (ui.msgText->textCursor().hasSelection())
|
||||
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
|
||||
dlg->setOption(QPrintDialog::PrintSelection);
|
||||
dlg->setWindowTitle(tr("Print Document"));
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
ui.msgText->print(&printer);
|
||||
|
|
@ -802,8 +802,13 @@ void MessageWidget::saveAs()
|
|||
if (!file.open(QFile::WriteOnly))
|
||||
return;
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
ts << ui.msgText->document()->toHtml();
|
||||
#else
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
ts << ui.msgText->document()->toHtml("UTF-8");
|
||||
#endif
|
||||
ui.msgText->document()->setModified(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,11 @@ public:
|
|||
protected:
|
||||
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
return QVariant::compare(sourceModel()->data(left, RsMessageModel::SortRole), sourceModel()->data(right, RsMessageModel::SortRole)) < 0;
|
||||
#else
|
||||
return sourceModel()->data(left, RsMessageModel::SortRole) < sourceModel()->data(right, RsMessageModel::SortRole) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
|
||||
|
|
@ -157,7 +161,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
mMessageProxyModel->setSortRole(RsMessageModel::SortRole);
|
||||
mMessageProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
mMessageProxyModel->setFilterRole(RsMessageModel::FilterRole);
|
||||
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString));
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mMessageProxyModel, RsMessageModel::FilterString);
|
||||
|
||||
ui.messageTreeWidget->setModel(mMessageProxyModel);
|
||||
|
||||
|
|
@ -209,15 +213,15 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_CONTENT,true);
|
||||
ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_MSGID,true);
|
||||
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_STAR, fm.width('0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_ATTACHMENT, fm.width('0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_READ, fm.width('0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SPAM, fm.width('0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_STAR, QFontMetrics_horizontalAdvance(fm, '0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_ATTACHMENT, QFontMetrics_horizontalAdvance(fm, '0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_READ, QFontMetrics_horizontalAdvance(fm, '0')*1.5);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SPAM, QFontMetrics_horizontalAdvance(fm, '0')*1.5);
|
||||
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SUBJECT, fm.width("You have a message")*3.0);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_AUTHOR, fm.width("[Retroshare]")*1.1);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_TO, fm.width("[Retroshare]")*1.1);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_DATE, fm.width("01/01/1970")*1.1);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SUBJECT, QFontMetrics_horizontalAdvance(fm, "You have a message")*3.0);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_AUTHOR, QFontMetrics_horizontalAdvance(fm, "[Retroshare]")*1.1);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_TO, QFontMetrics_horizontalAdvance(fm, "[Retroshare]")*1.1);
|
||||
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_DATE, QFontMetrics_horizontalAdvance(fm, "01/01/1970")*1.1);
|
||||
|
||||
msgwheader->setSectionResizeMode(RsMessageModel::COLUMN_THREAD_SUBJECT, QHeaderView::Interactive);
|
||||
msgwheader->setSectionResizeMode(RsMessageModel::COLUMN_THREAD_AUTHOR, QHeaderView::Interactive);
|
||||
|
|
@ -1016,7 +1020,7 @@ void MessagesDialog::changeQuickView(int newrow)
|
|||
}
|
||||
|
||||
mMessageModel->setQuickViewFilter(f);
|
||||
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mMessageProxyModel, RsMessageModel::FilterString); // this triggers the update of the proxy model
|
||||
}
|
||||
|
||||
// click in messageTreeWidget
|
||||
|
|
@ -1263,7 +1267,7 @@ void MessagesDialog::filterChanged(const QString& text)
|
|||
}
|
||||
|
||||
mMessageModel->setFilter(f,items);
|
||||
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mMessageProxyModel, RsMessageModel::FilterString); // this triggers the update of the proxy model
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
|
@ -1289,7 +1293,7 @@ void MessagesDialog::filterColumnChanged(int column)
|
|||
|
||||
QStringList items = ui.filterLineEdit->text().split(' ',QtSkipEmptyParts);
|
||||
mMessageModel->setFilter(f,items);
|
||||
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model
|
||||
QSortFilterProxyModel_setFilterRegularExpression(mMessageProxyModel, RsMessageModel::FilterString); // this triggers the update of the proxy model
|
||||
|
||||
// save index
|
||||
Settings->setValueToGroup("MessageDialog", "filterColumn", column);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ QString ChatPage::loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_
|
|||
{
|
||||
whileBlocking(style_CB)->insertItem(n,style->styleName);
|
||||
|
||||
style_CB->setItemData(n, qVariantFromValue(*style),Qt::UserRole);
|
||||
style_CB->setItemData(n, QVariant::fromValue(*style),Qt::UserRole);
|
||||
|
||||
if (style->stylePath == stylePath) {
|
||||
activeItem = n;
|
||||
|
|
@ -686,10 +686,9 @@ void ChatPage::on_cbSearch_WithoutLimit_toggled(bool checked)
|
|||
|
||||
void ChatPage::on_btSearch_FoundColor_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(rgbChatSearchFoundColor, &ok, window());
|
||||
if (ok) {
|
||||
rgbChatSearchFoundColor=color;
|
||||
QColor color = QColorDialog::getColor(QColor::fromRgba(rgbChatSearchFoundColor), window(), "", QColorDialog::ShowAlphaChannel);
|
||||
if (color.isValid()) {
|
||||
rgbChatSearchFoundColor = color.rgba();
|
||||
QPixmap pix(24, 24);
|
||||
pix.fill(color);
|
||||
ui.btSearch_FoundColor->setIcon(pix);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,11 @@ bool CryptoPage::fileSave()
|
|||
if (!file.open(QFile::WriteOnly))
|
||||
return false;
|
||||
QTextStream ts(&file);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
ts.setEncoding(QStringConverter::Utf8);
|
||||
#else
|
||||
ts.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
ts << ui.certplainTextEdit->document()->toPlainText();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include <QTimer>
|
||||
#include <QStringListModel>
|
||||
#include <QProgressDialog>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
#define IMAGE_LEDOFF ":/images/ledoff1.png"
|
||||
#define IMAGE_LEDON ":/images/ledon1.png"
|
||||
|
|
@ -47,8 +49,8 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
|||
// This limits the possible tokens to alphanumeric
|
||||
|
||||
QString anRange = "[a-zA-Z0-9]+";
|
||||
QRegExp anRegex ("^" + anRange + ":" + anRange + "$");
|
||||
QRegExpValidator *anValidator = new QRegExpValidator(anRegex, this);
|
||||
QRegularExpression anRegex ("^" + anRange + ":" + anRange + "$");
|
||||
QRegularExpressionValidator *anValidator = new QRegularExpressionValidator(anRegex, this);
|
||||
|
||||
ui.tokenLineEdit->setValidator(anValidator);
|
||||
|
||||
|
|
@ -56,8 +58,8 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
|||
|
||||
QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
|
||||
// You may want to use QRegularExpression for new code with Qt 5 (not mandatory).
|
||||
QRegExp ipRegex ("^" + ipRange + "\\." + ipRange + "\\." + ipRange + "\\." + ipRange + "$");
|
||||
QRegExpValidator *ipValidator = new QRegExpValidator(ipRegex, this);
|
||||
QRegularExpression ipRegex ("^" + ipRange + "\\." + ipRange + "\\." + ipRange + "\\." + ipRange + "$");
|
||||
QRegularExpressionValidator *ipValidator = new QRegularExpressionValidator(ipRegex, this);
|
||||
|
||||
ui.listenAddressLineEdit->setValidator(ipValidator);
|
||||
ui.providersListView->setSelectionMode(QAbstractItemView::NoSelection); // prevents edition.
|
||||
|
|
@ -232,22 +234,22 @@ void JsonApiPage::addTokenClicked()
|
|||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||
}
|
||||
|
||||
void JsonApiPage::removeTokenClicked()
|
||||
{
|
||||
QString token(ui.tokenLineEdit->text());
|
||||
std::string tokenStr = token.toStdString();
|
||||
rsJsonApi->revokeAuthToken(tokenStr.substr(0, tokenStr.find_first_of(":")));
|
||||
|
||||
QStringList newTk;
|
||||
|
||||
for(const auto& it : rsJsonApi->getAuthorizedTokens())
|
||||
newTk.push_back(
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(Settings->getJsonApiAuthTokens()) );
|
||||
}
|
||||
|
||||
void JsonApiPage::removeTokenClicked()
|
||||
{
|
||||
QString token(ui.tokenLineEdit->text());
|
||||
std::string tokenStr = token.toStdString();
|
||||
rsJsonApi->revokeAuthToken(tokenStr.substr(0, tokenStr.find_first_of(":")));
|
||||
|
||||
QStringList newTk;
|
||||
|
||||
for(const auto& it : rsJsonApi->getAuthorizedTokens())
|
||||
newTk.push_back(
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(Settings->getJsonApiAuthTokens()) );
|
||||
}
|
||||
|
||||
void JsonApiPage::tokenClicked(const QModelIndex& index)
|
||||
{
|
||||
ui.tokenLineEdit->setText(ui.tokensListView->model()->data(index).toString());
|
||||
|
|
|
|||
|
|
@ -123,10 +123,9 @@ void NewTag::textChanged(const QString &text)
|
|||
|
||||
void NewTag::setTagColor()
|
||||
{
|
||||
bool ok;
|
||||
QRgb color = QColorDialog::getRgba(m_Color, &ok, this);
|
||||
if (ok) {
|
||||
m_Color = color;
|
||||
QColor color = QColorDialog::getColor(QColor::fromRgba(m_Color), this, "", QColorDialog::ShowAlphaChannel);
|
||||
if (color.isValid()) {
|
||||
m_Color = color.rgba();
|
||||
showColor (m_Color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
|
||||
enabledCheckBox->setFont(font);
|
||||
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
|
||||
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0);
|
||||
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
|
||||
|
||||
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <retroshare/rsservicecontrol.h>
|
||||
#include "rsitems/rsserviceids.h"
|
||||
#include <QTextDocument>
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#define NOT_IMPLEMENTED std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl;
|
||||
|
||||
|
|
@ -307,7 +308,7 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||
if(name.length() > 20 + 3)
|
||||
name = name.left(20)+"..." ;
|
||||
|
||||
peer_name_size = std::max(peer_name_size, fm.width(name)) ;
|
||||
peer_name_size = std::max(peer_name_size, QFontMetrics_horizontalAdvance(fm, name)) ;
|
||||
names.push_back(name) ;
|
||||
}
|
||||
|
||||
|
|
@ -322,13 +323,13 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||
|
||||
for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it,++i)
|
||||
{
|
||||
float X = S*fMATRIX_START_X + peer_name_size - fm.width(names[i]) ;
|
||||
float X = S*fMATRIX_START_X + peer_name_size - QFontMetrics_horizontalAdvance(fm, names[i]) ;
|
||||
float Y = S*fMATRIX_START_Y + (i+0.5)*S*fROW_SIZE + line_height/2.0f-2 ;
|
||||
|
||||
_painter->drawText(QPointF(X,Y),names[i]) ;
|
||||
|
||||
if(*it == _current_peer_id)
|
||||
_painter->drawLine(QPointF(X,Y+3),QPointF(X+fm.width(names[i]),Y+3)) ;
|
||||
_painter->drawLine(QPointF(X,Y+3),QPointF(X+QFontMetrics_horizontalAdvance(fm, names[i]),Y+3)) ;
|
||||
|
||||
y += line_height ;
|
||||
}
|
||||
|
|
@ -343,7 +344,7 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||
for(std::map<uint32_t, RsServiceInfo>::const_iterator it(ownServices.mServiceList.begin());it!=ownServices.mServiceList.end();++it,++i)
|
||||
{
|
||||
QString name = QString::fromUtf8(it->second.mServiceName.c_str()) ;
|
||||
int text_width = fm.width(name) ;
|
||||
int text_width = QFontMetrics_horizontalAdvance(fm, name) ;
|
||||
|
||||
int X = matrix_start_x + S*fCOL_SIZE/2 - 2 + i*S*fCOL_SIZE - text_width/2;
|
||||
|
||||
|
|
@ -497,11 +498,11 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||
QFontMetrics fm(font);
|
||||
|
||||
int text_size_x = 0 ;
|
||||
text_size_x = std::max(text_size_x,fm.width(service_name));
|
||||
text_size_x = std::max(text_size_x,fm.width(peer_name));
|
||||
text_size_x = std::max(text_size_x,fm.width(peer_id));
|
||||
text_size_x = std::max(text_size_x,fm.width(local_status));
|
||||
text_size_x = std::max(text_size_x,fm.width(remote_status));
|
||||
text_size_x = std::max(text_size_x,QFontMetrics_horizontalAdvance(fm, service_name));
|
||||
text_size_x = std::max(text_size_x,QFontMetrics_horizontalAdvance(fm, peer_name));
|
||||
text_size_x = std::max(text_size_x,QFontMetrics_horizontalAdvance(fm, peer_id));
|
||||
text_size_x = std::max(text_size_x,QFontMetrics_horizontalAdvance(fm, local_status));
|
||||
text_size_x = std::max(text_size_x,QFontMetrics_horizontalAdvance(fm, remote_status));
|
||||
|
||||
// draw a half-transparent rectangle
|
||||
|
||||
|
|
@ -565,7 +566,7 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||
QRect position = computeNodePosition(0,i,false) ;
|
||||
int popup_x = position.x() + (50 * S / 14.0);
|
||||
int popup_y = position.y() - (10 * S / 14.0) + line_height;
|
||||
int popup_width = std::max((int)td.size().width(), fm.width(service_name)) + S;
|
||||
int popup_width = std::max((int)td.size().width(), QFontMetrics_horizontalAdvance(fm, service_name)) + S;
|
||||
int popup_height = td.size().height() + line_height*2;
|
||||
while (popup_x + popup_width > _max_width)
|
||||
popup_x -= S;
|
||||
|
|
|
|||
|
|
@ -84,12 +84,6 @@ BandwidthGraph::BandwidthGraph(QWidget *parent, Qt::WindowFlags flags)
|
|||
/* Load the previously saved settings */
|
||||
|
||||
/* Turn off opacity group on unsupported platforms */
|
||||
#if defined(Q_OS_WIN)
|
||||
if(!(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion)) {
|
||||
ui.frmOpacity->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
ui.frmOpacity->setVisible(false);
|
||||
ui.chkAlwaysOnTop->setVisible(false);
|
||||
|
|
@ -283,10 +277,8 @@ void BandwidthGraph::setOpacity(int value)
|
|||
this->setWindowOpacity(newValue);
|
||||
ui.lblPercentOpacity->setText(QString::number(value));
|
||||
#elif defined(Q_OS_WIN)
|
||||
if(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion) {
|
||||
this->setWindowOpacity(newValue);
|
||||
ui.lblPercentOpacity->setText(QString::number(value));
|
||||
}
|
||||
this->setWindowOpacity(newValue);
|
||||
ui.lblPercentOpacity->setText(QString::number(value));
|
||||
#else
|
||||
Q_UNUSED(newValue);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void BWListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||
painter->setClipRect(opt.rect);
|
||||
|
||||
//set text color
|
||||
QVariant value = index.data(Qt::TextColorRole);
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
if(value.isValid() && qvariant_cast<QColor>(value).isValid()) {
|
||||
opt.palette.setColor(QPalette::Text, qvariant_cast<QColor>(value));
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ QSize BWListDelegate::sizeHint(const QStyleOptionViewItem & option/*option*/, co
|
|||
float FS = QFontMetricsF(option.font).height();
|
||||
//float fact = FS/14.0 ;
|
||||
|
||||
float w = QFontMetricsF(option.font).width(index.data(Qt::DisplayRole).toString());
|
||||
float w = QFontMetrics_horizontalAdvance(QFontMetricsF(option.font), index.data(Qt::DisplayRole).toString());
|
||||
|
||||
return QSize(w,FS*1.2);
|
||||
//return QSize(50*fact,17*fact);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@
|
|||
#include <QStylePainter>
|
||||
#include <QLayout>
|
||||
#include <QHeaderView>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QPointF>
|
||||
#endif
|
||||
|
||||
#include <retroshare/rsgrouter.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
|
@ -45,6 +48,7 @@
|
|||
#include "util/DateTime.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#define COL_ID 0
|
||||
#define COL_NICKNAME 1
|
||||
|
|
@ -188,10 +192,8 @@ void GlobalRouterStatistics::updateContent()
|
|||
if(nicknames.isEmpty())
|
||||
nicknames = tr("Unknown");
|
||||
|
||||
QDateTime routingtime;
|
||||
routingtime.setTime_t(cache_infos[i].routing_time);
|
||||
QDateTime senttime;
|
||||
senttime.setTime_t(cache_infos[i].last_sent_time);
|
||||
QDateTime routingtime = DateTime::DateTimeFromTime_t(cache_infos[i].routing_time);
|
||||
QDateTime senttime = DateTime::DateTimeFromTime_t(cache_infos[i].last_sent_time);
|
||||
|
||||
item -> setId(cache_infos[i].destination,COL_NICKNAME, false) ;
|
||||
item -> setData(COL_ID, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0'));
|
||||
|
|
@ -266,7 +268,7 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
QFont times_f(font());//"Times") ;
|
||||
|
|
@ -277,7 +279,7 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
QFontMetricsF fm_monospace(monospace_f) ;
|
||||
QFontMetricsF fm_times(times_f) ;
|
||||
|
||||
static const int cellx = fm_monospace.width(QString(" ")) ;
|
||||
static const int cellx = QFontMetrics_horizontalAdvance(fm_monospace, QString(" ")) ;
|
||||
static const int celly = fm_monospace.height() ;
|
||||
|
||||
maxHeight = 500*fact ;
|
||||
|
|
@ -318,11 +320,11 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
for(int i=0;i<100*fact;++i)
|
||||
{
|
||||
painter.setPen(colorScale(i/100.0/fact)) ;
|
||||
painter.drawLine(ox+fm_times.width(Q)+i,oy+fm_times.height()*0.5,ox+fm_times.width(Q)+i,oy+fm_times.height()) ;
|
||||
painter.drawLine(ox+QFontMetrics_horizontalAdvance(fm_times, Q)+i,oy+fm_times.height()*0.5,ox+QFontMetrics_horizontalAdvance(fm_times, Q)+i,oy+fm_times.height()) ;
|
||||
}
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
painter.drawText(ox+fm_times.width(Q) + 102*fact,oy+celly,")") ;
|
||||
painter.drawText(ox+QFontMetrics_horizontalAdvance(fm_times, Q) + 102*fact,oy+celly,")") ;
|
||||
|
||||
oy += celly ;
|
||||
oy += celly ;
|
||||
|
|
@ -372,21 +374,21 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
painter.drawText(ox+2*cellx,oy+celly,ids) ;
|
||||
|
||||
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
|
||||
painter.fillRect(ox+i*cellx+fm_monospace.width(ids),oy+0.15*celly,cellx,celly,colorScale(it->second[i])) ;
|
||||
painter.fillRect(ox+i*cellx+QFontMetrics_horizontalAdvance(fm_monospace, ids),oy+0.15*celly,cellx,celly,colorScale(it->second[i])) ;
|
||||
|
||||
if(n == mCurrentN)
|
||||
{
|
||||
current_probs = it->second ;
|
||||
current_oy = oy ;
|
||||
current_id = it->first ;
|
||||
current_width = ox+matrix_info.friend_ids.size()*cellx+fm_monospace.width(ids);
|
||||
current_width = ox+matrix_info.friend_ids.size()*cellx+QFontMetrics_horizontalAdvance(fm_monospace, ids);
|
||||
}
|
||||
|
||||
oy += celly ;
|
||||
//}
|
||||
|
||||
}
|
||||
mMaxWheelZoneX = ox+matrix_info.friend_ids.size()*cellx + fm_monospace.width(ids);
|
||||
mMaxWheelZoneX = ox+matrix_info.friend_ids.size()*cellx + QFontMetrics_horizontalAdvance(fm_monospace, ids);
|
||||
|
||||
RsIdentityDetails iddetails ;
|
||||
if(rsIdentity->getIdDetails(current_id,iddetails))
|
||||
|
|
@ -399,14 +401,14 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
painter.setPen(QColor::fromRgb(127,127,127));
|
||||
painter.drawRect(ox+2*cellx,current_oy+0.15*celly,fm_monospace.width(ids)+cellx*matrix_info.friend_ids.size()- 2*cellx,celly) ;
|
||||
painter.drawRect(ox+2*cellx,current_oy+0.15*celly,QFontMetrics_horizontalAdvance(fm_monospace, ids)+cellx*matrix_info.friend_ids.size()- 2*cellx,celly) ;
|
||||
|
||||
float total_length = (matrix_info.friend_ids.size()+2)*cellx ;
|
||||
|
||||
if(!current_probs.empty())
|
||||
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
|
||||
{
|
||||
float x1 = ox+(i+0.5)*cellx+fm_monospace.width(ids) ;
|
||||
float x1 = ox+(i+0.5)*cellx+QFontMetrics_horizontalAdvance(fm_monospace, ids) ;
|
||||
float y1 = oy+0.15*celly ;
|
||||
float y2 = y1+(matrix_info.friend_ids.size()-1-i+1)*celly;
|
||||
|
||||
|
|
@ -430,16 +432,26 @@ void GlobalRouterStatisticsWidget::updateContent()
|
|||
|
||||
void GlobalRouterStatisticsWidget::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
if(e->x() < mMinWheelZoneX || e->x() > mMaxWheelZoneX || e->y() < mMinWheelZoneY || e->y() > mMaxWheelZoneY)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
int x = e->position().toPoint().x();
|
||||
int y = e->position().toPoint().y();
|
||||
int delta = e->angleDelta().y();
|
||||
#else
|
||||
int x = e->x();
|
||||
int y = e->y();
|
||||
int delta = e->delta();
|
||||
#endif
|
||||
|
||||
if(x < mMinWheelZoneX || x > mMaxWheelZoneX || y < mMinWheelZoneY || y > mMaxWheelZoneY)
|
||||
{
|
||||
QWidget::wheelEvent(e) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if(e->delta() < 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys)
|
||||
if(delta < 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys)
|
||||
mCurrentN++ ;
|
||||
|
||||
if(e->delta() > 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1)
|
||||
if(delta > 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1)
|
||||
mCurrentN-- ;
|
||||
|
||||
updateContent();
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ void GxsIdStatisticsWidget::updateContent()
|
|||
setFixedHeight(mMaxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
|
||||
QFont times_f(font());//"Times") ;
|
||||
|
|
@ -269,7 +269,7 @@ void GxsIdStatisticsWidget::updateContent()
|
|||
QFontMetricsF fm_monospace(monospace_f) ;
|
||||
QFontMetricsF fm_times(times_f) ;
|
||||
|
||||
int cellx = fm_monospace.width(QString(" ")) ;
|
||||
int cellx = QFontMetrics_horizontalAdvance(fm_monospace, QString(" ")) ;
|
||||
int celly = fm_monospace.height() ;
|
||||
|
||||
// Display general statistics
|
||||
|
|
@ -336,13 +336,13 @@ void GxsIdStatisticsWidget::updateContent()
|
|||
for(size_t i=0;i<mPublishDateHist.entries().size();++i)
|
||||
{
|
||||
QString txt = QString::number(i);
|
||||
painter.drawText(ox+4*cellx+i*2*cellx+cellx*1.5 - 0.5*fm_times.width(txt),oy+celly,txt);
|
||||
painter.drawText(ox+4*cellx+i*2*cellx+cellx*1.5 - 0.5*QFontMetrics_horizontalAdvance(fm_times, txt),oy+celly,txt);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;++i)
|
||||
{
|
||||
QString txt = QString::number((int)rint(max_entry*i/5.0));
|
||||
painter.drawText(ox + 4*cellx - cellx - fm_times.width(txt),oy - i*hist_height/5.0 * celly,txt );
|
||||
painter.drawText(ox + 4*cellx - cellx - QFontMetrics_horizontalAdvance(fm_times, txt),oy - i*hist_height/5.0 * celly,txt );
|
||||
}
|
||||
|
||||
oy += 2*celly;
|
||||
|
|
@ -374,13 +374,13 @@ void GxsIdStatisticsWidget::updateContent()
|
|||
for(size_t i=0;i<mLastUsedHist.entries().size();++i)
|
||||
{
|
||||
QString txt = QString::number(i);
|
||||
painter.drawText(ox+4*cellx+i*2*cellx+cellx*1.5 - 0.5*fm_times.width(txt),oy+celly,txt);
|
||||
painter.drawText(ox+4*cellx+i*2*cellx+cellx*1.5 - 0.5*QFontMetrics_horizontalAdvance(fm_times, txt),oy+celly,txt);
|
||||
}
|
||||
|
||||
for(int i=0;i<5;++i)
|
||||
{
|
||||
QString txt = QString::number((int)rint(max_entry*i/5.0));
|
||||
painter.drawText(ox + 4*cellx - cellx - fm_times.width(txt),oy - i*hist_height/5.0 * celly,txt );
|
||||
painter.drawText(ox + 4*cellx - cellx - QFontMetrics_horizontalAdvance(fm_times, txt),oy - i*hist_height/5.0 * celly,txt );
|
||||
}
|
||||
|
||||
oy += 2*celly;
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ void GxsTransportStatistics::updateContent()
|
|||
std::set<RsGxsGroupId> openned_groups ;
|
||||
|
||||
for(int i=0; i<groupTreeWidget->topLevelItemCount(); ++i)
|
||||
if( groupTreeWidget->isItemExpanded(groupTreeWidget->topLevelItem(i)) )
|
||||
if( groupTreeWidget->topLevelItem(i)->isExpanded() )
|
||||
openned_groups.insert(RsGxsGroupId(groupTreeWidget->topLevelItem(i)->data(COL_GROUP_GRP_ID, Qt::DisplayRole).toString().toStdString()));
|
||||
|
||||
groupTreeWidget->clear();
|
||||
|
|
@ -295,7 +295,7 @@ void GxsTransportStatistics::updateContent()
|
|||
}
|
||||
|
||||
groupTreeWidget->addTopLevelItem(item);
|
||||
groupTreeWidget->setItemExpanded(item,openned_groups.find(it->first) != openned_groups.end());
|
||||
item->setExpanded(openned_groups.find(it->first) != openned_groups.end());
|
||||
|
||||
QString msg_time_string = (stat.last_publish_TS>0)?QString("(Last msg: %1)").arg(DateTime::DateTimeFromTime_t((uint)stat.last_publish_TS).toString()):"" ;
|
||||
|
||||
|
|
@ -331,8 +331,7 @@ void GxsTransportStatistics::updateContent()
|
|||
rsIdentity->getIdDetails(meta.mAuthorId,idDetails);
|
||||
|
||||
QPixmap pixmap ;
|
||||
QDateTime qdatetime;
|
||||
qdatetime.setTime_t(meta.mPublishTs);
|
||||
QDateTime qdatetime = DateTime::DateTimeFromTime_t(meta.mPublishTs);
|
||||
|
||||
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
|
||||
pixmap = GxsIdDetails::makeDefaultIcon(meta.mAuthorId,GxsIdDetails::SMALL);
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ void GxsAuthenticatedTunnelsDialog::updateDisplay()
|
|||
//setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
|
||||
// extracts the height of the fonts in pixels. This is used to calibrate the size of the objects to draw.
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ void GxsNetTunnelsDialog::updateDisplay()
|
|||
//setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
|
||||
// extracts the height of the fonts in pixels. This is used to calibrate the size of the objects to draw.
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std:
|
|||
setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
painter.begin(this);
|
||||
|
||||
|
||||
// extracts the height of the fonts in pixels. This is used to callibrate the size of the objects to draw.
|
||||
|
|
|
|||
|
|
@ -24,10 +24,15 @@
|
|||
#ifdef HAVE_XSS
|
||||
|
||||
#include <qapplication.h>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#include <QGuiApplication>
|
||||
#else
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QX11Info>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
|
@ -75,7 +80,10 @@ bool IdlePlatform::init()
|
|||
old_handler = XSetErrorHandler(xerrhandler);
|
||||
|
||||
int event_base, error_base;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
QNativeInterface::QX11Application *nativeInterface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
if (nativeInterface && XScreenSaverQueryExtension(nativeInterface->display(), &event_base, &error_base)) {
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
if(QX11Info::isPlatformX11() && XScreenSaverQueryExtension(QX11Info::display(), &event_base, &error_base)) {
|
||||
#else
|
||||
if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Info().display(), &event_base, &error_base)) {
|
||||
|
|
@ -90,7 +98,10 @@ int IdlePlatform::secondsIdle()
|
|||
{
|
||||
if(!d->ss_info)
|
||||
return 0;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
QNativeInterface::QX11Application *nativeInterface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
if(!nativeInterface || !XScreenSaverQueryInfo(nativeInterface->display(), DefaultRootWindow(nativeInterface->display()), d->ss_info))
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
if(!QX11Info::isPlatformX11() || !XScreenSaverQueryInfo(QX11Info::display(), QX11Info::appRootWindow(), d->ss_info))
|
||||
#else
|
||||
if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Info().display(), QX11Info::appRootWindow(), d->ss_info))
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ CrashStackTrace gCrashStackTrace;
|
|||
#include "util/rsdir.h"
|
||||
#include "util/rstime.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
#ifdef MESSENGER_WINDOW
|
||||
#include "gui/MessengerWindow.h"
|
||||
|
|
@ -136,7 +137,7 @@ static void showHelp(const argstream& as)
|
|||
box.setWindowTitle(QObject::tr("Retroshare commandline arguments"));
|
||||
|
||||
// now compute the size of text and set the size of the box. For the record, this doesn't work...
|
||||
box.setBaseSize( QSize(QFontMetricsF(font).width(text),QFontMetricsF(font).height()*text.count('\n')) );
|
||||
box.setBaseSize( QSize(QFontMetrics_horizontalAdvance(QFontMetricsF(font), text),QFontMetricsF(font).height()*text.count('\n')) );
|
||||
box.exec();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ CONFIG += console
|
|||
TARGET = retroshare
|
||||
DEFINES += TARGET=\\\"$${TARGET}\\\"
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION,5): QT += core5compat
|
||||
|
||||
DEPENDPATH *= $${PWD} $${RS_INCLUDE_DIR}
|
||||
INCLUDEPATH *= $${PWD}
|
||||
|
||||
|
|
@ -816,6 +818,7 @@ SOURCES += main.cpp \
|
|||
util/misc.cpp \
|
||||
util/HandleRichText.cpp \
|
||||
util/ObjectPainter.cpp \
|
||||
util/RsQtVersion.cpp \
|
||||
util/RsFile.cpp \
|
||||
util/RichTextEdit.cpp \
|
||||
util/ClickableLabel.cpp \
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <QFileOpenEvent>
|
||||
#include <QLocale>
|
||||
#include <QLocalSocket>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSharedMemory>
|
||||
#include <QShortcut>
|
||||
#include <QString>
|
||||
|
|
@ -311,8 +311,8 @@ void RsApplication::customizeDateFormat()
|
|||
QLocale locale = QLocale(); // set to default locale
|
||||
/* get long date format without weekday */
|
||||
options.dateformat = locale.dateFormat(QLocale::LongFormat);
|
||||
options.dateformat.replace(QRegExp("^dddd,*[^ ]* *('[^']+' )*"), "");
|
||||
options.dateformat.replace(QRegExp(",* *dddd"), "");
|
||||
options.dateformat.replace(QRegularExpression("^dddd,*[^ ]* *('[^']+' )*"), "");
|
||||
options.dateformat.replace(QRegularExpression(",* *dddd"), "");
|
||||
options.dateformat = options.dateformat.trimmed();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLocale>
|
||||
|
||||
#include "DateTime.h"
|
||||
#include "rshare.h"
|
||||
|
|
@ -66,7 +67,7 @@ QString DateTime::formatDate(time_t dateValue)
|
|||
|
||||
QString DateTime::formatDate(const QDate &dateValue)
|
||||
{
|
||||
return dateValue.toString(Qt::SystemLocaleShortDate);
|
||||
return QLocale::system().toString(dateValue, QLocale::ShortFormat);
|
||||
}
|
||||
|
||||
QString DateTime::formatTime(time_t timeValue)
|
||||
|
|
@ -76,7 +77,7 @@ QString DateTime::formatTime(time_t timeValue)
|
|||
|
||||
QString DateTime::formatTime(const QTime &timeValue)
|
||||
{
|
||||
return timeValue.toString(Qt::SystemLocaleShortDate);
|
||||
return QLocale::system().toString(timeValue, QLocale::ShortFormat);
|
||||
}
|
||||
|
||||
QDateTime DateTime::DateTimeFromTime_t(time_t timeValue)
|
||||
|
|
@ -87,3 +88,12 @@ QDateTime DateTime::DateTimeFromTime_t(time_t timeValue)
|
|||
return QDateTime::fromTime_t(timeValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
time_t DateTime::DateTimeToTime_t(const QDateTime& dateTime)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
return dateTime.toSecsSinceEpoch();
|
||||
#else
|
||||
return dateTime.toTime_t();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ public:
|
|||
|
||||
/* Convert time_t to QDateTime */
|
||||
static QDateTime DateTimeFromTime_t(time_t timeValue);
|
||||
|
||||
/* Convert QDateTime to time_t */
|
||||
static time_t DateTimeToTime_t(const QDateTime& dateTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <QTextDocumentFragment>
|
||||
#include <qmath.h>
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
|
||||
#include "HandleRichText.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
|
@ -358,7 +360,7 @@ void RsHtml::filterEmbeddedImages(QDomDocument &doc, QDomElement ¤tElement
|
|||
}
|
||||
}
|
||||
|
||||
int RsHtml::indexInWithValidation(QRegExp &rx, const QString &text, EmbedInHtml &embedInfos, int pos)
|
||||
int RsHtml::indexInWithValidation(const QRegExp &rx, const QString &text, EmbedInHtml &embedInfos, int pos)
|
||||
{
|
||||
int index = rx.indexIn(text, pos);
|
||||
if(index == -1 || embedInfos.myType != Img) return index;
|
||||
|
|
@ -1171,7 +1173,7 @@ void RsHtml::optimizeHtml(QString &text, unsigned int flag /*= 0*/
|
|||
{
|
||||
|
||||
// remove doctype
|
||||
text.remove(QRegExp("<!DOCTYPE[^>]*>"));
|
||||
text.remove(QRegularExpression("<!DOCTYPE[^>]*>"));
|
||||
//remove all prepend char that make doc.setContent() fail
|
||||
text.remove(0,text.indexOf("<"));
|
||||
// Save Space and Tab because doc loose it.
|
||||
|
|
@ -1253,7 +1255,7 @@ QString RsHtml::makeQuotedText(RSTextBrowser *browser)
|
|||
{
|
||||
text = browser->toPlainText();
|
||||
}
|
||||
QStringList sl = text.split(QRegExp("[\r\n]"),QtSkipEmptyParts);
|
||||
QStringList sl = text.split(QRegularExpression("[\r\n]"),QtSkipEmptyParts);
|
||||
text = sl.join("\n> ");
|
||||
text.replace("\n> >","\n>>"); // Don't add space for already quotted lines.
|
||||
text.replace(QChar(-4)," ");//Char used when image on text.
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class QDomElement;
|
|||
class EmbedInHtml;
|
||||
class RetroShareLink;
|
||||
class QTextCursor;
|
||||
class QRegExp;
|
||||
|
||||
class RsHtml
|
||||
{
|
||||
|
|
@ -89,7 +90,7 @@ protected:
|
|||
virtual void anchorStylesheetForImg(QDomDocument &doc, QDomElement &element, const RetroShareLink &link, QString &styleSheet);
|
||||
|
||||
private:
|
||||
int indexInWithValidation(QRegExp &rx, const QString &text, EmbedInHtml &embedInfos, int pos = 0);
|
||||
int indexInWithValidation(const QRegExp &rx, const QString &text, EmbedInHtml &embedInfos, int pos = 0);
|
||||
};
|
||||
|
||||
#endif // HANDLE_RICH_TEXT_H_
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "util/RsQtVersion.h"
|
||||
|
||||
RetroStyleLabel::RetroStyleLabel(QWidget * parent, Mode mode, Qt::AlignmentFlag hAlign)
|
||||
: QLabel(parent), _mode(mode) {
|
||||
|
||||
|
|
@ -206,7 +208,7 @@ void RetroStyleLabel::mouseReleaseEvent(QMouseEvent * event) {
|
|||
void RetroStyleLabel::setText(const QString & text) {
|
||||
QLabel::setText(text);
|
||||
QFontMetrics fm(font());
|
||||
int textWidth = fm.width(text);
|
||||
int textWidth = QFontMetrics_horizontalAdvance(fm, text);
|
||||
textWidth += 40;
|
||||
QSize s = size();
|
||||
if (textWidth > s.width()) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000;
|
|||
RichTextEdit::RichTextEdit(QWidget *parent) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
m_lastBlockList = 0;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 10, 0)
|
||||
f_textedit->setTabStopDistance(40);
|
||||
#else
|
||||
f_textedit->setTabStopWidth(40);
|
||||
#endif
|
||||
|
||||
connect(f_textedit, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
|
||||
this, SLOT(slotCurrentCharFormatChanged(QTextCharFormat)));
|
||||
|
|
@ -177,14 +181,14 @@ RichTextEdit::RichTextEdit(QWidget *parent) : QWidget(parent) {
|
|||
// text foreground color
|
||||
|
||||
QPixmap pix(16, 16);
|
||||
pix.fill(QApplication::palette().foreground().color());
|
||||
pix.fill(QApplication::palette().windowText().color());
|
||||
f_fgcolor->setIcon(pix);
|
||||
|
||||
connect(f_fgcolor, SIGNAL(clicked()), this, SLOT(textFgColor()));
|
||||
|
||||
// text background color
|
||||
|
||||
pix.fill(QApplication::palette().background().color());
|
||||
pix.fill(QApplication::palette().window().color());
|
||||
f_bgcolor->setIcon(pix);
|
||||
|
||||
connect(f_bgcolor, SIGNAL(clicked()), this, SLOT(textBgColor()));
|
||||
|
|
@ -515,7 +519,7 @@ void RichTextEdit::fgColorChanged(const QColor &c) {
|
|||
if (c.isValid()) {
|
||||
pix.fill(c);
|
||||
} else {
|
||||
pix.fill(QApplication::palette().foreground().color());
|
||||
pix.fill(QApplication::palette().windowText().color());
|
||||
}
|
||||
f_fgcolor->setIcon(pix);
|
||||
}
|
||||
|
|
@ -525,7 +529,7 @@ void RichTextEdit::bgColorChanged(const QColor &c) {
|
|||
if (c.isValid()) {
|
||||
pix.fill(c);
|
||||
} else {
|
||||
pix.fill(QApplication::palette().background().color());
|
||||
pix.fill(QApplication::palette().window().color());
|
||||
}
|
||||
f_bgcolor->setIcon(pix);
|
||||
}
|
||||
|
|
@ -547,9 +551,9 @@ void RichTextEdit::slotClipboardDataChanged() {
|
|||
QString RichTextEdit::toHtml() const {
|
||||
QString s = f_textedit->toHtml();
|
||||
// convert emails to links
|
||||
s = s.replace(QRegExp("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)([a-zA-Z\\d]+@[a-zA-Z\\d]+\\.[a-zA-Z]+)"), "\\1<a href=\"mailto:\\2\">\\2</a>");
|
||||
s = s.replace(QRegularExpression("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)([a-zA-Z\\d]+@[a-zA-Z\\d]+\\.[a-zA-Z]+)"), "\\1<a href=\"mailto:\\2\">\\2</a>");
|
||||
// convert links
|
||||
s = s.replace(QRegExp("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)((?:https?|ftp|file)://[^\\s'\"<>]+)"), "\\1<a href=\"\\2\">\\2</a>");
|
||||
s = s.replace(QRegularExpression("(<[^a][^>]+>(?:<span[^>]+>)?|\\s)((?:https?|ftp|file)://[^\\s'\"<>]+)"), "\\1<a href=\"\\2\">\\2</a>");
|
||||
// see also: Utils::linkify()
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
36
retroshare-gui/src/util/RsQtVersion.cpp
Normal file
36
retroshare-gui/src/util/RsQtVersion.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* util/RsQtVersion.cpp *
|
||||
* *
|
||||
* Copyright (C) 2025 Retroshare Team <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
// Functions to compile with Qt 4, Qt 5 and Qt 6
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK (5, 15, 0)
|
||||
#include <QLabel>
|
||||
QPixmap QLabel_pixmap(QLabel* label)
|
||||
{
|
||||
const QPixmap *pixmap = label->pixmap();
|
||||
if (pixmap) {
|
||||
return *pixmap;
|
||||
}
|
||||
|
||||
return QPixmap();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* util/qthreadutils.h *
|
||||
* util/RsQtVersion.h *
|
||||
* *
|
||||
* Copyright (C) 2013 Retroshare Team <retroshare.project@gmail.com> *
|
||||
* *
|
||||
|
|
@ -49,4 +49,29 @@
|
|||
#define QtSkipEmptyParts QString::SkipEmptyParts
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#define QSortFilterProxyModel_setFilterRegularExpression(proxyModel, pattern) proxyModel->setFilterRegularExpression(pattern);
|
||||
#else
|
||||
#define QSortFilterProxyModel_setFilterRegularExpression(proxyModel, pattern) proxyModel->setFilterRegExp(pattern);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
#define QFontMetrics_horizontalAdvance(fontMetrics, text) fontMetrics.horizontalAdvance(text)
|
||||
#else
|
||||
#define QFontMetrics_horizontalAdvance(fontMetrics, text) fontMetrics.width(text)
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 6, 0)
|
||||
#define QLabel_pixmap(label) label->pixmap()
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
#define QLabel_pixmap(label) label->pixmap(Qt::ReturnByValue)
|
||||
#else
|
||||
class QLabel;
|
||||
extern QPixmap QLabel_pixmap(QLabel* label);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK (5, 8, 0)
|
||||
#define Q_FALLTHROUGH() (void)0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "RsSyntaxHighlighter.h"
|
||||
|
||||
RsSyntaxHighlighter::RsSyntaxHighlighter(QTextEdit *parent)
|
||||
|
|
@ -65,7 +67,7 @@ void RsSyntaxHighlighter::highlightBlock(const QString &text)
|
|||
{
|
||||
if (text == "") return;
|
||||
|
||||
QRegExp endl("[\\r\\n\\x2028]"); //Usually 0x2028 character is used for newline, no idea why
|
||||
QRegularExpression endl("[\\r\\n\\x2028]"); //Usually 0x2028 character is used for newline, no idea why
|
||||
int index = 0;
|
||||
QStringList lines = text.split(endl);
|
||||
foreach (const QString &cLine, lines) {
|
||||
|
|
|
|||
|
|
@ -340,7 +340,11 @@ void ImageUtil::quantization(const QImage &img, QVector<QRgb> &palette)
|
|||
colors.insert(pixel);
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 14, 0)
|
||||
QList<QRgb> colorlist(colors.begin(), colors.end());
|
||||
#else
|
||||
QList<QRgb> colorlist = colors.toList();
|
||||
#endif
|
||||
//don't do the algoritmh if we have less than 16 different colors
|
||||
if(colorlist.size() <= (1 << bits)) {
|
||||
for(int i = 0; i < colors.count(); ++i)
|
||||
|
|
@ -387,14 +391,14 @@ void ImageUtil::quantization(QList<QRgb>::iterator begin, QList<QRgb>::iterator
|
|||
//order by the widest channel
|
||||
if(red > green)
|
||||
if(red > blue)
|
||||
qSort(begin, end, redLessThan);
|
||||
std::sort(begin, end, redLessThan);
|
||||
else
|
||||
qSort(begin, end, blueLessThan);
|
||||
std::sort(begin, end, blueLessThan);
|
||||
else
|
||||
if(green > blue)
|
||||
qSort(begin, end, greenLessThan);
|
||||
std::sort(begin, end, greenLessThan);
|
||||
else
|
||||
qSort(begin, end, blueLessThan);
|
||||
std::sort(begin, end, blueLessThan);
|
||||
|
||||
//split into two buckets
|
||||
QList<QRgb>::iterator split = begin + count / 2;
|
||||
|
|
|
|||
|
|
@ -171,7 +171,12 @@ Log::LogMessage::~LogMessage()
|
|||
if (!--stream->ref) {
|
||||
if (stream->out && !stream->buf.isEmpty()) {
|
||||
QTextStream log(stream->out);
|
||||
log << toString() << endl;
|
||||
log << toString() <<
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
Qt::endl;
|
||||
#else
|
||||
endl;
|
||||
#endif
|
||||
log.flush();
|
||||
}
|
||||
delete stream;
|
||||
|
|
|
|||
|
|
@ -335,8 +335,7 @@ bool misc::getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type
|
|||
|
||||
#ifdef WINDOWS_SYS
|
||||
// fix bug in Qt for Windows Vista and higher, convert path from native separators
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||
file = QDir::fromNativeSeparators(file);
|
||||
file = QDir::fromNativeSeparators(file);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
@ -361,11 +360,9 @@ bool misc::getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type
|
|||
Settings->setLastDir(type, lastDir);
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
// fix bug in Qt for Windows Vista and higher, convert path from native separators
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||
for (QStringList::iterator file = files.begin(); file != files.end(); ++file) {
|
||||
(*file) = QDir::fromNativeSeparators(*file);
|
||||
}
|
||||
for (QStringList::iterator file = files.begin(); file != files.end(); ++file) {
|
||||
(*file) = QDir::fromNativeSeparators(*file);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ void PreviewView::paintPage(QPainter *painter, int page)
|
|||
painter->drawRect(QRectF(QPointF(0, 0), printPreview->paperSize));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
col = col.light();
|
||||
col = col.lighter();
|
||||
painter->drawLine(QLineF(printPreview->paperSize.width(), 1,
|
||||
printPreview->paperSize.width(), printPreview->paperSize.height() - 1));
|
||||
|
||||
col = col.light();
|
||||
col = col.lighter();
|
||||
painter->drawLine(QLineF(printPreview->paperSize.width(), 2,
|
||||
printPreview->paperSize.width(), printPreview->paperSize.height() - 2));
|
||||
|
||||
|
|
@ -239,12 +239,12 @@ PrintPreview::PrintPreview(const QTextDocument *document, QWidget *parent)
|
|||
|
||||
void PrintPreview::setup()
|
||||
{
|
||||
QSizeF page = printer.pageRect().size();
|
||||
paperSize = printer.paperRect().size();
|
||||
QRect page = printer.pageLayout().paintRectPixels(printer.resolution());
|
||||
paperSize = printer.pageLayout().fullRectPixels(printer.resolution()).size();
|
||||
paperSize.rwidth() *= qreal(view->logicalDpiX()) / printer.logicalDpiX();
|
||||
paperSize.rheight() *= qreal(view->logicalDpiY()) / printer.logicalDpiY();
|
||||
|
||||
pageTopLeft = printer.pageRect().topLeft();
|
||||
pageTopLeft = page.topLeft();
|
||||
pageTopLeft.rx() *= qreal(view->logicalDpiX()) / printer.logicalDpiX();
|
||||
pageTopLeft.ry() *= qreal(view->logicalDpiY()) / printer.logicalDpiY();
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ void PrintPreview::setup()
|
|||
fmt.setMargin(margin);
|
||||
doc->rootFrame()->setFrameFormat(fmt);
|
||||
|
||||
doc->setPageSize(page);
|
||||
doc->setPageSize(page.size());
|
||||
}
|
||||
|
||||
PrintPreview::~PrintPreview()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue