1.1 --- a/branchpropwindow.cpp Mon Jul 27 12:53:17 2009 +0000
1.2 +++ b/branchpropwindow.cpp Mon Aug 03 10:42:12 2009 +0000
1.3 @@ -17,6 +17,7 @@
1.4 setCaption(vymName +" - " +tr ("Property Editor","Window caption"));
1.5
1.6 branch=NULL;
1.7 + branchItem=NULL;
1.8 model=NULL;
1.9
1.10 ui.tabWidget->setEnabled(false);
1.11 @@ -28,7 +29,7 @@
1.12 ui.framePenColorButton->setPixmap (pix);
1.13 ui.frameBrushColorButton->setPixmap (pix);
1.14
1.15 - // Create Model and View to hold attributes
1.16 + // Create Model and View to hold attributes // FIXME-3
1.17 /*
1.18 attributeModel = new QStandardItemModel (1,3,this);
1.19 attributeModel->setHeaderData(0, Qt::Horizontal, tr("Name","Branchprop window: Attribute name"));
1.20 @@ -58,97 +59,101 @@
1.21 settings.setValue( "/satellite/propertywindow/showWithMain",isVisible() );
1.22 }
1.23
1.24 -void BranchPropertyWindow::setBranch (BranchObj *bo)
1.25 +void BranchPropertyWindow::setBranch (BranchItem *bi)
1.26 {
1.27 disconnectSignals();
1.28 - branch=bo;
1.29 - if (bo)
1.30 + branchItem=bi;
1.31 + if (branchItem)
1.32 {
1.33 - BranchItem *bi=(BranchItem*)(bo->getTreeItem());
1.34 - ui.tabWidget->setEnabled (true);
1.35
1.36 - // Frame
1.37 - FrameObj::FrameType t=branch->getFrameType();
1.38 - if (t==FrameObj::NoFrame)
1.39 + branch=(BranchObj*)(branchItem->getLMO());
1.40 + if (branch) // FIXME-3 move to branchItem later, when Frame is ported...
1.41 {
1.42 - ui.frameTypeCombo->setCurrentIndex (0);
1.43 - penColor=Qt::white;
1.44 - brushColor=Qt::white;
1.45 - ui.colorGroupBox->setEnabled (false);
1.46 - ui.framePaddingSpinBox->setEnabled (false);
1.47 - ui.frameWidthSpinBox->setEnabled (false);
1.48 - ui.framePaddingLabel->setEnabled (false);
1.49 - ui.frameBorderLabel->setEnabled (false);
1.50 - } else
1.51 - {
1.52 - penColor=bo->getFramePenColor();
1.53 - brushColor=bo->getFrameBrushColor();
1.54 - QPixmap pix( 16,16);
1.55 - pix.fill (penColor);
1.56 - ui.framePenColorButton->setPixmap (pix);
1.57 - pix.fill (brushColor);
1.58 - ui.frameBrushColorButton->setPixmap (pix);
1.59 - ui.colorGroupBox->setEnabled (true);
1.60 - ui.framePaddingSpinBox->setEnabled (true);
1.61 - ui.framePaddingSpinBox->setValue (bo->getFramePadding());
1.62 - ui.frameWidthSpinBox->setEnabled (true);
1.63 - ui.frameWidthSpinBox->setValue (bo->getFrameBorderWidth());
1.64 - ui.framePaddingLabel->setEnabled (true);
1.65 - ui.frameBorderLabel->setEnabled (true);
1.66 + ui.tabWidget->setEnabled (true);
1.67
1.68 - switch (t)
1.69 + // Frame
1.70 + FrameObj::FrameType t=branch->getFrameType();
1.71 + if (t==FrameObj::NoFrame)
1.72 {
1.73 - case FrameObj::Rectangle:
1.74 - ui.frameTypeCombo->setCurrentIndex (1);
1.75 - break;
1.76 - case FrameObj::Ellipse:
1.77 - ui.frameTypeCombo->setCurrentIndex (2);
1.78 - break;
1.79 - default:
1.80 - break;
1.81 + ui.frameTypeCombo->setCurrentIndex (0);
1.82 + penColor=Qt::white;
1.83 + brushColor=Qt::white;
1.84 + ui.colorGroupBox->setEnabled (false);
1.85 + ui.framePaddingSpinBox->setEnabled (false);
1.86 + ui.frameWidthSpinBox->setEnabled (false);
1.87 + ui.framePaddingLabel->setEnabled (false);
1.88 + ui.frameBorderLabel->setEnabled (false);
1.89 + } else
1.90 + {
1.91 + penColor=branch->getFramePenColor();
1.92 + brushColor=branch->getFrameBrushColor();
1.93 + QPixmap pix( 16,16);
1.94 + pix.fill (penColor);
1.95 + ui.framePenColorButton->setPixmap (pix);
1.96 + pix.fill (brushColor);
1.97 + ui.frameBrushColorButton->setPixmap (pix);
1.98 + ui.colorGroupBox->setEnabled (true);
1.99 + ui.framePaddingSpinBox->setEnabled (true);
1.100 + ui.framePaddingSpinBox->setValue (branch->getFramePadding());
1.101 + ui.frameWidthSpinBox->setEnabled (true);
1.102 + ui.frameWidthSpinBox->setValue (branch->getFrameBorderWidth());
1.103 + ui.framePaddingLabel->setEnabled (true);
1.104 + ui.frameBorderLabel->setEnabled (true);
1.105 +
1.106 + switch (t)
1.107 + {
1.108 + case FrameObj::Rectangle:
1.109 + ui.frameTypeCombo->setCurrentIndex (1);
1.110 + break;
1.111 + case FrameObj::Ellipse:
1.112 + ui.frameTypeCombo->setCurrentIndex (2);
1.113 + break;
1.114 + default:
1.115 + break;
1.116 + }
1.117 + }
1.118 +
1.119 + // Link
1.120 + if (branchItem->getHideLinkUnselected())
1.121 + ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
1.122 + else
1.123 + ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
1.124 +
1.125 + // Layout
1.126 + if (branchItem->getIncludeImagesVer())
1.127 + ui.incImgVer->setCheckState (Qt::Checked);
1.128 + else
1.129 + ui.incImgVer->setCheckState (Qt::Unchecked);
1.130 + if (branchItem->getIncludeImagesHor())
1.131 + ui.incImgHor->setCheckState (Qt::Checked);
1.132 + else
1.133 + ui.incImgHor->setCheckState (Qt::Unchecked);
1.134 +
1.135 + /*
1.136 + // Attributes
1.137 + attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex());
1.138 +
1.139 + // FIXME-3 some samples for attribute testing
1.140 + QStringList attrTypes=mapEditor->attributeTable()->getTypes();
1.141 + for (int i=0; i<attrTypes.count()-1;i++)
1.142 + {
1.143 + attributeModel->insertRow (i,QModelIndex ());
1.144 + attributeModel->setData(attributeModel->index(i, 0, QModelIndex()), QString ("Name %1").arg(i));
1.145 + attributeModel->setData(attributeModel->index(i, 1, QModelIndex()), i);
1.146 + attributeModel->setData(attributeModel->index(i, 2, QModelIndex()), attrTypes.at(i));
1.147 }
1.148 - }
1.149 -
1.150 - // Link
1.151 - if (bi->getHideLinkUnselected())
1.152 - ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
1.153 - else
1.154 - ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
1.155
1.156 - // Layout
1.157 - if (branch->getIncludeImagesVer())
1.158 - ui.incImgVer->setCheckState (Qt::Checked);
1.159 - else
1.160 - ui.incImgVer->setCheckState (Qt::Unchecked);
1.161 - if (branch->getIncludeImagesHor())
1.162 - ui.incImgHor->setCheckState (Qt::Checked);
1.163 - else
1.164 - ui.incImgHor->setCheckState (Qt::Unchecked);
1.165
1.166 -/*
1.167 - // Attributes
1.168 - attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex());
1.169 + ui.attributeTableView->resizeColumnsToContents();
1.170
1.171 - // FIXME-3 some samples for attribute testing
1.172 - QStringList attrTypes=mapEditor->attributeTable()->getTypes();
1.173 - for (int i=0; i<attrTypes.count()-1;i++)
1.174 - {
1.175 - attributeModel->insertRow (i,QModelIndex ());
1.176 - attributeModel->setData(attributeModel->index(i, 0, QModelIndex()), QString ("Name %1").arg(i));
1.177 - attributeModel->setData(attributeModel->index(i, 1, QModelIndex()), i);
1.178 - attributeModel->setData(attributeModel->index(i, 2, QModelIndex()), attrTypes.at(i));
1.179 - }
1.180 + // Initialize Delegate
1.181 + delegate.setAttributeTable (mapEditor->attributeTable());
1.182 + ui.attributeTableView->setItemDelegate (&delegate);
1.183 + */
1.184
1.185 -
1.186 - ui.attributeTableView->resizeColumnsToContents();
1.187 -
1.188 - // Initialize Delegate
1.189 - delegate.setAttributeTable (mapEditor->attributeTable());
1.190 - ui.attributeTableView->setItemDelegate (&delegate);
1.191 -*/
1.192 -
1.193 - // Finally activate signals
1.194 - connectSignals();
1.195 + // Finally activate signals
1.196 + connectSignals();
1.197 + } // BranchObj
1.198 } else
1.199 {
1.200 ui.tabWidget->setEnabled (false);
1.201 @@ -159,7 +164,7 @@
1.202 {
1.203 model=m;
1.204 if (model)
1.205 - setBranch (model->getSelectedBranchObj() );
1.206 + setBranch (model->getSelectedBranchItem() );
1.207 else
1.208 ui.tabWidget->setEnabled (false);
1.209
1.210 @@ -180,7 +185,7 @@
1.211 model->setFramePadding (5);
1.212 break;
1.213 }
1.214 - setBranch (branch);
1.215 + setBranch (branchItem);
1.216 }
1.217 }
1.218
1.219 @@ -222,7 +227,7 @@
1.220
1.221 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
1.222 {
1.223 - if (!branch) return;
1.224 + if (!branchItem) return;
1.225 model->setHideLinkUnselected(i);
1.226 }
1.227