Redirecting logUpload vars to pasteUtility

This commit is contained in:
Anubhav Choudhary 2021-01-23 20:47:33 +05:30
parent f6cb879929
commit ff66e4b3d5
3 changed files with 23 additions and 3 deletions

View File

@ -86,6 +86,7 @@ const QStringList Branding::s_styleEntryStrings =
"sidebarTextSelect",
"sidebarTextHighlight"
};
// clang-format on
// *INDENT-ON*
@ -510,6 +511,11 @@ Branding::initSimpleSettings( const YAML::Node& doc )
{
m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies );
}
m_logUploadEnable = doc[ "logUpload.enable" ].as< bool >( false );
m_logUploadURL = getString( doc, "logUpload.url") ;
m_logUploadPort = doc[ "logUpload.port" ].as< int >();
m_logUploadStyle= getString(doc, "logUpload.style" );
}
void

View File

@ -42,6 +42,7 @@ public:
* e.g. *Branding::ProductName to get the string value for
* the product name.
*/
enum StringEntry
{
ProductName,
@ -214,6 +215,13 @@ public:
*/
void setGlobals( GlobalStorage* globalStorage ) const;
//Paste functionality related
bool logUploadEnable() { return m_logUploadEnable; };
QString logUploadURL() { return m_logUploadURL; };
int logUploadPort() { return m_logUploadPort; };
QString logUploadStyle() { return m_logUploadStyle; };
public slots:
QString string( StringEntry stringEntry ) const;
QString versionedName() const { return string( VersionedName ); }
@ -261,6 +269,11 @@ private:
bool m_welcomeStyleCalamares;
bool m_welcomeExpandingLogo;
bool m_logUploadEnable;
QString m_logUploadURL;
int m_logUploadPort;
QString m_logUploadStyle;
WindowExpansion m_windowExpansion;
WindowDimension m_windowHeight, m_windowWidth;
WindowPlacement m_windowPlacement;

View File

@ -140,7 +140,7 @@ ViewManager::insertViewStep( int before, ViewStep* step )
void
ViewManager::onInstallationFailed( const QString& message, const QString& details )
{
bool shouldOfferWebPaste = false; // TODO: config var
bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable(); // TODO: config var
cError() << "Installation failed:";
cDebug() << "- message:" << message;
@ -183,8 +183,9 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) {
if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole )
{
// TODO: host and port should be configurable
QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, QStringLiteral( "termbin.com" ), 9999 );
QString pasteURLHost = Calamares::Branding::instance()->logUploadURL();
int pasteURLPort = Calamares::Branding::instance()->logUploadPort();
QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, pasteURLHost, pasteURLPort );
QString pasteUrlTitle = tr( "Install Log Paste URL" );
if ( pasteUrlMsg.isEmpty() )