Skip to content

Commit

Permalink
remove recent tx for asset tab, make reference image bigger, link und…
Browse files Browse the repository at this point in the history
…isplayable image to gateway
  • Loading branch information
npq7721 committed Aug 15, 2024
1 parent 0274f0d commit 16af804
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ build-aux/compile
build-aux/test-driver
config.log
config.status
config.status.old
configure
libtool
src/config/raptoreum-config.h
Expand Down
5 changes: 3 additions & 2 deletions src/dashbls/config.status.old
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ $config_commands
Report bugs to the package provider."

ac_cs_config="'--disable-option-checking' '--prefix=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu' '--disable-tests' '--disable-shared' '--with-pic' '--enable-benchmark=no' '--enable-module-recovery' '--enable-module-schnorrsig' '--cache-file=/dev/null' '--srcdir=.' 'PKG_CONFIG_PATH=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/share/pkgconfig:/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig'"
ac_cs_config="'--disable-option-checking' '--prefix=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu' '--disable-tests' '--enable-debug' '--disable-shared' '--with-pic' '--enable-benchmark=no' '--enable-module-recovery' '--enable-module-schnorrsig' '--cache-file=/dev/null' '--srcdir=.' 'PKG_CONFIG_PATH=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/share/pkgconfig:/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig'"
ac_cs_version="\
libdashbls config.status 1.3.0
configured by ./configure, generated by GNU Autoconf 2.69,
Expand Down Expand Up @@ -519,7 +519,7 @@ if $ac_cs_silent; then
fi

if $ac_cs_recheck; then
set X /bin/bash './configure' '--disable-option-checking' '--prefix=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu' '--disable-tests' '--disable-shared' '--with-pic' '--enable-benchmark=no' '--enable-module-recovery' '--enable-module-schnorrsig' '--cache-file=/dev/null' '--srcdir=.' 'PKG_CONFIG_PATH=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/share/pkgconfig:/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' $ac_configure_extra_args --no-create --no-recursion
set X /bin/bash './configure' '--disable-option-checking' '--prefix=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu' '--disable-tests' '--enable-debug' '--disable-shared' '--with-pic' '--enable-benchmark=no' '--enable-module-recovery' '--enable-module-schnorrsig' '--cache-file=/dev/null' '--srcdir=.' 'PKG_CONFIG_PATH=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/share/pkgconfig:/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/home/tri/workspace/raptoreum/depends/x86_64-pc-linux-gnu/lib/pkgconfig' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
CONFIG_SHELL='/bin/bash'
Expand Down Expand Up @@ -1227,6 +1227,7 @@ D["LWREG"]=" 5"
D["BRUCH"]=" 6"
D["CTAIA"]=" 7"
D["LOWER"]=" 8"
D["DEBUG"]=" 1"
D["QUIET"]=" 1"
D["COLOR"]=" 1"
D["ARCH"]=" X64"
Expand Down
29 changes: 11 additions & 18 deletions src/qt/assetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/assetsdialog.h>
#include <qt/forms/ui_assetsdialog.h>
//#include <qt/upload_download.h>
#include <qt/uploaddownload.h>
//#include <qt/httpclient.h>

#include <chainparams.h>
#include <qt/clientmodel.h>
Expand Down Expand Up @@ -56,8 +54,8 @@ AssetsDialog::AssetsDialog(QWidget *parent) :
ui(new Ui::AssetsDialog) {
ui->setupUi(this);

GUIUtil::setFont({ui->label_filter_2, ui->assetinfolabel, ui->recentlabel}, GUIUtil::FontWeight::Bold, 16);
GUIUtil::setFont({ui->label_6, ui->label_4, ui->label_3, ui->label_4, ui->label_5,
GUIUtil::setFont({ui->label_filter_2, ui->assetinfolabel}, GUIUtil::FontWeight::Bold, 16);
GUIUtil::setFont({ui->label_6, ui->label_4, ui->label_3, ui->label_4, ui->label_5, ui->referenceLabel,
ui->errorLabel}, GUIUtil::FontWeight::Bold, 14);
GUIUtil::setFont({ui->idTextLablel, ui->nameTextLabel, ui->typeLabel,
ui->suplyTextLabel}, GUIUtil::FontWeight::Normal, 14);
Expand Down Expand Up @@ -89,9 +87,6 @@ AssetsDialog::AssetsDialog(QWidget *parent) :
connect(ui->tableWidgetAssets, &QTableWidget::doubleClicked, this, &AssetsDialog::Asset_details_clicked);
connect(sendAssetAction, &QAction::triggered, this, &AssetsDialog::SendAsset_clicked);
connect(detailsAction, &QAction::triggered, this, &AssetsDialog::Asset_details_clicked);
connect(ui->referenceDisplay, SIGNAL(clicked()), this, SLOT(showFulRefImage()));
connect(ui->referenceLabel, SIGNAL(clicked(const QString& text)), this, SLOT(showFulRefImage()));
//connect(ui->referenceDisplay, &QLabel::mouseReleaseEvent, this, &AssetsDialog::showFulRefImage());
timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &AssetsDialog::updateAssetBalanceScheduled);
timer->start(1000);
Expand All @@ -101,6 +96,7 @@ AssetsDialog::AssetsDialog(QWidget *parent) :
ui->errorLabel->setVisible(false);
ui->errorTextLabel->setVisible(false);
ui->errorTextLabel->setStyleSheet(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_INVALID));
ui->referenceDisplay->setCursor(Qt::PointingHandCursor);

GUIUtil::updateFonts();
}
Expand Down Expand Up @@ -316,35 +312,32 @@ void AssetsDialog::on_updateButton_clicked() {

void AssetsDialog::displayImage(const std::string& cid) {
ui->referenceDisplay->clear();
if(cid.empty()) {
if(cid.empty() || cid.length() < 46 || cid.compare(0, 2, "Qm")) {
ui->referenceLabel->hide();
ui->referenceDisplay->hide();
} else {
ui->referenceLabel->show();
ui->referenceDisplay->show();
// HttpClient httpClient;
// httpClient.sendGetRequest(cid, [this, cid](const QByteArray& data) {
// printf("data size %d\n", data.size());
// });
std::string response_data;
//downloadFile(cid, response_data);
download(cid, response_data);
printf("size %ld\n", response_data.size());
QByteArray imageData = QByteArray::fromRawData(response_data.data(), response_data.size());
QBuffer buffer(&imageData);
buffer.open(QIODevice::ReadOnly);
bool isLoaded = currentRefImage.load(&buffer, nullptr);

if(isLoaded) {
int displayWidth = ui->referenceDisplay->width() < currentRefImage.width() ? ui->referenceDisplay->width() : currentRefImage.width();
int displayHeight = currentRefImage.height() > 40 ? 40 : currentRefImage.height();
int displayHeight = currentRefImage.height() > 260 ? 260 : currentRefImage.height();
QPixmap pixmap = QPixmap::fromImage(currentRefImage.scaled(displayWidth, displayHeight, Qt::KeepAspectRatio));
ui->referenceDisplay->setPixmap(pixmap);
ui->referenceDisplay->setCursor(Qt::PointingHandCursor);
ui->referenceDisplay->setToolTip(QString::fromStdString(cid));
ui->referenceDisplay->setOpenExternalLinks(false);
} else {
ui->referenceDisplay->setText(QString::fromStdString(cid));
ui->referenceDisplay->unsetCursor();
std::string displayUrl = "<a href=\"" + IPFS_GATEWAY_URL + cid + "\">" + cid + "</a>";
ui->referenceDisplay->setText(QString::fromStdString(displayUrl));
ui->referenceDisplay->setToolTip("");
ui->referenceDisplay->setOpenExternalLinks(true);

}

}
Expand Down
2 changes: 0 additions & 2 deletions src/qt/createassetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/sendassetsentry.h>
//#include <qt/upload_download.h>
#include <qt/uploaddownload.h>

#include <chainparams.h>
Expand Down Expand Up @@ -800,7 +799,6 @@ void CreateAssetsDialog::CoinControlUpdateLabels() {
}

void CreateAssetsDialog::openFilePicker() {
//std::string cid = pickAndSendFileForIpfs(this);
std::string cid;
pickAndUploadFileForIpfs(this, cid);
ui->ipfsText->setText(QString::fromStdString(cid));
Expand Down
32 changes: 5 additions & 27 deletions src/qt/forms/assetsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0">
<item>
<widget class="QFrame" name="detailframe">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -339,6 +339,9 @@
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -375,31 +378,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="recentlabel">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<bold>true</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Recent transactions</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
Expand Down
1 change: 0 additions & 1 deletion src/qt/updateassetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/sendassetsentry.h>
//#include <qt/upload_download.h>
#include <qt/uploaddownload.h>

#include <chainparams.h>
Expand Down
1 change: 1 addition & 0 deletions src/qt/uploaddownload.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
static std::string GET_URI = "/get/";
static std::string UPLOAD_URI = "/upload";
static std::string IPFS_SERVICE_HOST = gArgs.GetArg("-ipfsservice", "ipfsm.raptoreum.com");
static std::string IPFS_GATEWAY_URL = gArgs.GetArg("-ipfsgateway", "https://ipfsweb.raptoreum.com/ipfs/")

void download(const std::string cid, std::string& response_data);
void upload(const std::string& file_path, std::string& response_data);
Expand Down

0 comments on commit 16af804

Please sign in to comment.