More custom media for the connect dialog.

This commit is contained in:
Klaas Freitag 2012-07-26 11:01:43 +03:00
parent 0c89dd9555
commit 66d70c0835
6 changed files with 78 additions and 39 deletions

View file

@ -444,6 +444,8 @@ QVariant MirallConfigFile::customMedia( customMediaType type )
key = QLatin1String("oCSetupBottom");
} else if( type == oCSetupFixUrl ) {
key = QLatin1String("oCSetupFixUrl");
} else if( type == oCSetupResultTop ) {
key = QLatin1String("oCSetupResultTop");
} else {
qDebug() << "Wrong media type.";
}

View file

@ -28,10 +28,11 @@ public:
MirallConfigFile( const QString& appendix = QString() );
enum customMediaType {
oCSetupTop,
oCSetupTop, // ownCloud connect page
oCSetupSide,
oCSetupBottom,
oCSetupFixUrl
oCSetupFixUrl,
oCSetupResultTop // ownCloud connect result page
};
QString configPath() const;

View file

@ -53,7 +53,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="leUrl"/>
<widget class="QLineEdit" name="leUrl">
<property name="toolTip">
<string>Enter the url of the ownCloud you want to connect to (without http or https).</string>
</property>
</widget>
</item>
</layout>
</item>
@ -100,7 +104,11 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leUsername"/>
<widget class="QLineEdit" name="leUsername">
<property name="toolTip">
<string>Enter the ownCloud username.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
@ -129,6 +137,9 @@
</item>
<item>
<widget class="QCheckBox" name="cbNoPasswordStore">
<property name="toolTip">
<string>Do not allow the local storage of the password.</string>
</property>
<property name="text">
<string>&amp;do not store Password on local machine.</string>
</property>
@ -153,7 +164,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>344</width>
<height>19</height>
<height>1</height>
</size>
</property>
</spacer>

View file

@ -30,6 +30,26 @@
namespace Mirall
{
void setupCustomMedia( QVariant variant, QLabel *label )
{
if( ! label ) return;
QPixmap pix = variant.value<QPixmap>();
if( ! pix.isNull() ) {
label->setPixmap(pix);
label->setAlignment( Qt::AlignTop | Qt::AlignRight );
label->setVisible(true);
} else {
QString str = variant.toString();
if( !str.isEmpty() ) {
label->setText( str );
label->setTextFormat( Qt::RichText );
label->setVisible(true);
label->setOpenExternalLinks(true);
}
}
}
// ======================================================================
@ -108,26 +128,6 @@ void OwncloudSetupPage::setupCustomization()
}
}
void OwncloudSetupPage::setupCustomMedia( QVariant variant, QLabel *label )
{
if( ! label ) return;
QPixmap pix = variant.value<QPixmap>();
if( ! pix.isNull() ) {
label->setPixmap(pix);
label->setAlignment( Qt::AlignTop | Qt::AlignRight );
label->setVisible(true);
} else {
QString str = variant.toString();
if( !str.isEmpty() ) {
label->setText( str );
label->setTextFormat( Qt::RichText );
label->setVisible(true);
label->setOpenExternalLinks(true);
}
}
}
void OwncloudSetupPage::slotPwdStoreChanged( int state )
{
_ui.lePassword->setEnabled( state == Qt::Unchecked );
@ -372,6 +372,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage()
// no fields to register.
_ui.resultTextEdit->setAcceptRichText(true);
_ui.ocLinkLabel->setVisible( false );
setupCustomization();
}
OwncloudWizardResultPage::~OwncloudWizardResultPage()
@ -415,6 +417,18 @@ void OwncloudWizardResultPage::showOCUrlLabel( const QString& url, bool show )
}
}
void OwncloudWizardResultPage::setupCustomization()
{
// set defaults for the customize labels.
_ui.topLabel->setText( QString() );
_ui.topLabel->hide();
MirallConfigFile cfg;
QVariant variant = cfg.customMedia( MirallConfigFile::oCSetupResultTop );
setupCustomMedia( variant, _ui.topLabel );
}
// ======================================================================
/**

View file

@ -46,7 +46,6 @@ protected slots:
void slotPwdStoreChanged( int );
void slotSecureConChanged( int );
void setupCustomization();
void setupCustomMedia( QVariant, QLabel* );
private:
Ui_OwncloudSetupPage _ui;
@ -75,6 +74,8 @@ public:
void setOCUrl( const QString& );
void setupCustomMedia( QVariant, QLabel* );
public slots:
void appendToResultWidget( const QString& msg, LogType type = LogParagraph );
void slotCurrentPageChanged( int );
@ -186,6 +187,9 @@ public slots:
void appendResultText( const QString&, OwncloudWizard::LogType type = OwncloudWizard::LogParagraph );
void showOCUrlLabel( const QString&, bool );
protected:
void setupCustomization();
private:
Ui_OwncloudWizardResultPage _ui;

View file

@ -6,15 +6,29 @@
<rect>
<x>0</x>
<y>0</y>
<width>595</width>
<height>371</height>
<width>526</width>
<height>357</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="3" column="0">
<widget class="QTextEdit" name="resultTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="ocLinkLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_3">
@ -45,7 +59,7 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -65,15 +79,8 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="resultTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ocLinkLabel">
<item row="0" column="0">
<widget class="QLabel" name="topLabel">
<property name="text">
<string>TextLabel</string>
</property>