Merge branch 'shuffle-error-dialog' into calamares
This commit is contained in:
commit
79ae3cd00f
@ -162,14 +162,15 @@ uploadServerFromMap( const QVariantMap& map )
|
|||||||
|
|
||||||
if ( typestring.isEmpty() || urlstring.isEmpty() )
|
if ( typestring.isEmpty() || urlstring.isEmpty() )
|
||||||
{
|
{
|
||||||
return Branding::UploadServerInfo( Branding::UploadServerType::None, QUrl(), 0 );
|
return Branding::UploadServerInfo { Branding::UploadServerType::None, QUrl(), 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bogus = false; // we don't care about type-name lookup success here
|
bool bogus = false; // we don't care about type-name lookup success here
|
||||||
return Branding::UploadServerInfo(
|
return Branding::UploadServerInfo {
|
||||||
names.find( typestring, bogus ),
|
names.find( typestring, bogus ),
|
||||||
QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
|
QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
|
||||||
sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1 );
|
sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Load the @p map with strings from @p config
|
/** @brief Load the @p map with strings from @p config
|
||||||
|
@ -227,7 +227,14 @@ public:
|
|||||||
* is irrelevant and usually empty), the URL for the upload and the size limit of upload
|
* is irrelevant and usually empty), the URL for the upload and the size limit of upload
|
||||||
* in bytes (for configuration value < 0, it serves -1, which stands for having no limit).
|
* in bytes (for configuration value < 0, it serves -1, which stands for having no limit).
|
||||||
*/
|
*/
|
||||||
using UploadServerInfo = std::tuple< UploadServerType, QUrl, qint64 >;
|
struct UploadServerInfo
|
||||||
|
{
|
||||||
|
UploadServerType type;
|
||||||
|
QUrl url;
|
||||||
|
qint64 size;
|
||||||
|
|
||||||
|
operator bool() const { return type != Calamares::Branding::UploadServerType::None && size != 0; }
|
||||||
|
};
|
||||||
UploadServerInfo uploadServer() const { return m_uploadServer; }
|
UploadServerInfo uploadServer() const { return m_uploadServer; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,6 @@ set( calamaresui_SOURCES
|
|||||||
utils/CalamaresUtilsGui.cpp
|
utils/CalamaresUtilsGui.cpp
|
||||||
utils/ImageRegistry.cpp
|
utils/ImageRegistry.cpp
|
||||||
utils/Paste.cpp
|
utils/Paste.cpp
|
||||||
utils/ErrorDialog/ErrorDialog.cpp
|
|
||||||
|
|
||||||
viewpages/BlankViewStep.cpp
|
viewpages/BlankViewStep.cpp
|
||||||
viewpages/ExecutionViewStep.cpp
|
viewpages/ExecutionViewStep.cpp
|
||||||
@ -28,6 +27,7 @@ set( calamaresui_SOURCES
|
|||||||
viewpages/ViewStep.cpp
|
viewpages/ViewStep.cpp
|
||||||
|
|
||||||
widgets/ClickableLabel.cpp
|
widgets/ClickableLabel.cpp
|
||||||
|
widgets/ErrorDialog.cpp
|
||||||
widgets/FixedAspectRatioLabel.cpp
|
widgets/FixedAspectRatioLabel.cpp
|
||||||
widgets/PrettyRadioButton.cpp
|
widgets/PrettyRadioButton.cpp
|
||||||
widgets/TranslationFix.cpp
|
widgets/TranslationFix.cpp
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
#include "utils/ErrorDialog/ErrorDialog.h"
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Paste.h"
|
#include "utils/Paste.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
@ -25,6 +24,7 @@
|
|||||||
#include "viewpages/BlankViewStep.h"
|
#include "viewpages/BlankViewStep.h"
|
||||||
#include "viewpages/ExecutionViewStep.h"
|
#include "viewpages/ExecutionViewStep.h"
|
||||||
#include "viewpages/ViewStep.h"
|
#include "viewpages/ViewStep.h"
|
||||||
|
#include "widgets/ErrorDialog.h"
|
||||||
#include "widgets/TranslationFix.h"
|
#include "widgets/TranslationFix.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -152,10 +152,6 @@ ViewManager::insertViewStep( int before, ViewStep* step )
|
|||||||
void
|
void
|
||||||
ViewManager::onInstallationFailed( const QString& message, const QString& details )
|
ViewManager::onInstallationFailed( const QString& message, const QString& details )
|
||||||
{
|
{
|
||||||
bool shouldOfferWebPaste = std::get< 0 >( Calamares::Branding::instance()->uploadServer() )
|
|
||||||
!= Calamares::Branding::UploadServerType::None
|
|
||||||
and std::get< 2 >( Calamares::Branding::instance()->uploadServer() ) != 0;
|
|
||||||
|
|
||||||
cError() << "Installation failed:" << message;
|
cError() << "Installation failed:" << message;
|
||||||
cDebug() << Logger::SubEntry << "- message:" << message;
|
cDebug() << Logger::SubEntry << "- message:" << message;
|
||||||
cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details;
|
cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details;
|
||||||
@ -167,7 +163,7 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
|
|||||||
errorDialog->setWindowTitle( tr( "Error" ) );
|
errorDialog->setWindowTitle( tr( "Error" ) );
|
||||||
errorDialog->setHeading( "<strong>" + heading + "</strong>" );
|
errorDialog->setHeading( "<strong>" + heading + "</strong>" );
|
||||||
errorDialog->setInformativeText( message );
|
errorDialog->setInformativeText( message );
|
||||||
errorDialog->setShouldOfferWebPaste( shouldOfferWebPaste );
|
errorDialog->setShouldOfferWebPaste( Calamares::Branding::instance()->uploadServer() );
|
||||||
errorDialog->setDetails( details );
|
errorDialog->setDetails( details );
|
||||||
errorDialog->show();
|
errorDialog->show();
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
ErrorDialog::ErrorDialog( QWidget* parent )
|
ErrorDialog::ErrorDialog( QWidget* parent )
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
, ui( new Ui::ErrorDialog )
|
, ui( new Ui::ErrorDialog )
|
||||||
@ -33,7 +32,6 @@ ErrorDialog::~ErrorDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
ErrorDialog::heading() const
|
ErrorDialog::heading() const
|
||||||
{
|
{
|
||||||
@ -55,31 +53,32 @@ ErrorDialog::details() const
|
|||||||
void
|
void
|
||||||
ErrorDialog::setHeading( const QString& newHeading )
|
ErrorDialog::setHeading( const QString& newHeading )
|
||||||
{
|
{
|
||||||
if ( ui->headingLabel->text() == newHeading )
|
if ( ui->headingLabel->text() != newHeading )
|
||||||
return;
|
{
|
||||||
ui->headingLabel->setText( newHeading );
|
ui->headingLabel->setText( newHeading );
|
||||||
emit headingChanged();
|
emit headingChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ErrorDialog::setInformativeText( const QString& newInformativeText )
|
ErrorDialog::setInformativeText( const QString& newInformativeText )
|
||||||
{
|
{
|
||||||
if ( ui->informativeTextLabel->text() == newInformativeText )
|
if ( ui->informativeTextLabel->text() != newInformativeText )
|
||||||
return;
|
{
|
||||||
ui->informativeTextLabel->setText( newInformativeText );
|
ui->informativeTextLabel->setText( newInformativeText );
|
||||||
emit informativeTextChanged();
|
emit informativeTextChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ErrorDialog::setDetails( const QString& newDetails )
|
ErrorDialog::setDetails( const QString& newDetails )
|
||||||
{
|
{
|
||||||
if ( ui->detailsBrowser->toPlainText() == newDetails )
|
if ( ui->detailsBrowser->toPlainText() != newDetails )
|
||||||
return;
|
{
|
||||||
ui->detailsBrowser->setPlainText( newDetails );
|
ui->detailsBrowser->setPlainText( newDetails );
|
||||||
|
|
||||||
ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() );
|
ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() );
|
||||||
|
|
||||||
emit detailsChanged();
|
emit detailsChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -91,18 +90,17 @@ ErrorDialog::shouldOfferWebPaste() const
|
|||||||
void
|
void
|
||||||
ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste )
|
ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste )
|
||||||
{
|
{
|
||||||
if ( m_shouldOfferWebPaste == newShouldOfferWebPaste )
|
if ( m_shouldOfferWebPaste != newShouldOfferWebPaste )
|
||||||
return;
|
{
|
||||||
m_shouldOfferWebPaste = newShouldOfferWebPaste;
|
m_shouldOfferWebPaste = newShouldOfferWebPaste;
|
||||||
|
|
||||||
ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste );
|
ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste );
|
||||||
|
|
||||||
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No )
|
ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No )
|
||||||
: QDialogButtonBox::Close );
|
: QDialogButtonBox::Close );
|
||||||
|
|
||||||
fixButtonLabels( ui->buttonBox );
|
fixButtonLabels( ui->buttonBox );
|
||||||
|
|
||||||
emit shouldOfferWebPasteChanged();
|
emit shouldOfferWebPasteChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
@ -7,17 +7,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ERRORDIALOG_H
|
#ifndef LIBCALAMARESUI_ERRORDIALOG_H
|
||||||
#define ERRORDIALOG_H
|
#define LIBCALAMARESUI_ERRORDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class ErrorDialog;
|
class ErrorDialog;
|
||||||
}
|
}
|
||||||
class QDialogButtonBox;
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
class ErrorDialog : public QDialog
|
class ErrorDialog : public QDialog
|
||||||
@ -32,30 +31,46 @@ class ErrorDialog : public QDialog
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorDialog( QWidget* parent = nullptr );
|
explicit ErrorDialog( QWidget* parent = nullptr );
|
||||||
~ErrorDialog();
|
~ErrorDialog() override;
|
||||||
|
|
||||||
|
/** @brief The heading (title) of the error dialog
|
||||||
|
*
|
||||||
|
* This is a short (one-line) title. It is human-readable, so should
|
||||||
|
* be translated at the time it is set.
|
||||||
|
*/
|
||||||
QString heading() const;
|
QString heading() const;
|
||||||
|
|
||||||
QString informativeText() const;
|
|
||||||
|
|
||||||
QString details() const;
|
|
||||||
|
|
||||||
void setHeading( const QString& newHeading );
|
void setHeading( const QString& newHeading );
|
||||||
|
|
||||||
|
/** @brief The description of the problem
|
||||||
|
*
|
||||||
|
* Longer, human-readable, description of the problem. This text
|
||||||
|
* is word-wrapped as necessary.
|
||||||
|
*/
|
||||||
|
QString informativeText() const;
|
||||||
void setInformativeText( const QString& newInformativeText );
|
void setInformativeText( const QString& newInformativeText );
|
||||||
|
|
||||||
|
/** @brief Details of the problem
|
||||||
|
*
|
||||||
|
* This is generally command-output; it might not be translated
|
||||||
|
* when set. It should be considered "background to the informative
|
||||||
|
* text", or maybe "the reasons". Write the informative text for
|
||||||
|
* the end-user.
|
||||||
|
*/
|
||||||
|
QString details() const;
|
||||||
void setDetails( const QString& newDetails );
|
void setDetails( const QString& newDetails );
|
||||||
|
|
||||||
|
/** @brief Enable web-paste button
|
||||||
|
*
|
||||||
|
* The web-paste button can be configured at a global level,
|
||||||
|
* but each individual error dialog can be set separately.
|
||||||
|
*/
|
||||||
bool shouldOfferWebPaste() const;
|
bool shouldOfferWebPaste() const;
|
||||||
void setShouldOfferWebPaste( bool newShouldOfferWebPaste );
|
void setShouldOfferWebPaste( bool newShouldOfferWebPaste );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void headingChanged();
|
void headingChanged();
|
||||||
|
|
||||||
void informativeTextChanged();
|
void informativeTextChanged();
|
||||||
|
|
||||||
void detailsChanged();
|
void detailsChanged();
|
||||||
|
|
||||||
void shouldOfferWebPasteChanged();
|
void shouldOfferWebPasteChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -65,4 +80,4 @@ private:
|
|||||||
|
|
||||||
}; // namespace Calamares
|
}; // namespace Calamares
|
||||||
|
|
||||||
#endif // ERRORDIALOG_H
|
#endif // LIBCALAMARESUI_ERRORDIALOG_H
|
@ -11,11 +11,14 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string notr="true">Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="1">
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="headingLabel">
|
<widget class="QWidget" name="detailsWidget" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="informativeTextLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -27,9 +30,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QWidget" name="detailsWidget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -43,7 +43,29 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" rowspan="2">
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="offerWebPasteLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Would you like to paste the install log to the web?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0" colspan="2">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="iconLabel">
|
<widget class="QLabel" name="iconLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
@ -56,29 +78,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item>
|
||||||
<widget class="QLabel" name="informativeTextLabel">
|
<widget class="QLabel" name="headingLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
</layout>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Close</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="offerWebPasteLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Would you like to paste the install log to the web?</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
Loading…
Reference in New Issue
Block a user