diff -r 9db215a4ad53 -r 5987f9f15bac branchpropwindow.cpp --- a/branchpropwindow.cpp Mon Jul 27 12:53:17 2009 +0000 +++ b/branchpropwindow.cpp Mon Aug 03 10:42:12 2009 +0000 @@ -17,6 +17,7 @@ setCaption(vymName +" - " +tr ("Property Editor","Window caption")); branch=NULL; + branchItem=NULL; model=NULL; ui.tabWidget->setEnabled(false); @@ -28,7 +29,7 @@ ui.framePenColorButton->setPixmap (pix); ui.frameBrushColorButton->setPixmap (pix); - // Create Model and View to hold attributes + // Create Model and View to hold attributes // FIXME-3 /* attributeModel = new QStandardItemModel (1,3,this); attributeModel->setHeaderData(0, Qt::Horizontal, tr("Name","Branchprop window: Attribute name")); @@ -58,97 +59,101 @@ settings.setValue( "/satellite/propertywindow/showWithMain",isVisible() ); } -void BranchPropertyWindow::setBranch (BranchObj *bo) +void BranchPropertyWindow::setBranch (BranchItem *bi) { disconnectSignals(); - branch=bo; - if (bo) + branchItem=bi; + if (branchItem) { - BranchItem *bi=(BranchItem*)(bo->getTreeItem()); - ui.tabWidget->setEnabled (true); - // Frame - FrameObj::FrameType t=branch->getFrameType(); - if (t==FrameObj::NoFrame) + branch=(BranchObj*)(branchItem->getLMO()); + if (branch) // FIXME-3 move to branchItem later, when Frame is ported... { - ui.frameTypeCombo->setCurrentIndex (0); - penColor=Qt::white; - brushColor=Qt::white; - ui.colorGroupBox->setEnabled (false); - ui.framePaddingSpinBox->setEnabled (false); - ui.frameWidthSpinBox->setEnabled (false); - ui.framePaddingLabel->setEnabled (false); - ui.frameBorderLabel->setEnabled (false); - } else - { - penColor=bo->getFramePenColor(); - brushColor=bo->getFrameBrushColor(); - QPixmap pix( 16,16); - pix.fill (penColor); - ui.framePenColorButton->setPixmap (pix); - pix.fill (brushColor); - ui.frameBrushColorButton->setPixmap (pix); - ui.colorGroupBox->setEnabled (true); - ui.framePaddingSpinBox->setEnabled (true); - ui.framePaddingSpinBox->setValue (bo->getFramePadding()); - ui.frameWidthSpinBox->setEnabled (true); - ui.frameWidthSpinBox->setValue (bo->getFrameBorderWidth()); - ui.framePaddingLabel->setEnabled (true); - ui.frameBorderLabel->setEnabled (true); + ui.tabWidget->setEnabled (true); - switch (t) + // Frame + FrameObj::FrameType t=branch->getFrameType(); + if (t==FrameObj::NoFrame) { - case FrameObj::Rectangle: - ui.frameTypeCombo->setCurrentIndex (1); - break; - case FrameObj::Ellipse: - ui.frameTypeCombo->setCurrentIndex (2); - break; - default: - break; + ui.frameTypeCombo->setCurrentIndex (0); + penColor=Qt::white; + brushColor=Qt::white; + ui.colorGroupBox->setEnabled (false); + ui.framePaddingSpinBox->setEnabled (false); + ui.frameWidthSpinBox->setEnabled (false); + ui.framePaddingLabel->setEnabled (false); + ui.frameBorderLabel->setEnabled (false); + } else + { + penColor=branch->getFramePenColor(); + brushColor=branch->getFrameBrushColor(); + QPixmap pix( 16,16); + pix.fill (penColor); + ui.framePenColorButton->setPixmap (pix); + pix.fill (brushColor); + ui.frameBrushColorButton->setPixmap (pix); + ui.colorGroupBox->setEnabled (true); + ui.framePaddingSpinBox->setEnabled (true); + ui.framePaddingSpinBox->setValue (branch->getFramePadding()); + ui.frameWidthSpinBox->setEnabled (true); + ui.frameWidthSpinBox->setValue (branch->getFrameBorderWidth()); + ui.framePaddingLabel->setEnabled (true); + ui.frameBorderLabel->setEnabled (true); + + switch (t) + { + case FrameObj::Rectangle: + ui.frameTypeCombo->setCurrentIndex (1); + break; + case FrameObj::Ellipse: + ui.frameTypeCombo->setCurrentIndex (2); + break; + default: + break; + } + } + + // Link + if (branchItem->getHideLinkUnselected()) + ui.hideLinkIfUnselected->setCheckState (Qt::Checked); + else + ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked); + + // Layout + if (branchItem->getIncludeImagesVer()) + ui.incImgVer->setCheckState (Qt::Checked); + else + ui.incImgVer->setCheckState (Qt::Unchecked); + if (branchItem->getIncludeImagesHor()) + ui.incImgHor->setCheckState (Qt::Checked); + else + ui.incImgHor->setCheckState (Qt::Unchecked); + + /* + // Attributes + attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex()); + + // FIXME-3 some samples for attribute testing + QStringList attrTypes=mapEditor->attributeTable()->getTypes(); + for (int i=0; iinsertRow (i,QModelIndex ()); + attributeModel->setData(attributeModel->index(i, 0, QModelIndex()), QString ("Name %1").arg(i)); + attributeModel->setData(attributeModel->index(i, 1, QModelIndex()), i); + attributeModel->setData(attributeModel->index(i, 2, QModelIndex()), attrTypes.at(i)); } - } - - // Link - if (bi->getHideLinkUnselected()) - ui.hideLinkIfUnselected->setCheckState (Qt::Checked); - else - ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked); - // Layout - if (branch->getIncludeImagesVer()) - ui.incImgVer->setCheckState (Qt::Checked); - else - ui.incImgVer->setCheckState (Qt::Unchecked); - if (branch->getIncludeImagesHor()) - ui.incImgHor->setCheckState (Qt::Checked); - else - ui.incImgHor->setCheckState (Qt::Unchecked); -/* - // Attributes - attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex()); + ui.attributeTableView->resizeColumnsToContents(); - // FIXME-3 some samples for attribute testing - QStringList attrTypes=mapEditor->attributeTable()->getTypes(); - for (int i=0; iinsertRow (i,QModelIndex ()); - attributeModel->setData(attributeModel->index(i, 0, QModelIndex()), QString ("Name %1").arg(i)); - attributeModel->setData(attributeModel->index(i, 1, QModelIndex()), i); - attributeModel->setData(attributeModel->index(i, 2, QModelIndex()), attrTypes.at(i)); - } + // Initialize Delegate + delegate.setAttributeTable (mapEditor->attributeTable()); + ui.attributeTableView->setItemDelegate (&delegate); + */ - - ui.attributeTableView->resizeColumnsToContents(); - - // Initialize Delegate - delegate.setAttributeTable (mapEditor->attributeTable()); - ui.attributeTableView->setItemDelegate (&delegate); -*/ - - // Finally activate signals - connectSignals(); + // Finally activate signals + connectSignals(); + } // BranchObj } else { ui.tabWidget->setEnabled (false); @@ -159,7 +164,7 @@ { model=m; if (model) - setBranch (model->getSelectedBranchObj() ); + setBranch (model->getSelectedBranchItem() ); else ui.tabWidget->setEnabled (false); @@ -180,7 +185,7 @@ model->setFramePadding (5); break; } - setBranch (branch); + setBranch (branchItem); } } @@ -222,7 +227,7 @@ void BranchPropertyWindow::linkHideUnselectedChanged (int i) { - if (!branch) return; + if (!branchItem) return; model->setHideLinkUnselected(i); }