Formatting and remove unused icons
This commit is contained in:
@@ -64,6 +64,7 @@ ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QS
|
||||
|
||||
// Create the model
|
||||
model_ = new CollectionModel(backend_, app_, this);
|
||||
model_->Reset();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ DeviceItemDelegate::DeviceItemDelegate(QObject *parent)
|
||||
void DeviceItemDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, const QModelIndex &index) const {
|
||||
|
||||
// Is it a device or a collection item?
|
||||
if (index.data(DeviceManager::Role_State).isNull()) {
|
||||
if (index.data(DeviceManager::Role::Role_State).isNull()) {
|
||||
CollectionItemDelegate::paint(p, opt, index);
|
||||
return;
|
||||
}
|
||||
@@ -203,10 +203,10 @@ void DeviceView::SetApplication(Application *app) {
|
||||
|
||||
merged_model_ = new MergedProxyModel(this);
|
||||
merged_model_->setSourceModel(sort_model_);
|
||||
setModel(merged_model_);
|
||||
|
||||
connect(merged_model_, SIGNAL(SubModelReset(QModelIndex, QAbstractItemModel*)), SLOT(RecursivelyExpand(QModelIndex)));
|
||||
|
||||
setModel(merged_model_);
|
||||
properties_dialog_->SetDeviceManager(app_->device_manager());
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
@@ -274,9 +274,7 @@ void DeviceView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
QModelIndex DeviceView::MapToDevice(const QModelIndex &merged_model_index) const {
|
||||
|
||||
QModelIndex sort_model_index = merged_model_->mapToSource(merged_model_index);
|
||||
if (sort_model_index.model() != sort_model_)
|
||||
return QModelIndex();
|
||||
|
||||
if (sort_model_index.model() != sort_model_) return QModelIndex();
|
||||
return sort_model_->mapToSource(sort_model_index);
|
||||
|
||||
}
|
||||
@@ -285,7 +283,6 @@ QModelIndex DeviceView::FindParentDevice(const QModelIndex &merged_model_index)
|
||||
|
||||
QModelIndex index = merged_model_->FindSourceParent(merged_model_index);
|
||||
if (index.model() != sort_model_) return QModelIndex();
|
||||
|
||||
return sort_model_->mapToSource(index);
|
||||
|
||||
}
|
||||
@@ -296,7 +293,6 @@ QModelIndex DeviceView::MapToCollection(const QModelIndex &merged_model_index) c
|
||||
if (const QSortFilterProxyModel *sort_model = qobject_cast<const QSortFilterProxyModel*>(sort_model_index.model())) {
|
||||
return sort_model->mapToSource(sort_model_index);
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
|
||||
}
|
||||
@@ -462,4 +458,3 @@ bool DeviceView::CanRecursivelyExpand(const QModelIndex &index) const {
|
||||
// Never expand devices
|
||||
return index.parent().isValid();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,15 @@ class MergedProxyModel;
|
||||
class OrganiseDialog;
|
||||
|
||||
class DeviceItemDelegate : public CollectionItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceItemDelegate(QObject *parent);
|
||||
|
||||
static const int kIconPadding;
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
};
|
||||
|
||||
class DeviceView : public AutoExpandingTreeView {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>391</width>
|
||||
<height>396</height>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -30,14 +30,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="DeviceView" name="view" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="DeviceView" name="view" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user