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