parent
8845a23d5d
commit
34e951298f
7 changed files with 49 additions and 46 deletions
|
@ -45,7 +45,7 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
|
||||||
connect(stopDownload, SIGNAL(clicked()), this, SLOT(cancelDownload()));
|
connect(stopDownload, SIGNAL(clicked()), this, SLOT(cancelDownload()));
|
||||||
connect(ok, SIGNAL(clicked()), this, SLOT(closeDialog()));
|
connect(ok, SIGNAL(clicked()), this, SLOT(closeDialog()));
|
||||||
|
|
||||||
QVBoxLayout *parentLayout = new QVBoxLayout(this);
|
auto *parentLayout = new QVBoxLayout(this);
|
||||||
parentLayout->addWidget(descriptionLabel);
|
parentLayout->addWidget(descriptionLabel);
|
||||||
parentLayout->addWidget(statusLabel);
|
parentLayout->addWidget(statusLabel);
|
||||||
parentLayout->addWidget(progress);
|
parentLayout->addWidget(progress);
|
||||||
|
@ -54,8 +54,8 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
|
||||||
setLayout(parentLayout);
|
setLayout(parentLayout);
|
||||||
setWindowTitle(tr("Check for Client Updates"));
|
setWindowTitle(tr("Check for Client Updates"));
|
||||||
|
|
||||||
setFixedHeight(sizeHint().height());
|
setFixedHeight(this->sizeHint().height());
|
||||||
setFixedWidth(sizeHint().width());
|
setFixedWidth(this->sizeHint().width());
|
||||||
|
|
||||||
// Check for SSL (this probably isn't necessary)
|
// Check for SSL (this probably isn't necessary)
|
||||||
if (!QSslSocket::supportsSsl()) {
|
if (!QSslSocket::supportsSsl()) {
|
||||||
|
@ -144,7 +144,7 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Releas
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
publishDate = release->getPublishDate().toString(Qt::DefaultLocaleLongDate);
|
publishDate = release->getPublishDate().toString(QLocale().dateFormat(QLocale::LongFormat));
|
||||||
if (isCompatible) {
|
if (isCompatible) {
|
||||||
int reply;
|
int reply;
|
||||||
reply = QMessageBox::question(
|
reply = QMessageBox::question(
|
||||||
|
@ -194,19 +194,19 @@ void DlgUpdate::enableOkButton(bool enable)
|
||||||
ok->setEnabled(enable);
|
ok->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::setLabel(QString newText)
|
void DlgUpdate::setLabel(const QString &newText)
|
||||||
{
|
{
|
||||||
statusLabel->setText(newText);
|
statusLabel->setText(newText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::updateCheckError(QString errorString)
|
void DlgUpdate::updateCheckError(const QString &errorString)
|
||||||
{
|
{
|
||||||
setLabel(tr("Error"));
|
setLabel(tr("Error"));
|
||||||
QMessageBox::critical(this, tr("Update Error"),
|
QMessageBox::critical(this, tr("Update Error"),
|
||||||
tr("An error occurred while checking for updates:") + QString(" ") + errorString);
|
tr("An error occurred while checking for updates:") + QString(" ") + errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::downloadError(QString errorString)
|
void DlgUpdate::downloadError(const QString &errorString)
|
||||||
{
|
{
|
||||||
setLabel(tr("Error"));
|
setLabel(tr("Error"));
|
||||||
enableUpdateButton(true);
|
enableUpdateButton(true);
|
||||||
|
@ -214,7 +214,7 @@ void DlgUpdate::downloadError(QString errorString)
|
||||||
tr("An error occurred while downloading an update:") + QString(" ") + errorString);
|
tr("An error occurred while downloading an update:") + QString(" ") + errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::downloadSuccessful(QUrl filepath)
|
void DlgUpdate::downloadSuccessful(const QUrl &filepath)
|
||||||
{
|
{
|
||||||
setLabel(tr("Installing..."));
|
setLabel(tr("Installing..."));
|
||||||
// Try to open the installer. If it opens, quit Cockatrice
|
// Try to open the installer. If it opens, quit Cockatrice
|
||||||
|
|
|
@ -19,10 +19,10 @@ private slots:
|
||||||
void gotoDownloadPage();
|
void gotoDownloadPage();
|
||||||
void downloadUpdate();
|
void downloadUpdate();
|
||||||
void cancelDownload();
|
void cancelDownload();
|
||||||
void updateCheckError(QString errorString);
|
void updateCheckError(const QString &errorString);
|
||||||
void downloadSuccessful(QUrl filepath);
|
void downloadSuccessful(const QUrl &filepath);
|
||||||
void downloadProgressMade(qint64 bytesRead, qint64 totalBytes);
|
void downloadProgressMade(qint64 bytesRead, qint64 totalBytes);
|
||||||
void downloadError(QString errorString);
|
void downloadError(const QString &errorString);
|
||||||
void closeDialog();
|
void closeDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -31,7 +31,7 @@ private:
|
||||||
void enableOkButton(bool enable);
|
void enableOkButton(bool enable);
|
||||||
void addStopDownloadAndRemoveOthers(bool enable);
|
void addStopDownloadAndRemoveOthers(bool enable);
|
||||||
void beginUpdateCheck();
|
void beginUpdateCheck();
|
||||||
void setLabel(QString text);
|
void setLabel(const QString &text);
|
||||||
QLabel *statusLabel, *descriptionLabel;
|
QLabel *statusLabel, *descriptionLabel;
|
||||||
QProgressBar *progress;
|
QProgressBar *progress;
|
||||||
QPushButton *manualDownload, *gotoDownload, *ok, *stopDownload;
|
QPushButton *manualDownload, *gotoDownload, *ok, *stopDownload;
|
||||||
|
|
|
@ -24,7 +24,7 @@ PlayerCounter::PlayerCounter(Player *_player,
|
||||||
|
|
||||||
QRectF PlayerCounter::boundingRect() const
|
QRectF PlayerCounter::boundingRect() const
|
||||||
{
|
{
|
||||||
return QRectF(0, 0, 50, 30);
|
return {0, 0, 50, 30};
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void PlayerCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
@ -56,13 +56,14 @@ void PlayerCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem, QWidget *_game)
|
PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem, QWidget *_game)
|
||||||
: ArrowTarget(_owner, parentItem), playerCounter(0), game(_game)
|
: ArrowTarget(_owner, parentItem), playerCounter(nullptr), game(_game)
|
||||||
{
|
{
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
|
||||||
const std::string &bmp = _owner->getUserInfo()->avatar_bmp();
|
const std::string &bmp = _owner->getUserInfo()->avatar_bmp();
|
||||||
if (!fullPixmap.loadFromData((const uchar *)bmp.data(), bmp.size()))
|
if (!fullPixmap.loadFromData((const uchar *)bmp.data(), static_cast<uint>(bmp.size()))) {
|
||||||
fullPixmap = QPixmap();
|
fullPixmap = QPixmap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerTarget::~PlayerTarget()
|
PlayerTarget::~PlayerTarget()
|
||||||
|
@ -74,7 +75,7 @@ PlayerTarget::~PlayerTarget()
|
||||||
|
|
||||||
QRectF PlayerTarget::boundingRect() const
|
QRectF PlayerTarget::boundingRect() const
|
||||||
{
|
{
|
||||||
return QRectF(0, 0, 160, 64);
|
return {0, 0, 160, 64};
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
@ -153,7 +154,7 @@ void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*o
|
||||||
AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name, int _value)
|
AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name, int _value)
|
||||||
{
|
{
|
||||||
if (playerCounter) {
|
if (playerCounter) {
|
||||||
disconnect(playerCounter, 0, this, 0);
|
disconnect(playerCounter, nullptr, this, nullptr);
|
||||||
playerCounter->delCounter();
|
playerCounter->delCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,5 +168,5 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name,
|
||||||
|
|
||||||
void PlayerTarget::counterDeleted()
|
void PlayerTarget::counterDeleted()
|
||||||
{
|
{
|
||||||
playerCounter = 0;
|
playerCounter = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,9 +337,9 @@ void RemoteClient::websocketMessageReceived(const QByteArray &message)
|
||||||
void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
||||||
{
|
{
|
||||||
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
unsigned int size = cont.ByteSizeLong();
|
auto size = static_cast<unsigned int>(cont.ByteSizeLong());
|
||||||
#else
|
#else
|
||||||
unsigned int size = cont.ByteSize();
|
auto size = static_cast<unsigned int>(cont.ByteSize());
|
||||||
#endif
|
#endif
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "OUT" << size << QString::fromStdString(cont.ShortDebugString());
|
qDebug() << "OUT" << size << QString::fromStdString(cont.ShortDebugString());
|
||||||
|
@ -419,7 +419,7 @@ void RemoteClient::doActivateToServer(const QString &_token)
|
||||||
|
|
||||||
token = _token.trimmed();
|
token = _token.trimmed();
|
||||||
|
|
||||||
connectToHost(lastHostname, static_cast<unsigned int>(lastPort));
|
connectToHost(lastHostname, lastPort);
|
||||||
setStatus(StatusActivating);
|
setStatus(StatusActivating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ void RemoteClient::disconnectFromServer()
|
||||||
emit sigDisconnectFromServer();
|
emit sigDisconnectFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteClient::getSrvClientID(const QString _hostname)
|
QString RemoteClient::getSrvClientID(const QString &_hostname)
|
||||||
{
|
{
|
||||||
QString srvClientID = SettingsCache::instance().getClientID();
|
QString srvClientID = SettingsCache::instance().getClientID();
|
||||||
QHostInfo hostInfo = QHostInfo::fromName(_hostname);
|
QHostInfo hostInfo = QHostInfo::fromName(_hostname);
|
||||||
|
@ -518,11 +518,11 @@ QString RemoteClient::getSrvClientID(const QString _hostname)
|
||||||
return uniqueServerClientID;
|
return uniqueServerClientID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteClient::newMissingFeatureFound(QString _serversMissingFeatures)
|
bool RemoteClient::newMissingFeatureFound(const QString &_serversMissingFeatures)
|
||||||
{
|
{
|
||||||
bool newMissingFeature = false;
|
bool newMissingFeature = false;
|
||||||
QStringList serversMissingFeaturesList = _serversMissingFeatures.split(",");
|
QStringList serversMissingFeaturesList = _serversMissingFeatures.split(",");
|
||||||
foreach (const QString &feature, serversMissingFeaturesList) {
|
for (const QString &feature : serversMissingFeaturesList) {
|
||||||
if (!feature.isEmpty()) {
|
if (!feature.isEmpty()) {
|
||||||
if (!SettingsCache::instance().getKnownMissingFeatures().contains(feature))
|
if (!SettingsCache::instance().getKnownMissingFeatures().contains(feature))
|
||||||
return true;
|
return true;
|
||||||
|
@ -535,7 +535,7 @@ void RemoteClient::clearNewClientFeatures()
|
||||||
{
|
{
|
||||||
QString newKnownMissingFeatures;
|
QString newKnownMissingFeatures;
|
||||||
QStringList existingKnownMissingFeatures = SettingsCache::instance().getKnownMissingFeatures().split(",");
|
QStringList existingKnownMissingFeatures = SettingsCache::instance().getKnownMissingFeatures().split(",");
|
||||||
foreach (const QString &existingKnownFeature, existingKnownMissingFeatures) {
|
for (const QString &existingKnownFeature : existingKnownMissingFeatures) {
|
||||||
if (!existingKnownFeature.isEmpty()) {
|
if (!existingKnownFeature.isEmpty()) {
|
||||||
if (!clientFeatures.contains(existingKnownFeature))
|
if (!clientFeatures.contains(existingKnownFeature))
|
||||||
newKnownMissingFeatures.append("," + existingKnownFeature);
|
newKnownMissingFeatures.append("," + existingKnownFeature);
|
||||||
|
@ -566,7 +566,7 @@ void RemoteClient::doRequestForgotPasswordToServer(const QString &hostname, unsi
|
||||||
lastHostname = hostname;
|
lastHostname = hostname;
|
||||||
lastPort = port;
|
lastPort = port;
|
||||||
|
|
||||||
connectToHost(lastHostname, static_cast<unsigned int>(lastPort));
|
connectToHost(lastHostname, lastPort);
|
||||||
setStatus(StatusRequestingForgotPassword);
|
setStatus(StatusRequestingForgotPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ void RemoteClient::doSubmitForgotPasswordResetToServer(const QString &hostname,
|
||||||
token = _token.trimmed();
|
token = _token.trimmed();
|
||||||
password = _newpassword;
|
password = _newpassword;
|
||||||
|
|
||||||
connectToHost(lastHostname, static_cast<unsigned int>(lastPort));
|
connectToHost(lastHostname, lastPort);
|
||||||
setStatus(StatusSubmitForgotPasswordReset);
|
setStatus(StatusSubmitForgotPasswordReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ void RemoteClient::doSubmitForgotPasswordChallengeToServer(const QString &hostna
|
||||||
lastPort = port;
|
lastPort = port;
|
||||||
email = _email;
|
email = _email;
|
||||||
|
|
||||||
connectToHost(lastHostname, static_cast<unsigned int>(lastPort));
|
connectToHost(lastHostname, lastPort);
|
||||||
setStatus(StatusSubmitForgotPasswordChallenge);
|
setStatus(StatusSubmitForgotPasswordChallenge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ private:
|
||||||
QTcpSocket *socket;
|
QTcpSocket *socket;
|
||||||
QWebSocket *websocket;
|
QWebSocket *websocket;
|
||||||
QString lastHostname;
|
QString lastHostname;
|
||||||
int lastPort;
|
unsigned int lastPort;
|
||||||
|
|
||||||
QString getSrvClientID(QString _hostname);
|
QString getSrvClientID(const QString &_hostname);
|
||||||
bool newMissingFeatureFound(QString _serversMissingFeatures);
|
bool newMissingFeatureFound(const QString &_serversMissingFeatures);
|
||||||
void clearNewClientFeatures();
|
void clearNewClientFeatures();
|
||||||
void connectToHost(const QString &hostname, unsigned int port);
|
void connectToHost(const QString &hostname, unsigned int port);
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,9 @@ void TabDeckEditor::createDeckDock()
|
||||||
lowerLayout->addWidget(deckView, 1, 0, 1, 5);
|
lowerLayout->addWidget(deckView, 1, 0, 1, 5);
|
||||||
|
|
||||||
// Create widgets for both layouts to make splitter work correctly
|
// Create widgets for both layouts to make splitter work correctly
|
||||||
QWidget *topWidget = new QWidget;
|
auto *topWidget = new QWidget;
|
||||||
topWidget->setLayout(upperLayout);
|
topWidget->setLayout(upperLayout);
|
||||||
QWidget *bottomWidget = new QWidget;
|
auto *bottomWidget = new QWidget;
|
||||||
bottomWidget->setLayout(lowerLayout);
|
bottomWidget->setLayout(lowerLayout);
|
||||||
|
|
||||||
auto *split = new QSplitter;
|
auto *split = new QSplitter;
|
||||||
|
@ -163,7 +163,7 @@ void TabDeckEditor::createDeckDock()
|
||||||
deckDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
deckDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
deckDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
deckDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
||||||
QDockWidget::DockWidgetMovable);
|
QDockWidget::DockWidgetMovable);
|
||||||
QWidget *deckDockContents = new QWidget();
|
auto *deckDockContents = new QWidget();
|
||||||
deckDockContents->setObjectName("deckDockContents");
|
deckDockContents->setObjectName("deckDockContents");
|
||||||
deckDockContents->setLayout(rightFrame);
|
deckDockContents->setLayout(rightFrame);
|
||||||
deckDock->setWidget(deckDockContents);
|
deckDock->setWidget(deckDockContents);
|
||||||
|
@ -187,7 +187,7 @@ void TabDeckEditor::createCardInfoDock()
|
||||||
cardInfoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
cardInfoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
cardInfoDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
cardInfoDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
||||||
QDockWidget::DockWidgetMovable);
|
QDockWidget::DockWidgetMovable);
|
||||||
QWidget *cardInfoDockContents = new QWidget();
|
auto *cardInfoDockContents = new QWidget();
|
||||||
cardInfoDockContents->setObjectName("cardInfoDockContents");
|
cardInfoDockContents->setObjectName("cardInfoDockContents");
|
||||||
cardInfoDockContents->setLayout(cardInfoFrame);
|
cardInfoDockContents->setLayout(cardInfoFrame);
|
||||||
cardInfoDock->setWidget(cardInfoDockContents);
|
cardInfoDock->setWidget(cardInfoDockContents);
|
||||||
|
@ -249,7 +249,7 @@ void TabDeckEditor::createFiltersDock()
|
||||||
|
|
||||||
filterDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
filterDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable |
|
||||||
QDockWidget::DockWidgetMovable);
|
QDockWidget::DockWidgetMovable);
|
||||||
QWidget *filterDockContents = new QWidget(this);
|
auto *filterDockContents = new QWidget(this);
|
||||||
filterDockContents->setObjectName("filterDockContents");
|
filterDockContents->setObjectName("filterDockContents");
|
||||||
filterDockContents->setLayout(filterFrame);
|
filterDockContents->setLayout(filterFrame);
|
||||||
filterDock->setWidget(filterDockContents);
|
filterDock->setWidget(filterDockContents);
|
||||||
|
@ -475,7 +475,7 @@ void TabDeckEditor::databaseCustomMenu(QPoint point)
|
||||||
relatedMenu->setDisabled(true);
|
relatedMenu->setDisabled(true);
|
||||||
} else {
|
} else {
|
||||||
for (const CardRelation *rel : relatedCards) {
|
for (const CardRelation *rel : relatedCards) {
|
||||||
QString relatedCardName = rel->getName();
|
const QString &relatedCardName = rel->getName();
|
||||||
QAction *relatedCard = relatedMenu->addAction(relatedCardName);
|
QAction *relatedCard = relatedMenu->addAction(relatedCardName);
|
||||||
connect(relatedCard, &QAction::triggered, cardInfo,
|
connect(relatedCard, &QAction::triggered, cardInfo,
|
||||||
[this, relatedCardName] { cardInfo->setCard(relatedCardName); });
|
[this, relatedCardName] { cardInfo->setCard(relatedCardName); });
|
||||||
|
@ -874,7 +874,7 @@ void TabDeckEditor::actSaveDeckToClipboardRaw()
|
||||||
|
|
||||||
void TabDeckEditor::actPrintDeck()
|
void TabDeckEditor::actPrintDeck()
|
||||||
{
|
{
|
||||||
QPrintPreviewDialog *dlg = new QPrintPreviewDialog(this);
|
auto *dlg = new QPrintPreviewDialog(this);
|
||||||
connect(dlg, SIGNAL(paintRequested(QPrinter *)), deckModel, SLOT(printDeckList(QPrinter *)));
|
connect(dlg, SIGNAL(paintRequested(QPrinter *)), deckModel, SLOT(printDeckList(QPrinter *)));
|
||||||
dlg->exec();
|
dlg->exec();
|
||||||
}
|
}
|
||||||
|
@ -932,8 +932,9 @@ void TabDeckEditor::actClearFilterAll()
|
||||||
void TabDeckEditor::actClearFilterOne()
|
void TabDeckEditor::actClearFilterOne()
|
||||||
{
|
{
|
||||||
QModelIndexList selIndexes = filterView->selectionModel()->selectedIndexes();
|
QModelIndexList selIndexes = filterView->selectionModel()->selectedIndexes();
|
||||||
foreach (QModelIndex idx, selIndexes)
|
for (QModelIndex idx : selIndexes) {
|
||||||
filterModel->removeRow(idx.row(), idx.parent());
|
filterModel->removeRow(idx.row(), idx.parent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::recursiveExpand(const QModelIndex &index)
|
void TabDeckEditor::recursiveExpand(const QModelIndex &index)
|
||||||
|
@ -1248,7 +1249,7 @@ void TabDeckEditor::showSearchSyntaxHelp()
|
||||||
.replace(QRegularExpression("^(##)(.*)", opts), "<h2>\\2</h2>")
|
.replace(QRegularExpression("^(##)(.*)", opts), "<h2>\\2</h2>")
|
||||||
.replace(QRegularExpression("^(#)(.*)", opts), "<h1>\\2</h1>")
|
.replace(QRegularExpression("^(#)(.*)", opts), "<h1>\\2</h1>")
|
||||||
.replace(QRegularExpression("^------*", opts), "<hr />")
|
.replace(QRegularExpression("^------*", opts), "<hr />")
|
||||||
.replace(QRegularExpression("\\[([^\[]+)\\]\\(([^\\)]+)\\)", opts), "<a href=\'\\2\'>\\1</a>");
|
.replace(QRegularExpression(R"(\[([^[]+)\]\(([^\)]+)\))", opts), R"(<a href='\2'>\1</a>)");
|
||||||
|
|
||||||
auto browser = new QTextBrowser;
|
auto browser = new QTextBrowser;
|
||||||
browser->setParent(this, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint |
|
browser->setParent(this, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint |
|
||||||
|
@ -1261,6 +1262,6 @@ void TabDeckEditor::showSearchSyntaxHelp()
|
||||||
browser->document()->setDefaultStyleSheet(sheet);
|
browser->document()->setDefaultStyleSheet(sheet);
|
||||||
|
|
||||||
browser->setHtml(text);
|
browser->setHtml(text);
|
||||||
connect(browser, &QTextBrowser::anchorClicked, [=](QUrl link) { searchEdit->setText(link.fragment()); });
|
connect(browser, &QTextBrowser::anchorClicked, [=](const QUrl &link) { searchEdit->setText(link.fragment()); });
|
||||||
browser->show();
|
browser->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
|
||||||
avatarLabel.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
avatarLabel.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
avatarLabel.setAlignment(Qt::AlignCenter);
|
avatarLabel.setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
QHBoxLayout *avatarLayout = new QHBoxLayout;
|
auto *avatarLayout = new QHBoxLayout;
|
||||||
avatarLayout->setContentsMargins(0, 0, 0, 0);
|
avatarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
avatarLayout->addStretch(1);
|
avatarLayout->addStretch(1);
|
||||||
avatarLayout->addWidget(&avatarLabel, 3);
|
avatarLayout->addWidget(&avatarLabel, 3);
|
||||||
avatarLayout->addStretch(1);
|
avatarLayout->addStretch(1);
|
||||||
|
|
||||||
QGridLayout *mainLayout = new QGridLayout;
|
auto *mainLayout = new QGridLayout;
|
||||||
mainLayout->addLayout(avatarLayout, 0, 0, 1, 3);
|
mainLayout->addLayout(avatarLayout, 0, 0, 1, 3);
|
||||||
mainLayout->addWidget(&nameLabel, 1, 0, 1, 3);
|
mainLayout->addWidget(&nameLabel, 1, 0, 1, 3);
|
||||||
mainLayout->addWidget(&realNameLabel1, 2, 0, 1, 1);
|
mainLayout->addWidget(&realNameLabel1, 2, 0, 1, 1);
|
||||||
|
@ -53,7 +53,7 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
|
||||||
mainLayout->setColumnStretch(2, 10);
|
mainLayout->setColumnStretch(2, 10);
|
||||||
|
|
||||||
if (editable) {
|
if (editable) {
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
auto *buttonsLayout = new QHBoxLayout;
|
||||||
buttonsLayout->addWidget(&editButton);
|
buttonsLayout->addWidget(&editButton);
|
||||||
buttonsLayout->addWidget(&passwordButton);
|
buttonsLayout->addWidget(&passwordButton);
|
||||||
buttonsLayout->addWidget(&avatarButton);
|
buttonsLayout->addWidget(&avatarButton);
|
||||||
|
@ -85,10 +85,11 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
|
||||||
{
|
{
|
||||||
const UserLevelFlags userLevel(user.user_level());
|
const UserLevelFlags userLevel(user.user_level());
|
||||||
|
|
||||||
const std::string bmp = user.avatar_bmp();
|
const std::string &bmp = user.avatar_bmp();
|
||||||
if (!avatarPixmap.loadFromData((const uchar *)bmp.data(), bmp.size()))
|
if (!avatarPixmap.loadFromData((const uchar *)bmp.data(), static_cast<uint>(bmp.size()))) {
|
||||||
avatarPixmap =
|
avatarPixmap =
|
||||||
UserLevelPixmapGenerator::generatePixmap(64, userLevel, false, QString::fromStdString(user.privlevel()));
|
UserLevelPixmapGenerator::generatePixmap(64, userLevel, false, QString::fromStdString(user.privlevel()));
|
||||||
|
}
|
||||||
avatarLabel.setPixmap(avatarPixmap.scaled(400, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
avatarLabel.setPixmap(avatarPixmap.scaled(400, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
|
||||||
nameLabel.setText(QString::fromStdString(user.name()));
|
nameLabel.setText(QString::fromStdString(user.name()));
|
||||||
|
|
Loading…
Reference in a new issue