summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mappingtreewidget.cpp')
-rw-r--r--mappingtreewidget.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp
index 67ccd87..22a9757 100644
--- a/mappingtreewidget.cpp
+++ b/mappingtreewidget.cpp
@@ -297,3 +297,35 @@ void MappingEditWidget::removeMapping(){
QModelIndex firstIdx = sel.first();
mResultModel->removeRows(firstIdx.row(), 1, firstIdx.parent());
}
+
+void MappingEditWidget::setMappings(const QList<int> &mappings){
+ if(mappings.isEmpty()){
+ return;
+ }
+ MappingTreeModel *mModel = static_cast<MappingTreeModel*>(SmGlobals::instance()->model("MappingTree"));
+ mResultModel->clearData();
+ foreach(int i, mappings){
+ MappingData curData = mModel->mappingDataFromId(i);
+ if(curData.id != -1){
+ mResultModel->addItem(curData);
+ }
+ }
+ mMappingResult->expandAll();
+}
+
+MappingEditDialog::MappingEditDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
+ mEditWidget = new MappingEditWidget;
+ mOk = new QPushButton(tr("Ok"));
+ connect(mOk, SIGNAL(clicked()), this, SLOT(accept()));
+ mCancel = new QPushButton(tr("Cancel"));
+ connect(mCancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ QHBoxLayout *buttonLayout = new QHBoxLayout;
+ buttonLayout->addStretch();
+ buttonLayout->addWidget(mOk);
+ buttonLayout->addWidget(mCancel);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(mEditWidget);
+ mainLayout->addLayout(buttonLayout);
+ setLayout(mainLayout);
+}