Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8239_unused_undo_redo_co…
Browse files Browse the repository at this point in the history
…de_applicationwindow'
  • Loading branch information
martyngigg committed Nov 28, 2013
2 parents a1fef3f + e87d251 commit ee3c1ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 71 deletions.
66 changes: 0 additions & 66 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
#include <QSpinBox>
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QUndoStack>
#include <QUndoView>
#include <QSignalMapper>
#include <QDesktopWidget>
#include <QPair>
Expand Down Expand Up @@ -413,16 +411,6 @@ void ApplicationWindow::init(bool factorySettings, const QStringList& args)
explorerSplitter->setSizes( splitterSizes << 45 << 45);
explorerWindow->hide();

undoStackWindow = new QDockWidget(this);
undoStackWindow->setObjectName("undoStackWindow"); // this is needed for QMainWindow::restoreState()
undoStackWindow->setWindowTitle(tr("Undo Stack"));
addDockWidget(Qt::RightDockWidgetArea, undoStackWindow);

d_undo_view = new QUndoView(undoStackWindow);
d_undo_view->setCleanIcon(QIcon(getQPixmap("filesave_xpm")));
undoStackWindow->setWidget(d_undo_view);
undoStackWindow->hide();

// Needs to be done after initialization of dock windows,
// because we now use QDockWidget::toggleViewAction()
createActions();
Expand Down Expand Up @@ -1120,7 +1108,6 @@ void ApplicationWindow::insertTranslatedStrings()

explorerWindow->setWindowTitle(tr("Project Explorer"));
logWindow->setWindowTitle(tr("Results Log"));
undoStackWindow->setWindowTitle(tr("Undo Stack"));
displayBar->setWindowTitle(tr("Data Display"));
plotTools->setWindowTitle(tr("Plot"));
standardTools->setWindowTitle(tr("Standard Tools"));
Expand Down Expand Up @@ -1436,11 +1423,6 @@ void ApplicationWindow::customMenu(MdiSubWindow* w)
// these use the same keyboard shortcut (Ctrl+Return) and should not be enabled at the same time
actionTableRecalculate->setEnabled(false);

// clear undo stack view (in case window is not a matrix)
d_undo_view->setStack(0);
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);

if(w){
actionPrintAllPlots->setEnabled(projectHas2DPlots());
actionPrint->setEnabled(true);
Expand Down Expand Up @@ -1545,9 +1527,6 @@ void ApplicationWindow::customMenu(MdiSubWindow* w)
matrixMenuAboutToShow();
myMenuBar()->insertItem(tr("&Analysis"), analysisMenu);
analysisMenuAboutToShow();
d_undo_view->setEmptyLabel(w->objectName() + ": " + tr("Empty Stack"));
QUndoStack *stack = dynamic_cast<Matrix *>(w)->undoStack();
d_undo_view->setStack(stack);

} else if (w->isA("Note")) {
actionSaveTemplate->setEnabled(false);
Expand Down Expand Up @@ -3429,10 +3408,6 @@ void ApplicationWindow::initMatrix(Matrix* m, const QString& caption)

addMdiSubWindow(m);

QUndoStack *stack = m->undoStack();
connect(stack, SIGNAL(canUndoChanged(bool)), actionUndo, SLOT(setEnabled(bool)));
connect(stack, SIGNAL(canRedoChanged(bool)), actionRedo, SLOT(setEnabled(bool)));

connect(m, SIGNAL(modifiedWindow(MdiSubWindow*)), this, SLOT(updateMatrixPlots(MdiSubWindow *)));

emit modified();
Expand Down Expand Up @@ -9219,26 +9194,6 @@ void ApplicationWindow::fileMenuAboutToShow()

void ApplicationWindow::editMenuAboutToShow()
{
MdiSubWindow *w = activeWindow();
if (!w){
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);
return;
}

if (qobject_cast<Note *>(w)){
QTextDocument* doc = dynamic_cast<Note*>(w)->editor()->document();
actionUndo->setEnabled(doc->isUndoAvailable());
actionRedo->setEnabled(doc->isRedoAvailable());
} else if (qobject_cast<Matrix *>(w)){
QUndoStack *stack = (dynamic_cast<Matrix*>(w))->undoStack();
actionUndo->setEnabled(stack->canUndo());
actionRedo->setEnabled(stack->canRedo());
} else {
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);
}

reloadCustomActions();
}

Expand Down Expand Up @@ -12692,14 +12647,6 @@ void ApplicationWindow::createActions()
actionLoad = new QAction(QIcon(getQPixmap("import_xpm")), tr("&Import ASCII..."), this);
connect(actionLoad, SIGNAL(activated()), this, SLOT(importASCII()));

actionUndo = new QAction(QIcon(getQPixmap("undo_xpm")), tr("&Undo"), this);
actionUndo->setShortcut( tr("Ctrl+Z") );
connect(actionUndo, SIGNAL(activated()), this, SLOT(undo()));

