removed the history dialog, it doesn't fit in with the new history system

Sun, 07 Jul 2013 03:25:28 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 07 Jul 2013 03:25:28 +0300
changeset 355
c2db4aa66b5d
parent 354
b32d4d66cb6e
child 356
08398f57aba3

removed the history dialog, it doesn't fit in with the new history system

src/gui.cpp file | annotate | diff | comparison | revisions
src/gui_editactions.cpp file | annotate | diff | comparison | revisions
src/history.cpp file | annotate | diff | comparison | revisions
src/historyDialog.cpp file | annotate | diff | comparison | revisions
src/historyDialog.h file | annotate | diff | comparison | revisions
--- a/src/gui.cpp	Sun Jul 07 03:19:09 2013 +0300
+++ b/src/gui.cpp	Sun Jul 07 03:25:28 2013 +0300
@@ -212,7 +212,6 @@
 	addMenuAction ("clearOverlay");
 	menu->addSeparator ();
 	addMenuAction ("screencap");
-	addMenuAction ("showHistory");
 	
 	// Insert menu
 	initMenu ("&Insert");
--- a/src/gui_editactions.cpp	Sun Jul 07 03:19:09 2013 +0300
+++ b/src/gui_editactions.cpp	Sun Jul 07 03:25:28 2013 +0300
@@ -24,7 +24,6 @@
 #include "common.h"
 #include "file.h"
 #include "colorSelectDialog.h"
-#include "historyDialog.h"
 #include "misc.h"
 #include "widgets.h"
 #include "extprogs.h"
@@ -355,11 +354,6 @@
 	g_curfile->redo ();
 }
 
-MAKE_ACTION (showHistory, "Edit History", "history", "Show the history dialog.", (0)) {
-	HistoryDialog dlg;
-	dlg.exec ();
-}
-
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
--- a/src/history.cpp	Sun Jul 07 03:19:09 2013 +0300
+++ b/src/history.cpp	Sun Jul 07 03:25:28 2013 +0300
@@ -107,8 +107,6 @@
 	
 	setOpened( false );
 	
-	log( "size: %1", m_currentArchive.size() );
-	
 	if( m_currentArchive.size() == 0 )
 		return;
 	
