Changeset 13400
- Timestamp:
- 2012-10-16T10:49:20+02:00 (12 years ago)
- Location:
- trunk/OMEdit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/OMEdit/OMEditGUI/DocumentationWidget.cpp
r12926 r13400 50 50 mpDocumentationViewer = new DocumentationViewer(this); 51 51 mpDocumentationEditor = new DocumentationEditor(this); 52 setIsCustomModel(false); 52 mpUrlHistory = new QList<UrlSrc>(); 53 mUrlHistoryPos = -1; 53 54 mpHeadingLabel = new QPlainTextEdit; 54 55 mpHeadingLabel->setObjectName("DocumentationLabel"); … … 64 65 mpEditButton->setAutoDefault(true); 65 66 mpEditButton->setMaximumSize(QSize(120,20)); 67 mpEditButton->setVisible(false); 66 68 connect(mpEditButton, SIGNAL(clicked()), SLOT(editDocumentation())); 67 69 mpSaveButton = new QPushButton(Helper::save); 68 70 mpSaveButton->setAutoDefault(false); 69 71 mpSaveButton->setMaximumSize(QSize(100,20)); 72 mpSaveButton->setVisible(false); 70 73 connect(mpSaveButton, SIGNAL(clicked()), SLOT(saveChanges())); 74 mpBackButton = new QPushButton(Helper::backwardBrush); 75 mpBackButton->setAutoDefault(false); 76 mpBackButton->setMaximumSize(QSize(120,20)); 77 mpBackButton->setVisible(false); 78 connect(mpBackButton, SIGNAL(clicked()), SLOT(back())); 79 mpForwardButton = new QPushButton(Helper::forwardBrush); 80 mpForwardButton->setAutoDefault(false); 81 mpForwardButton->setMaximumSize(QSize(120,20)); 82 mpForwardButton->setVisible(false); 83 connect(mpForwardButton, SIGNAL(clicked()), SLOT(forward())); 71 84 QHBoxLayout *horizontalLayout = new QHBoxLayout; 72 85 horizontalLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); 73 86 horizontalLayout->addWidget(mpPixmapLabel); 74 87 horizontalLayout->addWidget(mpHeadingLabel); 75 horizontalLayout->addWidget(mpSaveButton); 76 horizontalLayout->addWidget(mpEditButton); 88 QHBoxLayout *horizontalLayout2 = new QHBoxLayout; 89 horizontalLayout2->setAlignment(Qt::AlignTop | Qt::AlignLeft); 90 horizontalLayout2->addWidget(mpBackButton); 91 horizontalLayout2->addWidget(mpForwardButton); 92 QHBoxLayout *horizontalLayout3 = new QHBoxLayout; 93 horizontalLayout3->setAlignment(Qt::AlignTop | Qt::AlignLeft); 94 horizontalLayout3->addWidget(mpSaveButton); 95 horizontalLayout3->addWidget(mpEditButton); 77 96 // set layout 78 97 QVBoxLayout *verticalLayout = new QVBoxLayout; 79 98 verticalLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); 80 99 verticalLayout->addLayout(horizontalLayout); 81 verticalLayout->addWidget(mpDocumentationViewer); 82 verticalLayout->addWidget(mpDocumentationEditor); 100 verticalLayout->addLayout(horizontalLayout2); 101 verticalLayout->addLayout(horizontalLayout3); 102 verticalLayout->addWidget(mpDocumentationViewer,1); 103 verticalLayout->addWidget(mpDocumentationEditor,1); 83 104 setLayout(verticalLayout); 105 mpDocumentationViewer->setVisible(false); 106 mpDocumentationEditor->setVisible(false); 107 mpPixmapLabel->setVisible(false); 84 108 } 85 109 … … 94 118 //! Shows the documentation of a model 95 119 //! @param className the model name 96 void DocumentationWidget::show(QString className )120 void DocumentationWidget::show(QString className, bool isCustomModel) 97 121 { 98 122 mClassName = className; … … 110 134 } 111 135 // show edit and save buttons if show is called for a custom model 112 if (isCustomModel ())136 if (isCustomModel) 113 137 { 114 138 mpEditButton->setVisible(true); 115 mpEditButton->setDisabled(false); 139 //mpEditButton->setDisabled(false); 140 mpEditButton->setText(Helper::edit); 116 141 mpSaveButton->setVisible(true); 117 142 mpSaveButton->setDisabled(true); … … 135 160 mDocumentationFile.close(); 136 161 162 if ((mUrlHistoryPos >= 0) && (className == mpUrlHistory->at(mUrlHistoryPos).url)) 163 { 164 /* reload url */ 165 } 166 else 167 { 168 /* new url */ 169 /* remove all following urls */ 170 while (mpUrlHistory->count() > (mUrlHistoryPos+1)) 171 { 172 mpUrlHistory->removeLast(); 173 } 174 /* append new url */ 175 mpUrlHistory->append(UrlSrc(className, isCustomModel)); 176 mUrlHistoryPos++; 177 } 178 if (mUrlHistoryPos > 0) 179 { 180 mpBackButton->setDisabled(false); 181 } 182 else 183 { 184 mpBackButton->setDisabled(true); 185 } 186 if (mpUrlHistory->count() == (mUrlHistoryPos+1)) 187 { 188 mpForwardButton->setDisabled(true); 189 } 190 else 191 { 192 mpForwardButton->setDisabled(false); 193 } 194 137 195 mpDocumentationViewer->setUrl(mDocumentationFile.fileName()); 138 196 mpDocumentationViewer->setVisible(true); 139 mpDocumentationEditor->setVisible(false); 197 mpBackButton->setVisible(true); 198 mpForwardButton->setVisible(true); 199 200 mpDocumentationEditor->hide(); 140 201 } 141 202 … … 146 207 mpDocumentationViewer->hide(); 147 208 // get the already existing documentation text of the model 148 mpDocumentationEditor->toPlainText();149 if (! mpParentMainWindow->mpOMCProxy->getDocumentationAnnotation(className).isEmpty())150 mpDocumentationEditor->setPlainText( mpParentMainWindow->mpOMCProxy->getDocumentationAnnotation(className));209 QString doc = mpParentMainWindow->mpOMCProxy->getDocumentationAnnotation(className); 210 if (!doc.isEmpty()) 211 mpDocumentationEditor->setPlainText(doc); 151 212 else 152 213 mpDocumentationEditor->setPlainText("<html>\n\n</html>"); 153 214 mpDocumentationEditor->setFocus(); 154 215 mpDocumentationEditor->show(); 155 }156 157 //! Sets the model as custom model.158 //! @param isCustomModel159 void DocumentationWidget::setIsCustomModel(bool isCustomModel)160 {161 mIsCustomModel = isCustomModel;162 }163 164 //! Returns true if the model is a custom model.165 //! @return bool true if model is a custom model166 bool DocumentationWidget::isCustomModel()167 {168 return mIsCustomModel;169 216 } 170 217 … … 183 230 void DocumentationWidget::editDocumentation() 184 231 { 185 showDocumentationEditView(mClassName); 186 mpEditButton->setDisabled(true); 187 mpSaveButton->setDisabled(false); 232 if (mpSaveButton->isEnabled() == false) 233 { 234 showDocumentationEditView(mClassName); 235 //mpEditButton->setDisabled(true); 236 mpEditButton->setText(Helper::cancel); 237 mpSaveButton->setDisabled(false); 238 mpBackButton->setDisabled(true); 239 mpForwardButton->setDisabled(true); 240 } 241 else 242 { 243 show(mClassName,true); 244 } 188 245 } 189 246 … … 195 252 { 196 253 mpParentMainWindow->mpOMCProxy->addClassAnnotation(mClassName,"annotate=Documentation(info = \""+StringHandler::escape(doc)+"\")"); 197 show(mClassName );254 show(mClassName,true); 198 255 } 199 256 else … … 202 259 mpParentMainWindow->mpMessageWidget->addGUIProblem(new ProblemItem("", false, 0, 0, 0, 0, message, Helper::scriptingKind, 203 260 Helper::errorLevel, 0, mpParentMainWindow->mpMessageWidget->mpProblem)); 261 } 262 } 263 264 //! Go to previous document 265 void DocumentationWidget::back() 266 { 267 if (mUrlHistoryPos > 0) 268 { 269 mUrlHistoryPos--; 270 show(mpUrlHistory->at(mUrlHistoryPos).url,mpUrlHistory->at(mUrlHistoryPos).isCustomModel); 271 } 272 } 273 274 //! Go to next document 275 void DocumentationWidget::forward() 276 { 277 if ((mUrlHistoryPos+1) < mpUrlHistory->count()) 278 { 279 mUrlHistoryPos++; 280 show(mpUrlHistory->at(mUrlHistoryPos).url,mpUrlHistory->at(mUrlHistoryPos).isCustomModel); 204 281 } 205 282 } … … 266 343 className = url.toString().mid(10, url.toString().length() - 1); 267 344 // send the new className to DocumentationWidget 268 mpParentDocumentationWidget->show(className );345 mpParentDocumentationWidget->show(className, false); 269 346 } 270 347 // if it is normal http request then check if its not redirected to https … … 325 402 { 326 403 Q_UNUSED(type); 327 404 328 405 QWebView *webView = new QWebView; 329 406 QWebPage *newWeb = new QWebPage(webView); … … 331 408 webView->setPage(newWeb); 332 409 webView->show(); 333 410 334 411 return webView; 335 412 } -
trunk/OMEdit/OMEditGUI/DocumentationWidget.h
r12926 r13400 47 47 class DocumentationEditor; 48 48 49 class UrlSrc 50 { 51 public: 52 QString url; 53 bool isCustomModel; 54 55 UrlSrc(QString u, bool i){url = u; isCustomModel = i;} 56 }; 57 49 58 class DocumentationWidget : public QWidget 50 59 { 51 60 Q_OBJECT 52 61 private: 53 bool mIsCustomModel; 62 QList<UrlSrc> * mpUrlHistory; 63 int mUrlHistoryPos; 54 64 public slots: 55 65 void editDocumentation(); 56 66 void saveChanges(); 67 void back(); 68 void forward(); 57 69 public: 58 70 DocumentationWidget(MainWindow *pParent); 59 71 ~DocumentationWidget(); 60 void show(QString className );72 void show(QString className, bool isCustomModel); 61 73 void showDocumentationEditView(QString className); 62 void setIsCustomModel(bool isCustomModel);63 bool isCustomModel();64 74 65 75 MainWindow *mpParentMainWindow; … … 70 80 QPushButton *mpEditButton; 71 81 QPushButton *mpSaveButton; 82 QPushButton *mpForwardButton; 83 QPushButton *mpBackButton; 72 84 QDialogButtonBox *mpButtonBox; 73 85 QFile mDocumentationFile; -
trunk/OMEdit/OMEditGUI/LibraryWidget.cpp
r11739 r13400 875 875 pMainWindow->mpDocumentationDockWidget->show(); 876 876 LibraryTreeNode *pItem = dynamic_cast<LibraryTreeNode*>(mpParentLibraryWidget->mSelectedLibraryNode); 877 pMainWindow->mpDocumentationWidget->setIsCustomModel(false); 878 pMainWindow->mpDocumentationWidget->show(pItem->mNameStructure); 877 pMainWindow->mpDocumentationWidget->show(pItem->mNameStructure,false); 879 878 } 880 879 -
trunk/OMEdit/OMEditGUI/ProjectTabWidget.cpp
r11739 r13400 888 888 889 889 void GraphicsView::createBitmapShape(QPointF point) 890 { 890 { 891 891 if (mpParentProjectTab->isReadOnly()) 892 892 return; … … 1744 1744 { 1745 1745 mpParentProjectTabWidget->mpParentMainWindow->mpDocumentationDockWidget->show(); 1746 mpParentProjectTabWidget->mpParentMainWindow->mpDocumentationWidget->setIsCustomModel(true); 1747 mpParentProjectTabWidget->mpParentMainWindow->mpDocumentationWidget->show(mModelNameStructure); 1746 mpParentProjectTabWidget->mpParentMainWindow->mpDocumentationWidget->show(mModelNameStructure,true); 1748 1747 } 1749 1748 -
trunk/OMEdit/README.txt
r13271 r13400 23 23 - Load the file OMEditGUI/OMEditGUI.pro in Qt Creator IDE. Qt Creator is included in Qt SDK. 24 24 - Build and run the project. 25 - Copy omniORB416_rt.dll, omniORB416_rtd.dll, omnithread34_rt.dll and omnithread34_rtd.dll from c:/OMDev/ omniORB-4.1.6-mingw/bin/x86_win32 to /location-where-OMEdit.exe-is-created.26 - Copy qwt5.dll and qwtd5.dll from c:/OMDev/ qwt-5.2.1-mingw/lib to /location-where-OMEdit.exe-is-created.25 - Copy omniORB416_rt.dll, omniORB416_rtd.dll, omnithread34_rt.dll and omnithread34_rtd.dll from c:/OMDev/lib/omniORB-4.1.6-mingw/bin/x86_win32 to /location-where-OMEdit.exe-is-created. 26 - Copy qwt5.dll and qwtd5.dll from c:/OMDev/lib/qwt-5.2.1-mingw/lib to /location-where-OMEdit.exe-is-created. 27 27 28 28 Linux
Note: See TracChangeset
for help on using the changeset viewer.