actionRedo = new QAction(QIcon(getQPixmap("redo_xpm")), tr("&Redo"), this);
actionRedo->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Z));
connect(actionRedo, SIGNAL(activated()), this, SLOT(redo()));

actionCopyWindow = new QAction(QIcon(getQPixmap("duplicate_xpm")), tr("&Duplicate"), this);
connect(actionCopyWindow, SIGNAL(activated()), this, SLOT(clone()));

Expand All @@ -12726,8 +12673,6 @@ void ApplicationWindow::createActions()
actionShowLog = logWindow->toggleViewAction();
actionShowLog->setIcon(getQPixmap("log_xpm"));

actionShowUndoStack = undoStackWindow->toggleViewAction();

actionAddLayer = new QAction(QIcon(getQPixmap("newLayer_xpm")), tr("Add La&yer"), this);
actionAddLayer->setShortcut( tr("Alt+L") );
connect(actionAddLayer, SIGNAL(activated()), this, SLOT(addLayer()));
Expand Down Expand Up @@ -13530,14 +13475,6 @@ void ApplicationWindow::translateActionsStrings()
actionLoad->setToolTip(tr("Import data file(s)"));
actionLoad->setShortcut(tr("Ctrl+K"));

actionUndo->setMenuText(tr("&Undo"));
actionUndo->setToolTip(tr("Undo changes"));
actionUndo->setShortcut(tr("Ctrl+Z"));

actionRedo->setMenuText(tr("&Redo"));
actionRedo->setToolTip(tr("Redo changes"));
actionRedo->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Z));

actionCopyWindow->setMenuText(tr("&Duplicate"));
actionCopyWindow->setToolTip(tr("Duplicate window"));

Expand Down Expand Up @@ -13566,9 +13503,6 @@ void ApplicationWindow::translateActionsStrings()
actionShowLog->setMenuText(tr("Results &Log"));
actionShowLog->setToolTip(tr("Results Log"));

actionShowUndoStack->setMenuText(tr("&Undo/Redo Stack"));
actionShowUndoStack->setToolTip(tr("Show available undo/redo commands"));

#ifdef SCRIPTING_PYTHON
actionShowScriptWindow->setMenuText(tr("&Script Window"));
actionShowScriptWindow->setToolTip(tr("Script Window"));
Expand Down
7 changes: 2 additions & 5 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class QToolBar;
//class QAssistantClient;
class QLocale;
class QMdiArea;
class QUndoView;
class QSignalMapper;

class Matrix;
Expand Down Expand Up @@ -1375,7 +1374,7 @@ public slots:
ScriptingWindow *scriptingWindow; //Mantid
Script *m_iface_script;
QTranslator *appTranslator, *qtTranslator;
QDockWidget *explorerWindow, *undoStackWindow;
QDockWidget *explorerWindow;
MantidQt::MantidWidgets::MessageDisplay *resultsLog;
QMdiArea *d_workspace;

Expand All @@ -1398,7 +1397,7 @@ public slots:
QAction *actionNewProject, *actionNewNote, *actionNewTable, *actionNewFunctionPlot,*actionSaveFile;
QAction *actionNewSurfacePlot, *actionNewMatrix, *actionNewGraph, *actionNewFolder;
QAction *actionOpen, *actionLoadImage, *actionScriptRepo, *actionSaveProject, *actionSaveProjectAs, *actionImportImage,*actionLoadFile,*actionOpenProj;
QAction *actionLoad, *actionUndo, *actionRedo;
QAction *actionLoad;
QAction *actionCopyWindow, *actionShowAllColumns, *actionHideSelectedColumns;
QAction *actionCutSelection, *actionCopySelection, *actionPasteSelection, *actionClearSelection;
QAction *actionShowExplorer, *actionShowLog, *actionAddLayer, *actionShowLayerDialog, *actionAutomaticLayout,*actionclearAllMemory, *actionreleaseFreeMemory;
Expand Down Expand Up @@ -1462,7 +1461,6 @@ public slots:
QAction *Box, *Frame, *None;
QAction *front, *back, *right, *left, *ceil, *floor, *floordata, *flooriso, *floornone;
QAction *wireframe, *hiddenline, *polygon, *filledmesh, *pointstyle, *barstyle, *conestyle, *crossHairStyle;
QAction *actionShowUndoStack;
QActionGroup *coord, *floorstyle, *grids, *plotstyle, *dataTools;
QAction *actionPanPlot;
QAction *actionWaterfallPlot;
Expand All @@ -1472,7 +1470,6 @@ public slots:

QList<QAction *> m_interfaceActions;

QUndoView *d_undo_view;
/// list of mantidmatrix windows opened from project file.
QList<MantidMatrix*> m_mantidmatrixWindows;

Expand Down

0 comments on commit ee3c1ee

Please sign in to comment.