--- a/src/historyDialog.cpp	Sun Jul 07 03:19:09 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <qboxlayout.h>
-#include <qmessagebox.h>
-#include <QGridLayout>
-#include "historyDialog.h"
-#include "history.h"
-#include "colors.h"
-#include "file.h"
-
-EXTERN_ACTION (undo);
-EXTERN_ACTION (redo);
-
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-HistoryDialog::HistoryDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
-	historyList = new QListWidget;
-	undoButton = new QPushButton ("Undo");
-	redoButton = new QPushButton ("Redo");
-	clearButton = new QPushButton ("Clear");
-	buttons = new QDialogButtonBox (QDialogButtonBox::Close);
-	
-	historyList->setAlternatingRowColors (true);
-	
-	undoButton->setIcon (getIcon ("undo"));
-	redoButton->setIcon (getIcon ("redo"));
-	
-	connect (undoButton, SIGNAL (clicked ()), this, SLOT (slot_undo ()));
-	connect (redoButton, SIGNAL (clicked ()), this, SLOT (slot_redo ()));
-	connect (clearButton, SIGNAL (clicked ()), this, SLOT (slot_clear ()));
-	connect (buttons, SIGNAL (rejected ()), this, SLOT (reject ()));
-	connect (historyList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selChanged ()));
-	
-	QVBoxLayout* qButtonLayout = new QVBoxLayout;
-	qButtonLayout->setDirection (QBoxLayout::TopToBottom);
-	qButtonLayout->addWidget (undoButton);
-	qButtonLayout->addWidget (redoButton);
-	qButtonLayout->addWidget (clearButton);
-	qButtonLayout->addStretch ();
-	
-	QGridLayout* qLayout = new QGridLayout;
-	qLayout->setColumnStretch (0, 1);
-	qLayout->addWidget (historyList, 0, 0, 2, 1);
-	qLayout->addLayout (qButtonLayout, 0, 1);
-	qLayout->addWidget (buttons, 1, 1);
-	
-	setLayout (qLayout);
-	setWindowIcon (getIcon ("history"));
-	setWindowTitle ("Edit History");
-	
-	populateList ();
-	updateButtons ();
-	updateSelection ();
-}
-
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-void HistoryDialog::populateList () {
-	historyList->clear ();
-	
-	QListWidgetItem* qItem = new QListWidgetItem;
-	qItem->setText ("[[ initial state ]]");
-	qItem->setIcon (getIcon ("empty"));
-	historyList->addItem (qItem);
-	
-#if 0
-	for (AbstractHistoryEntry* entry : g_curfile->history ().entries ()) {
-		str text;
-		QIcon entryIcon;
-		
-		switch (entry->type ()) {
-		default:
-			text = "???";
-			break;
-		}
-		
-		QListWidgetItem* item = new QListWidgetItem;
-		item->setText (text);
-		item->setIcon (entryIcon);
-		historyList->addItem (item);
-	}
-#endif
-}
-
-// =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-void HistoryDialog::slot_undo () {
-	g_curfile->undo ();
-	updateButtons ();
-	updateSelection ();
-}
-
-// =============================================================================
-void HistoryDialog::slot_redo () {
-	g_curfile->redo ();
-	updateButtons ();
-	updateSelection ();
-}
-
-void HistoryDialog::updateSelection () {
-	historyList->setCurrentItem (historyList->item (g_curfile->history ().pos () + 1));
-}
-
-// =============================================================================
-void HistoryDialog::slot_clear () {
-	if (!confirm ("Are you sure you want to clear the edit history?\nThis cannot be undone."))
-		return; // Canceled
-	
-	g_curfile->clearHistory ();
-	populateList ();
-	updateButtons ();
-}
-
-// =============================================================================
-void HistoryDialog::updateButtons () {
-	undoButton->setEnabled (ACTION (undo)->isEnabled ());
-	redoButton->setEnabled (ACTION (redo)->isEnabled ());
-}
-
-// =============================================================================
-void HistoryDialog::slot_selChanged () {
-	if (historyList->selectedItems ().size () != 1)
-		return;
-	
-	QListWidgetItem* item = historyList->selectedItems ()[0];
-	
-	// Find the index of the edit
-	long index;
-	for (index = 0; index < historyList->count (); ++index)
-		if (historyList->item (index) == item)
-			break;
-	
-	// qHistoryList is 0-based, History is -1-based, thus decrement
-	// the index now
-	index--;
-	
-	// Seek to the selected edit by repeadetly undoing or redoing.
-	while (g_curfile->history ().pos () != index) {
-		if (g_curfile->history ().pos () > index)
-			g_curfile->undo ();
-		else
-			g_curfile->redo ();
-	}
-	
-	updateButtons ();
-}
\ No newline at end of file
--- a/src/historyDialog.h	Sun Jul 07 03:19:09 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 Santeri Piippo
- *  
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *  
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *  
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef HISTORYDIALOG_H
-#define HISTORYDIALOG_H
-
-#include <qdialog.h>
-#include <qdialogbuttonbox.h>
-#include <qlistwidget.h>
-#include <qpushbutton.h>
-#include "gui.h"
-
-class HistoryDialog : public QDialog {
-	Q_OBJECT
-	
-public:
-	explicit HistoryDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
-	void populateList ();
-
-private:
-	QListWidget* historyList;
-	QPushButton* undoButton, *redoButton, *clearButton;
-	QDialogButtonBox* buttons;
-	
-	void updateButtons ();
-	void updateSelection ();
-	
-private slots:
-	void slot_undo ();
-	void slot_redo ();
-	void slot_clear ();
-	void slot_selChanged ();
-};
-
-#endif // HISTORYDIALOG_H
\ No newline at end of file

mercurial