Add Download button in new version available dialog on Windows; Fix AltGr on Windows (fixes input of selected multiplication sign using asterisk input with AltGr); Fix text size of previous result when history item is moved to top

This commit is contained in:
Hanna K. 2024-04-07 10:55:14 +02:00
parent e4b4836ab9
commit 806d97846c
3 changed files with 26 additions and 1 deletions

View File

@ -855,6 +855,10 @@ void HistoryView::editMoveToTop() {
replace_one(s_text, "border-top: 0px none", "border-top: 1px dashed");
PASTE_H
replace_one(s_text, "padding-top: 0px", "padding-top: " + QString::number(paste_h / 2) + "px");
if(settings->format_result) {
s_text.remove("; font-size:x-large");
s_text.remove("; font-size:large");
}
if(index1 > 0) new_text += s_text.left(index1);
if(index2 >= 0) new_text += s_text.mid(index2);
s_text = new_text;

View File

@ -47,6 +47,12 @@ QTranslator translator, translator_qt, translator_qtbase;
int main(int argc, char **argv) {
#ifdef _WIN32
if(!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
qputenv("QT_QPA_PLATFORM", "windows:altgr");
}
#endif
QApplication app(argc, argv);
app.setApplicationName("qalculate-qt");
app.setApplicationDisplayName("Qalculate!");

View File

@ -15,11 +15,13 @@
#include <QPalette>
#include <QStyle>
#include <QStyleFactory>
#include <QDesktopServices>
#include <QWidget>
#include <QMessageBox>
#include <QKeyEvent>
#include <QColor>
#include <QProgressDialog>
#include <QPushButton>
#include <QKeySequence>
#if defined _WIN32 && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
# include <QStyleHints>
@ -1905,7 +1907,8 @@ void QalculateQtSettings::checkVersion(bool force, QWidget *parent) {
}
std::string new_version;
#ifdef _WIN32
int ret = checkAvailableVersion("windows", qApp->applicationVersion().toUtf8().data(), &new_version, force ? 10 : 5);
std::string url;
int ret = checkAvailableVersion("windows", qApp->applicationVersion().toUtf8().data(), &new_version, &url, force ? 10 : 5);
#else
int ret = checkAvailableVersion("qalculate-qt", qApp->applicationVersion().toUtf8().data(), &new_version, force ? 10 : 5);
#endif
@ -1921,7 +1924,19 @@ void QalculateQtSettings::checkVersion(bool force, QWidget *parent) {
autoUpdate(new_version);
}
#else
# ifdef _WIN32
QMessageBox *dialog = new QMessageBox(QMessageBox::Information, tr("Information"), "<div>" + tr("A new version of %1 is available.\n\nYou can get version %3 at %2.").arg("Qalculate!").arg("<a href=\"https://qalculate.github.io/downloads.html\">qalculate.github.io</a>").arg(QString::fromStdString(new_version)) + "</div>", QMessageBox::Ok, parent);
if(always_on_top) dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);
QAbstractButton *downloadButton = NULL;
if(!url.empty()) dialog->addButton(tr("Download"), QMessageBox::YesRole);
dialog->exec();
if(!url.empty() && dialog->clickedButton() == downloadButton) {
QDesktopServices::openUrl(QUrl(QString::fromStdString(url)));
}
dialog->deleteLater();
# else
QMessageBox::information(parent, tr("Information"), "<div>" + tr("A new version of %1 is available.\n\nYou can get version %3 at %2.").arg("Qalculate!").arg("<a href=\"https://qalculate.github.io/downloads.html\">qalculate.github.io</a>").arg(QString::fromStdString(new_version)) + "</div>");
# endif
#endif
}
last_version_check_date.setToCurrentDate();