Implement UI changes discussed with Jan.

Fixes #785
Fixes #782
Fixes #781
This commit is contained in:
Daniel Molkentin 2013-07-19 22:14:07 +02:00
parent 1cc60e755b
commit b79a45403e
9 changed files with 112 additions and 65 deletions

View file

@ -10,6 +10,7 @@
<file>resources/task-ongoing.png</file>
<file>resources/view-refresh.png</file>
<file>resources/warning-16.png</file>
<file>resources/settings.png</file>
<file>resources/owncloud_logo_blue.png</file>
</qresource>
</RCC>

BIN
resources/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -26,6 +26,7 @@
#include "mirall/fileitemdialog.h"
#include "mirall/owncloudsetupwizard.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/ignorelisteditor.h"
#include <math.h>
@ -63,13 +64,12 @@ AccountSettings::AccountSettings(FolderMan *folderMan, QWidget *parent) :
connect(ui->_ButtonEnable, SIGNAL(clicked()), this, SLOT(slotEnableCurrentFolder()));
connect(ui->_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoAboutCurrentFolder()));
connect(ui->_ButtonAdd, SIGNAL(clicked()), this, SLOT(slotAddFolder()));
connect(ui->modifyAccountButton, SIGNAL(clicked()), this, SLOT(slotOpenAccountWizard()));
connect(ui->modifyAccountButton, SIGNAL(clicked()), SLOT(slotOpenAccountWizard()));
connect(ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor()));;
connect(ui->_folderList, SIGNAL(clicked(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
connect(ui->_folderList, SIGNAL(doubleClicked(QModelIndex)),SLOT(slotDoubleClicked(QModelIndex)));
connect(ui->changePasswordButton, SIGNAL(clicked()), SLOT(slotPasswordDialog()));
ownCloudInfo *ocInfo = ownCloudInfo::instance();
slotUpdateQuota(ocInfo->lastQuotaTotalBytes(), ocInfo->lastQuotaUsedBytes());
connect(ocInfo, SIGNAL(quotaUpdated(qint64,qint64)), SLOT(slotUpdateQuota(qint64,qint64)));
@ -153,22 +153,6 @@ void AccountSettings::slotOpenAccountWizard()
OwncloudSetupWizard::runWizard(_folderMan, qApp, SLOT(slotownCloudWizardDone(int)), this);
}
void AccountSettings::slotPasswordDialog()
{
QInputDialog *dlg = new QInputDialog(this);
dlg->setLabelText(tr("Enter new password:"));
dlg->setTextEchoMode(QLineEdit::Password);
dlg->open(this, SLOT(slotChangePassword(const QString&)));
}
void AccountSettings::slotChangePassword(const QString& password)
{
MirallConfigFile cfg;
CredentialStore::instance()
->setCredentials(cfg.ownCloudUrl(), cfg.ownCloudUser(), password);
_folderMan->slotScheduleAllFolders();
}
void AccountSettings::slotAddFolder( Folder *folder )
{
if( ! folder || folder->alias().isEmpty() ) return;
@ -599,6 +583,12 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
ui->quotaLabel->setText(tr("You are using %1 of your available %2 storage.").arg(usedStr, totalStr));
}
void AccountSettings::slotIgnoreFilesEditor()
{
IgnoreListEditor *ignoreEditor = new IgnoreListEditor;
ignoreEditor->open();
}
void AccountSettings::slotInfoAboutCurrentFolder()
{
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();

View file

@ -68,6 +68,7 @@ public slots:
void slotSetProgress( Progress::Kind, const QString&, const QString&, long, long );
void slotSetOverallProgress( const QString&, const QString&, int, int, qlonglong, qlonglong );
void slotUpdateQuota( qint64,qint64 );
void slotIgnoreFilesEditor();
protected slots:
void slotAddFolder();
@ -79,8 +80,6 @@ protected slots:
void slotFolderWizardAccepted();
void slotFolderWizardRejected();
void slotOpenAccountWizard();
void slotPasswordDialog();
void slotChangePassword(const QString&);
void slotHideProgress();
private:

View file

@ -21,12 +21,12 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="changePasswordButton">
<widget class="QPushButton" name="ignoredFilesButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Change Password</string>
<string>Edit Ignored Files</string>
</property>
</widget>
</item>

View file

@ -1,3 +1,16 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "mirall/mirallconfigfile.h"
#include "ignorelisteditor.h"
@ -13,8 +26,8 @@
namespace Mirall {
IgnoreListEditor::IgnoreListEditor(QWidget *parent) :
QWidget(parent),
IgnoreListEditor::IgnoreListEditor(QDialog *parent) :
QDialog(parent),
ui(new Ui::IgnoreListEditor)
{
ui->setupUi(this);
@ -25,12 +38,12 @@ IgnoreListEditor::IgnoreListEditor(QWidget *parent) :
readIgnoreFile(cfgFile.excludeFile(MirallConfigFile::SystemScope), true);
readIgnoreFile(cfgFile.excludeFile(MirallConfigFile::UserScope), false);
connect(this, SIGNAL(accepted()), SLOT(slotUpdateLocalIgnoreList()));
ui->removePushButton->setEnabled(false);
connect(ui->listWidget, SIGNAL(itemSelectionChanged()), SLOT(slotItemSelectionChanged()));
connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(slotItemChanged(QListWidgetItem*)));
connect(ui->removePushButton, SIGNAL(clicked()), SLOT(slotRemoveCurrentItem()));
connect(ui->addPushButton, SIGNAL(clicked()), SLOT(slotAddPattern()));
connect(ui->listWidget, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(slotUpdateLocalIgnoreList()));
connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(slotEditPattern(QListWidgetItem*)));
}
@ -59,7 +72,6 @@ void IgnoreListEditor::slotItemSelectionChanged()
void IgnoreListEditor::slotRemoveCurrentItem()
{
delete ui->listWidget->currentItem();
slotUpdateLocalIgnoreList();
}
void IgnoreListEditor::slotUpdateLocalIgnoreList()
@ -87,7 +99,6 @@ void IgnoreListEditor::slotAddPattern()
setupItemFlags(item);
ui->listWidget->addItem(item);
ui->listWidget->scrollToItem(item);
slotUpdateLocalIgnoreList();
}
void IgnoreListEditor::slotEditPattern(QListWidgetItem *item)
@ -100,7 +111,6 @@ void IgnoreListEditor::slotEditPattern(QListWidgetItem *item)
QLineEdit::Normal, item->text());
if (!pattern.isEmpty()) {
item->setText(pattern);
slotUpdateLocalIgnoreList();
}
}

