[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ring-kde/accountdlg_rewrite2] src/conf: account: Re-connect all account sub-models
From: Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date: 2015-06-16 15:57:04
Message-ID: E1Z4tEW-00062J-HF () scm ! kde ! org
[Download RAW message or body]
Git commit 51678b868fe0c952d8b6dbd8bc90a0baec1773d1 by Emmanuel Lepage Vallee.
Committed on 15/06/2015 at 21:55.
Pushed by lepagevalleeemmanuel into branch 'accountdlg_rewrite2'.
account: Re-connect all account sub-models
Refs #74198
M +17 -0 src/conf/account/accountdlg.ui
M +14 -3 src/conf/account/accountpages/account.cpp
M +1 -4 src/conf/account/accountpages/account.h
M +12 -12 src/conf/account/accountpages/advanced.ui
M +6 -1 src/conf/account/accountpages/basic.cpp
M +9 -13 src/conf/account/accountpages/basic.ui
M +10 -0 src/conf/account/accountpages/codecs.cpp
M +2 -2 src/conf/account/accountpages/codecs.ui
M +7 -1 src/conf/account/accountpages/credentials.cpp
M +1 -1 src/conf/account/accountpages/credentials.ui
M +6 -0 src/conf/account/accountpages/network.cpp
M +17 -40 src/conf/account/accountpages/network.ui
M +12 -1 src/conf/account/accountpages/pagebase.cpp
M +9 -0 src/conf/account/accountpages/pagebase.h
M +7 -0 src/conf/account/accountpages/ringtone.cpp
M +1 -1 src/conf/account/accountpages/ringtone.ui
M +6 -6 src/conf/account/accountpages/tabs.ui
M +8 -3 src/conf/account/dlgaccount.cpp
M +3 -1 src/conf/configurationdialog.cpp
http://commits.kde.org/ring-kde/51678b868fe0c952d8b6dbd8bc90a0baec1773d1
diff --git a/src/conf/account/accountdlg.ui b/src/conf/account/accountdlg.ui
index 0050f62..8ff32d2 100644
--- a/src/conf/account/accountdlg.ui
+++ b/src/conf/account/accountdlg.ui
@@ -283,8 +283,25 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>m_pAccountList</sender>
+ <signal>clicked(QModelIndex)</signal>
+ <receiver>AccountDlg</receiver>
+ <slot>setCurrentAccount(QModelIndex)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>296</x>
+ <y>177</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>255</x>
+ <y>1</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>slotNewAddAccount()</slot>
+ <slot>setCurrentAccount(QModelIndex)</slot>
</slots>
</ui>
diff --git a/src/conf/account/accountpages/account.cpp b/src/conf/account/accountpages/account.cpp
index 34e690c..a9a345f 100644
--- a/src/conf/account/accountpages/account.cpp
+++ b/src/conf/account/accountpages/account.cpp
@@ -15,19 +15,30 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
-
#include "account.h"
// #include ""
#include <KConfigDialogManager>
#include "accountserializationadapter.h"
+//Ring
+#include <account.h>
+
#include "basic.h"
-Pages::Account::Account(const QString& accountId, QWidget *parent) : PageBase(parent)
+Pages::Account::Account(::Account* a, QWidget *parent) : PageBase(parent)
{
+ setAccount(a);
setupUi(this);
- AccountSerializationAdapter* adapter = new AccountSerializationAdapter(accountId);
+ dlgBasic -> setAccount(a);
+ dlgAdvanced -> setAccount(a);
+ dlgNetwork -> setAccount(a);
+ dlgCodec -> setAccount(a);
+ dlgCredentials -> setAccount(a);
+ dlgRingtone -> setAccount(a);
+// dlgSecurity
+
+ AccountSerializationAdapter* adapter = new AccountSerializationAdapter("ring/"+a->id()+".ini");
m_pCurrentManager = new KConfigDialogManager(this, adapter);
diff --git a/src/conf/account/accountpages/account.h b/src/conf/account/accountpages/account.h
index 94c1cc7..8004b73 100644
--- a/src/conf/account/accountpages/account.h
+++ b/src/conf/account/accountpages/account.h
@@ -33,14 +33,11 @@ class Account : public PageBase, public Ui::Tabs
Q_OBJECT
public:
//Constructor
- explicit Account(const QString& accountId, QWidget *parent = nullptr);
+ explicit Account(::Account* a, QWidget *parent = nullptr);
//Getters
- Account* account() const;
KConfigDialogManager* manager() const;
- //Setters
- void setAccount(Account* account);
public Q_SLOTS:
virtual void updateWidgets() override;
diff --git a/src/conf/account/accountpages/advanced.ui b/src/conf/account/accountpages/advanced.ui
index 86b1466..2231d15 100644
--- a/src/conf/account/accountpages/advanced.ui
+++ b/src/conf/account/accountpages/advanced.ui
@@ -113,7 +113,14 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="checkbox_turn">
+ <property name="text">
+ <string>TURN server</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<widget class="QCheckBox" name="m_pEnableUPnP">
<property name="text">
<string>Enable UPnP</string>
@@ -123,13 +130,6 @@
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="checkbox_turn">
- <property name="text">
- <string>TURN server</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
@@ -196,12 +196,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>81</x>
- <y>154</y>
+ <x>92</x>
+ <y>141</y>
</hint>
<hint type="destinationlabel">
- <x>182</x>
- <y>148</y>
+ <x>302</x>
+ <y>142</y>
</hint>
</hints>
</connection>
diff --git a/src/conf/account/accountpages/basic.cpp b/src/conf/account/accountpages/basic.cpp
index 9f164fe..1fd038b 100644
--- a/src/conf/account/accountpages/basic.cpp
+++ b/src/conf/account/accountpages/basic.cpp
@@ -17,8 +17,13 @@
**************************************************************************/
#include "basic.h"
+#include <account.h>
+#include <protocolmodel.h>
+
Pages::Basic::Basic(QWidget *parent) : PageBase(parent)
{
setupUi(this);
+ connect(this,&PageBase::accountSet,[this]() {
+ m_pProtocol->bindToModel(account()->protocolModel(),account()->protocolModel()->selectionModel());
+ });
}
-
diff --git a/src/conf/account/accountpages/basic.ui b/src/conf/account/accountpages/basic.ui
index fe69002..84ea3fe 100644
--- a/src/conf/account/accountpages/basic.ui
+++ b/src/conf/account/accountpages/basic.ui
@@ -54,23 +54,12 @@
<string>Protocol</string>
</property>
<property name="buddy">
- <cstring>edit2_protocol</cstring>
+ <cstring>m_pProtocol</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="edit2_protocol">
- <item>
- <property name="text">
- <string>SIP</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>IAX</string>
- </property>
- </item>
- </widget>
+ <widget class="AutoComboBox" name="m_pProtocol"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label3_server">
@@ -219,6 +208,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>AutoComboBox</class>
+ <extends>QComboBox</extends>
+ <header>widgets/autocombobox.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/conf/account/accountpages/codecs.cpp b/src/conf/account/accountpages/codecs.cpp
index fac3aa7..ee0849b 100644
--- a/src/conf/account/accountpages/codecs.cpp
+++ b/src/conf/account/accountpages/codecs.cpp
@@ -17,8 +17,18 @@
**************************************************************************/
#include "codecs.h"
+#include <QtCore/QSortFilterProxyModel>
+
+#include <account.h>
+#include <audio/codecmodel.h>
+
Pages::Codecs::Codecs(QWidget *parent) : PageBase(parent)
{
setupUi(this);
+ connect(this,&PageBase::accountSet,[this]() {
+ m_pAudioCodecs->setModel(account()->codecModel()->audioCodecs());
+ m_pVideoCodecs->setModel(account()->codecModel()->videoCodecs());
+ //TODO fix selectionmodels
+ });
}
diff --git a/src/conf/account/accountpages/codecs.ui b/src/conf/account/accountpages/codecs.ui
index 64b24e8..66895fd 100644
--- a/src/conf/account/accountpages/codecs.ui
+++ b/src/conf/account/accountpages/codecs.ui
@@ -24,7 +24,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0" colspan="4">
- <widget class="QListView" name="list_audiocodec"/>
+ <widget class="QListView" name="m_pAudioCodecs"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_frequency">
@@ -191,7 +191,7 @@
</layout>
</item>
<item row="2" column="0" colspan="4">
- <widget class="QListView" name="m_pCodecsLW"/>
+ <widget class="QListView" name="m_pVideoCodecs"/>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="kcfg_videoEnabled">
diff --git a/src/conf/account/accountpages/credentials.cpp \
b/src/conf/account/accountpages/credentials.cpp index 2c3e1c0..cd0010d 100644
--- a/src/conf/account/accountpages/credentials.cpp
+++ b/src/conf/account/accountpages/credentials.cpp
@@ -17,8 +17,14 @@
**************************************************************************/
#include "credentials.h"
+#include <account.h>
+#include <credentialmodel.h>
+
Pages::Credentials::Credentials(QWidget *parent) : PageBase(parent)
{
setupUi(this);
-}
+ connect(this,&PageBase::accountSet,[this]() {
+ m_pCredentials->setModel(account()->credentialModel());
+ });
+}
diff --git a/src/conf/account/accountpages/credentials.ui b/src/conf/account/accountpages/credentials.ui
index 44f5878..eed3d2a 100644
--- a/src/conf/account/accountpages/credentials.ui
+++ b/src/conf/account/accountpages/credentials.ui
@@ -34,7 +34,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
- <widget class="QListView" name="list_credential">
+ <widget class="QListView" name="m_pCredentials">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
diff --git a/src/conf/account/accountpages/network.cpp b/src/conf/account/accountpages/network.cpp
index 02d7e9e..7cf08f3 100644
--- a/src/conf/account/accountpages/network.cpp
+++ b/src/conf/account/accountpages/network.cpp
@@ -17,8 +17,14 @@
**************************************************************************/
#include "network.h"
+#include <networkinterfacemodel.h>
+#include <account.h>
+
Pages::Network::Network(QWidget *parent) : PageBase(parent)
{
setupUi(this);
+ connect(this,&PageBase::accountSet,[this]() {
+ m_pNetworkInterfaces->bindToModel(account()->networkInterfaceModel(),account()->networkInterfaceModel()->selectionModel());
+ });
}
diff --git a/src/conf/account/accountpages/network.ui b/src/conf/account/accountpages/network.ui
index d594898..e03e455 100644
--- a/src/conf/account/accountpages/network.ui
+++ b/src/conf/account/accountpages/network.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>418</width>
+ <width>423</width>
<height>359</height>
</rect>
</property>
@@ -31,7 +31,7 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QComboBox" name="comboBox_ni_local_address"/>
+ <widget class="AutoComboBox" name="m_pNetworkInterfaces"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_ni_local_port">
@@ -47,20 +47,6 @@
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="kcfg_proxy">
- <property name="placeholderText">
- <string>SIP proxy server (if none, leave blank)</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="kcfg_useProxy">
- <property name="text">
- <string>Proxy</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>
@@ -221,37 +207,28 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>AutoComboBox</class>
+ <extends>QComboBox</extends>
+ <header>widgets/autocombobox.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections>
<connection>
- <sender>kcfg_useProxy</sender>
- <signal>toggled(bool)</signal>
- <receiver>kcfg_proxy</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>76</x>
- <y>99</y>
- </hint>
- <hint type="destinationlabel">
- <x>156</x>
- <y>99</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>radioButton_pa_custom</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_publishAddr</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>86</x>
- <y>193</y>
+ <x>97</x>
+ <y>167</y>
</hint>
<hint type="destinationlabel">
- <x>160</x>
- <y>212</y>
+ <x>267</x>
+ <y>193</y>
</hint>
</hints>
</connection>
@@ -262,12 +239,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>36</x>
- <y>188</y>
+ <x>47</x>
+ <y>167</y>
</hint>
<hint type="destinationlabel">
- <x>187</x>
- <y>249</y>
+ <x>271</x>
+ <y>219</y>
</hint>
</hints>
</connection>
diff --git a/src/conf/account/accountpages/pagebase.cpp b/src/conf/account/accountpages/pagebase.cpp
index 1ee090a..6f6399d 100644
--- a/src/conf/account/accountpages/pagebase.cpp
+++ b/src/conf/account/accountpages/pagebase.cpp
@@ -17,7 +17,7 @@
**************************************************************************/
#include "pagebase.h"
-Pages::PageBase::PageBase(QWidget *parent) : QWidget(parent)
+Pages::PageBase::PageBase(QWidget *parent) : QWidget(parent), m_pAccount(nullptr)
{
}
@@ -45,3 +45,14 @@ void Pages::PageBase::setChanged()
{
}
+
+::Account* Pages::PageBase::account() const
+{
+ return m_pAccount;
+}
+
+void Pages::PageBase::setAccount(::Account* a)
+{
+ m_pAccount = a;
+ emit accountSet(a);
+}
diff --git a/src/conf/account/accountpages/pagebase.h b/src/conf/account/accountpages/pagebase.h
index cf7f240..31c6e3c 100644
--- a/src/conf/account/accountpages/pagebase.h
+++ b/src/conf/account/accountpages/pagebase.h
@@ -21,6 +21,8 @@
#include <QtWidgets/QWidget>
#include "ui_basic.h"
+class Account;
+
namespace Pages {
class PageBase : public QWidget
@@ -35,9 +37,15 @@ public:
virtual bool hasChanged();
+ ::Account* account() const;
+ void setAccount(::Account* a);
+
protected:
bool m_Changed;
+private:
+ ::Account* m_pAccount;
+
public Q_SLOTS:
virtual void updateWidgets();
virtual void updateSettings();
@@ -47,6 +55,7 @@ protected Q_SLOTS:
Q_SIGNALS:
void updateButtons();
+ void accountSet(::Account* a);
};
diff --git a/src/conf/account/accountpages/ringtone.cpp b/src/conf/account/accountpages/ringtone.cpp
index 9386508..1cb8d21 100644
--- a/src/conf/account/accountpages/ringtone.cpp
+++ b/src/conf/account/accountpages/ringtone.cpp
@@ -17,7 +17,14 @@
**************************************************************************/
#include "ringtone.h"
+#include <account.h>
+#include <ringtonemodel.h>
+
Pages::RingTone::RingTone(QWidget *parent) : PageBase(parent)
{
setupUi(this);
+ connect(this,&PageBase::accountSet,[this]() {
+ m_pRingtones->setModel(RingtoneModel::instance());
+ m_pRingtones->setSelectionModel(RingtoneModel::instance()->selectionModel(account()));
+ });
}
diff --git a/src/conf/account/accountpages/ringtone.ui b/src/conf/account/accountpages/ringtone.ui
index 43fe3c5..b76fbe3 100644
--- a/src/conf/account/accountpages/ringtone.ui
+++ b/src/conf/account/accountpages/ringtone.ui
@@ -34,7 +34,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="2">
- <widget class="QTableView" name="m_pRingtoneListLW">
+ <widget class="QTableView" name="m_pRingtones">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
diff --git a/src/conf/account/accountpages/tabs.ui b/src/conf/account/accountpages/tabs.ui
index 4812069..89e2610 100644
--- a/src/conf/account/accountpages/tabs.ui
+++ b/src/conf/account/accountpages/tabs.ui
@@ -32,7 +32,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="Pages::Advanced" name="widget_2" native="true"/>
+ <widget class="Pages::Advanced" name="dlgAdvanced" native="true"/>
</item>
</layout>
</widget>
@@ -42,7 +42,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="Pages::Network" name="widget_3" native="true"/>
+ <widget class="Pages::Network" name="dlgNetwork" native="true"/>
</item>
</layout>
</widget>
@@ -52,7 +52,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <widget class="Pages::Codecs" name="widget_4" native="true"/>
+ <widget class="Pages::Codecs" name="dlgCodec" native="true"/>
</item>
</layout>
</widget>
@@ -62,7 +62,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
- <widget class="Pages::Credentials" name="widget_5" native="true"/>
+ <widget class="Pages::Credentials" name="dlgCredentials" native="true"/>
</item>
</layout>
</widget>
@@ -70,7 +70,7 @@
<attribute name="title">
<string>Security</string>
</attribute>
- <widget class="QWidget" name="widget_6" native="true">
+ <widget class="QWidget" name="dlgSecurity" native="true">
<property name="geometry">
<rect>
<x>210</x>
@@ -87,7 +87,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <widget class="Pages::RingTone" name="widget_7" native="true"/>
+ <widget class="Pages::RingTone" name="dlgRingtone" native="true"/>
</item>
</layout>
</widget>
diff --git a/src/conf/account/dlgaccount.cpp b/src/conf/account/dlgaccount.cpp
index cfdb6e4..b7d3b65 100644
--- a/src/conf/account/dlgaccount.cpp
+++ b/src/conf/account/dlgaccount.cpp
@@ -40,7 +40,7 @@ DlgAccount::DlgAccount(QWidget* parent) : QWidget(parent), m_pCurrentAccount(nul
m_pGlobalProto->bindToModel(m_pProtocolModel,m_pProtocolModel->selectionModel());
- setCurrentAccount(nullptr);
+// setCurrentAccount(nullptr);
connect(m_pMoveUp , &QToolButton::clicked,AccountModel::instance(), &AccountModel::moveUp );
connect(m_pMoveDown, &QToolButton::clicked,AccountModel::instance(), &AccountModel::moveDown);
@@ -54,6 +54,11 @@ DlgAccount::DlgAccount(QWidget* parent) : QWidget(parent), m_pCurrentAccount(nul
AccountModel::instance()->remove(idx);
});
+ //TODO eventually remove this once it is plugged into KConfig
+ connect(AccountModel::instance(), &AccountModel::editStateChanged, [this]() {
+ emit updateButtons();
+ });
+
}
DlgAccount::~DlgAccount()
@@ -67,7 +72,7 @@ void DlgAccount::setCurrentAccount(const QModelIndex& idx)
void DlgAccount::setCurrentAccount(::Account* a)
{
- Pages::Account* acc = new Pages::Account("ring/account789.ini",this);
+ Pages::Account* acc = new Pages::Account(a,/*"ring/account789.ini",*/this);
QHBoxLayout* l = new QHBoxLayout(m_pPanel);
l->addWidget(acc);
m_lPages["account456.ini"] = acc;
@@ -94,7 +99,7 @@ void DlgAccount::cancel()
bool DlgAccount::hasChanged()
{
- return false;
+ return AccountModel::instance()->editState() != AccountModel::EditState::SAVED;
}
void DlgAccount::updateSettings()
diff --git a/src/conf/configurationdialog.cpp b/src/conf/configurationdialog.cpp
index be69e5f..58d474b 100644
--- a/src/conf/configurationdialog.cpp
+++ b/src/conf/configurationdialog.cpp
@@ -192,6 +192,8 @@ ConfigurationDialog::ConfigurationDialog(View *parent)
connect(buttonBox()->button(QDialogButtonBox::Ok), SIGNAL(clicked()) , this, \
SLOT(applyCustomSettings())); connect(buttonBox()->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), \
this, SLOT(cancelSettings()) );
+ connect(dlgAccount, &DlgAccount::updateButtons,this,&ConfigurationDialog::updateButtons);
+
setMinimumSize(1024,700);
} //ConfigurationDialog
@@ -266,7 +268,7 @@ bool ConfigurationDialog::hasChanged()
bool ConfigurationDialog::hasIncompleteRequiredFields()
{
- return false;//GUARD_FALSE(dlgAccount,hasIncompleteRequiredFields());
+ return AccountModel::instance()->editState() == AccountModel::EditState::INVALID;
}
///Update the buttons
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic