Skip to content

Commit

Permalink
Fixes for bug #1395
Browse files Browse the repository at this point in the history
- Added the key bindings for OMEdit.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7636 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Jan 4, 2011
1 parent f2fc061 commit d8122c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
27 changes: 23 additions & 4 deletions OMEdit/OMEditGUI/ProjectTabWidget.cpp
Expand Up @@ -1976,7 +1976,15 @@ void ProjectTabWidget::saveProjectTab(int index, bool saveAs)

if (saveAs)
{
saveModel(saveAs);
if (saveModel(saveAs))
{
// make sure we only trim * and not any letter of model name.
if (tabName.endsWith('*'))
tabName.chop(1);

setTabText(index, tabName);
pCurrentTab->mIsSaved = true;
}
}
// if not saveAs then
else
Expand Down Expand Up @@ -2016,9 +2024,20 @@ bool ProjectTabWidget::saveModel(bool saveAs)
if(pCurrentTab->mModelFileName.isEmpty() | saveAs)
{
QDir fileDialogSaveDir;
modelFileName = QFileDialog::getSaveFileName(this, tr("Save File"),
fileDialogSaveDir.currentPath(),
Helper::omFileOpenText);

if (saveAs)
{
modelFileName = QFileDialog::getSaveFileName(this, tr("Save File As"),
fileDialogSaveDir.currentPath(),
Helper::omFileOpenText);
}
else
{
modelFileName = QFileDialog::getSaveFileName(this, tr("Save File"),
fileDialogSaveDir.currentPath(),
Helper::omFileOpenText);
}

if (modelFileName.isEmpty())
{
return false;
Expand Down
16 changes: 7 additions & 9 deletions OMEdit/OMEditGUI/mainwindow.cpp
Expand Up @@ -230,6 +230,7 @@ void MainWindow::createActions()
saveAction->setStatusTip(tr("Save a file"));

saveAsAction = new QAction(QIcon(":/Resources/icons/saveas.png"), tr("Save As"), this);
saveAsAction->setShortcut(QKeySequence("Ctrl+Shift+s"));
saveAsAction->setStatusTip(tr("Save As a File"));

saveAllAction = new QAction(QIcon(":/Resources/icons/saveall.png"), tr("Save All"), this);
Expand Down Expand Up @@ -257,10 +258,13 @@ void MainWindow::createActions()
gridLinesAction->setCheckable(true);

resetZoomAction = new QAction(QIcon(":/Resources/icons/zoom100.png"), tr("Reset Zoom"), this);
resetZoomAction->setShortcut(QKeySequence("Ctrl+0"));

zoomInAction = new QAction(QIcon(":/Resources/icons/zoomIn.png"), tr("Zoom In"), this);
zoomInAction->setShortcut(QKeySequence("Ctrl++"));

zoomOutAction = new QAction(QIcon(":/Resources/icons/zoomOut.png"), tr("Zoom Out"), this);
zoomOutAction->setShortcut(QKeySequence("Ctrl+-"));

checkModelAction = new QAction(QIcon(":/Resources/icons/check.png"), tr("Check"), this);
connect(checkModelAction, SIGNAL(triggered()), SLOT(checkModel()));
Expand Down Expand Up @@ -294,6 +298,7 @@ void MainWindow::createActions()

userManualAction = new QAction(tr("User Manual"), this);
userManualAction->setStatusTip(tr("Open the User Manual"));
userManualAction->setShortcut(QKeySequence(Qt::Key_F1));
connect(userManualAction, SIGNAL(triggered()), SLOT(openUserManual()));

aboutAction = new QAction(tr("About OMEdit"), this);
Expand Down Expand Up @@ -605,15 +610,8 @@ void MainWindow::checkModel()

void MainWindow::openUserManual()
{
QUrl userManualPath;
// since in MAC OS X the url adds extra quotes to it, so we need to handle it differently.
//#ifdef Q_OS_MAC
// userManualPath = QUrl(QString("file:///").append(QString(getenv("OPENMODELICAHOME")))
// .append("/share/doc/omedit/OMEdit-UserManual.pdf"));
//#else
userManualPath = QUrl(QString("file:///").append(Helper::OpenModelicaHome.replace("\\", "/"))
.append("/share/doc/omedit/OMEdit-UserManual.pdf"));
//#endif
QUrl userManualPath (QString("file:///").append(Helper::OpenModelicaHome.replace("\\", "/"))
.append("/share/doc/omedit/OMEdit-UserManual.pdf"));
QDesktopServices::openUrl(userManualPath);
}

Expand Down

0 comments on commit d8122c1

Please sign in to comment.