View file

@ -1,7 +1,20 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef IGNORELISTEDITOR_H
#define IGNORELISTEDITOR_H
#include <QWidget>
#include <QDialog>
class QListWidgetItem;
@ -11,12 +24,12 @@ namespace Ui {
class IgnoreListEditor;
}
class IgnoreListEditor : public QWidget
class IgnoreListEditor : public QDialog
{
Q_OBJECT
public:
explicit IgnoreListEditor(QWidget *parent = 0);
explicit IgnoreListEditor(QDialog *parent = 0);
~IgnoreListEditor();
private slots:

View file

@ -1,19 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Mirall::IgnoreListEditor</class>
<widget class="QWidget" name="Mirall::IgnoreListEditor">
<widget class="QDialog" name="Mirall::IgnoreListEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>359</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="descriptionLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3">
<widget class="QListWidget" name="listWidget">
<property name="enabled">
@ -21,22 +31,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="enabled">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>213</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="addPushButton">
<property name="enabled">
@ -57,18 +51,64 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="descriptionLabel">
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string/>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>213</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Mirall::IgnoreListEditor</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>348</x>
<y>333</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>355</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Mirall::IgnoreListEditor</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>210</x>
<y>333</y>
</hint>
<hint type="destinationlabel">
<x>385</x>
<y>297</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -18,7 +18,6 @@
#include "mirall/generalsettings.h"
#include "mirall/accountsettings.h"
#include "mirall/application.h"
#include "mirall/ignorelisteditor.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/progressdispatcher.h"
@ -46,7 +45,8 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
setWindowTitle(tr("%1 Settings").arg(Theme::instance()->appNameGUI()));
QListWidgetItem *general = new QListWidgetItem(tr("General Settings"), _ui->labelWidget);
QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png"));
QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget);
general->setSizeHint(QSize(0, 32));
_ui->labelWidget->addItem(general);
GeneralSettings *generalSettings = new GeneralSettings;
@ -54,16 +54,10 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
connect(generalSettings, SIGNAL(proxySettingsChanged()), app->_folderMan, SLOT(slotScheduleAllFolders()));
_ui->stack->addWidget(generalSettings);
QListWidgetItem *ignoredFiles = new QListWidgetItem(tr("Ignored Files"), _ui->labelWidget);
ignoredFiles->setSizeHint(QSize(0, 32));
_ui->labelWidget->addItem(ignoredFiles);
IgnoreListEditor *ignoreEditor = new IgnoreListEditor;
_ui->stack->addWidget(ignoreEditor);
//connect(generalSettings, SIGNAL(resizeToSizeHint()), SLOT(resizeToSizeHint()));
_accountSettings = new AccountSettings(app->_folderMan);
addAccount(tr("Account Details"), _accountSettings);
addAccount(tr("Account"), _accountSettings);
connect( app, SIGNAL(folderStateChanged(Folder*)), _accountSettings, SLOT(slotUpdateFolderState(Folder*)));
@ -100,7 +94,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::addAccount(const QString &title, QWidget *widget)
{
QListWidgetItem *item = new QListWidgetItem(title);
QListWidgetItem *item = new QListWidgetItem(Theme::instance()->syncStateIcon(SyncResult::Success, true), title);
item->setSizeHint(QSize(0, 32));
_ui->labelWidget->addItem(item);
_ui->stack->addWidget(widget);