Changed branding keynames + minor fixes
This commit is contained in:
parent
186c065b4c
commit
b4078f3634
@ -220,17 +220,14 @@ slideshowAPI: 2
|
||||
|
||||
|
||||
# These options are to customize online uploading of logs to pastebins:
|
||||
# - style : Defines the kind of pastebin service to be used. ie it can
|
||||
# provide the functionality of controlling privacy of
|
||||
# paste (in future).Currently only "fiche" servers
|
||||
# are supported. Takes string as input
|
||||
# - type : Defines the kind of pastebin service to be used.Currently
|
||||
# it accepts two values:
|
||||
# - none : disables the pastebin functionality
|
||||
# - fiche : use fiche pastebin server
|
||||
# - url : Defines the address of pastebin service to be used.
|
||||
# Takes string as input
|
||||
# - port : Defines the port number to be used to send logs. Takes
|
||||
# integer as input
|
||||
# - enable : Defines if the functionality is to be used or not. Takes
|
||||
# bool as input
|
||||
logUpload.style : "fiche"
|
||||
logUpload.url : "termbin.com"
|
||||
logUpload.port : 9999
|
||||
logUpload.enable : true
|
||||
uploadServer.type : "fiche"
|
||||
uploadServer.url : "termbin.com"
|
||||
uploadServer.port : 9999
|
||||
|
@ -87,7 +87,6 @@ const QStringList Branding::s_styleEntryStrings =
|
||||
"sidebarTextSelect",
|
||||
"sidebarTextHighlight"
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
// *INDENT-ON*
|
||||
|
||||
@ -513,10 +512,9 @@ 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" );
|
||||
m_uploadServerURL = getString( doc, "uploadServer.url" );
|
||||
m_uploadServerPort = doc[ "uploadServer.port" ].as< int >();
|
||||
m_uploadServerType = getString( doc, "uploadServer.type" );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -218,10 +218,9 @@ public:
|
||||
|
||||
|
||||
//Paste functionality related
|
||||
bool logUploadEnable() { return m_logUploadEnable; };
|
||||
QString logUploadURL() { return m_logUploadURL; };
|
||||
int logUploadPort() { return m_logUploadPort; };
|
||||
QString logUploadStyle() { return m_logUploadStyle; };
|
||||
QString uploadServerType() { return m_uploadServerType; };
|
||||
QString uploadServerURL() { return m_uploadServerURL; };
|
||||
int uploadServerPort() { return m_uploadServerPort; };
|
||||
|
||||
public slots:
|
||||
QString string( StringEntry stringEntry ) const;
|
||||
@ -270,10 +269,9 @@ private:
|
||||
bool m_welcomeStyleCalamares;
|
||||
bool m_welcomeExpandingLogo;
|
||||
|
||||
bool m_logUploadEnable;
|
||||
QString m_logUploadURL;
|
||||
int m_logUploadPort;
|
||||
QString m_logUploadStyle;
|
||||
QString m_uploadServerType;
|
||||
QString m_uploadServerURL;
|
||||
int m_uploadServerPort;
|
||||
|
||||
WindowExpansion m_windowExpansion;
|
||||
WindowDimension m_windowHeight, m_windowWidth;
|
||||
|
@ -141,7 +141,8 @@ ViewManager::insertViewStep( int before, ViewStep* step )
|
||||
void
|
||||
ViewManager::onInstallationFailed( const QString& message, const QString& details )
|
||||
{
|
||||
bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable();
|
||||
QString UploadServerType = Calamares::Branding::instance()->uploadServerType();
|
||||
bool shouldOfferWebPaste = CalamaresUtils::UploadServersList.contains( UploadServerType );
|
||||
|
||||
cError() << "Installation failed:";
|
||||
cDebug() << "- message:" << message;
|
||||
@ -184,9 +185,16 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
|
||||
connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) {
|
||||
if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole )
|
||||
{
|
||||
QString pasteURLHost = Calamares::Branding::instance()->logUploadURL();
|
||||
int pasteURLPort = Calamares::Branding::instance()->logUploadPort();
|
||||
QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, pasteURLHost, pasteURLPort );
|
||||
QString pasteUrlMsg;
|
||||
QString UploadServerType = Calamares::Branding::instance()->uploadServerType();
|
||||
if ( UploadServerType == "fiche" )
|
||||
{
|
||||
pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox );
|
||||
}
|
||||
else
|
||||
{
|
||||
pasteUrlMsg = QString();
|
||||
}
|
||||
|
||||
QString pasteUrlTitle = tr( "Install Log Paste URL" );
|
||||
if ( pasteUrlMsg.isEmpty() )
|
||||
@ -532,9 +540,13 @@ ViewManager::updateCancelEnabled( bool enabled )
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::updateBackAndNextVisibility( bool visible ) { UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) }
|
||||
ViewManager::updateBackAndNextVisibility( bool visible )
|
||||
{
|
||||
UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible )
|
||||
}
|
||||
|
||||
QVariant ViewManager::data( const QModelIndex& index, int role ) const
|
||||
QVariant
|
||||
ViewManager::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Paste.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QFile>
|
||||
@ -17,13 +18,24 @@
|
||||
#include <QUrl>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include <QStringList>
|
||||
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
|
||||
QStringList UploadServersList = {
|
||||
"fiche"
|
||||
// In future more serverTypes can be added as Calamares support them
|
||||
// "none" serverType is explicitly not mentioned here
|
||||
};
|
||||
|
||||
QString
|
||||
sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort )
|
||||
sendLogToPastebin( QObject* parent )
|
||||
{
|
||||
|
||||
const QString& ficheHost = Calamares::Branding::instance()->uploadServerURL();
|
||||
quint16 fichePort = Calamares::Branding::instance()->uploadServerPort();
|
||||
|
||||
QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" );
|
||||
|
||||
QFile pasteSourceFile( Logger::logFile() );
|
||||
@ -81,6 +93,8 @@ sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort
|
||||
QRegularExpression pasteUrlRegex( "^http[s]?://" + ficheHost );
|
||||
QString pasteUrlMsg = QString( pasteUrlFmt ).arg( pasteUrlStr );
|
||||
|
||||
if ( nBytesRead >= 8 && pasteUrl.isValid() && pasteUrlRegex.match( pasteUrlStr ).hasMatch() )
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(pasteUrlStr, QClipboard::Clipboard);
|
||||
|
||||
@ -88,8 +102,8 @@ sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort
|
||||
{
|
||||
clipboard->setText(pasteUrlStr, QClipboard::Selection);
|
||||
}
|
||||
|
||||
if ( nBytesRead < 8 || !pasteUrl.isValid() || !pasteUrlRegex.match( pasteUrlStr ).hasMatch() )
|
||||
}
|
||||
else
|
||||
{
|
||||
cError() << "No data from paste server";
|
||||
return QString();
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef UTILS_PASTE_H
|
||||
#define UTILS_PASTE_H
|
||||
|
||||
#include <qglobal.h> // for quint16
|
||||
#include<QStringList>
|
||||
|
||||
class QObject;
|
||||
class QString;
|
||||
@ -22,7 +22,9 @@ namespace CalamaresUtils
|
||||
*
|
||||
* Returns the (string) URL that the pastebin gives us.
|
||||
*/
|
||||
QString sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort );
|
||||
QString sendLogToPastebin( QObject* parent );
|
||||
|
||||
extern QStringList UploadServersList;
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user