Commits

Andreas Tscharner committed 569d121

gui: Remove overly complicated ComboBox in Treeview code

It has not worked properly anyway

  • Participants
  • Parent commits 005c469

Comments (0)

Files changed (9)

src/gui/ComboModels.cxx

-/*
- * ComboModels.cxx
- *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-
-#include "ComboModels.hxx"
-
-
-CompTypeModelColumns::CompTypeModelColumns()
-{
-	this->add(FCompTypeName);
-	this->add(FCompTypeData);
-}
-
-
-EncTypeModelColumns::EncTypeModelColumns()
-{
-	this->add(FEncTypeName);
-	this->add(FEncTypeData);
-}

src/gui/ComboModels.hxx

-/*
- * ComboModels.hxx
- *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-
-/*! \file ComboModels.hxx
- *
- * This file contains the declaration of the models of both combo boxes,
- * the compression type combo and the encryption type combo
- *
- * \author Andreas Tscharner
- * \date 2012-09-01
- */
-
-
-#ifndef __COMBOMODELS_HXX__
-#define __COMBOMODELS_HXX__
-
-
-#include <gtkmm/treemodelcolumn.h>
-#include "../include/CompressDecompress.hxx"
-#include "../include/EncryptDecrypt.hxx"
-
-
-/*! \class CompTypeModelColumns
- *  \brief Column model for compression type combo box
- *
- * This class defines the columns for the compression type combo box
- */
-class CompTypeModelColumns : public Gtk::TreeModelColumnRecord
-{
-	public:
-		Gtk::TreeModelColumn<Glib::ustring> FCompTypeName;           //!< Name of compression type
-		Gtk::TreeModelColumn<lrc::CompressionType> FCompTypeData;    //!< Actual type data of compression type
-
-	public:
-		/*! \brief Constructor
-		 *
-		 * The constructor sets the columns for the compression type up
-		 */
-		CompTypeModelColumns();
-};
-
-/*! \class EncTypeModelColumns
- *  \brief Column model for encryption type combo box
- *
- * This class defines the columns for the encryption type combo box
- */
-class EncTypeModelColumns : public Gtk::TreeModelColumnRecord
-{
-	public:
-		Gtk::TreeModelColumn<Glib::ustring> FEncTypeName;            //!< Name of encryption type
-		Gtk::TreeModelColumn<lrc::EncryptionType> FEncTypeData;      //!< Actual type data of encryption type
-
-	public:
-		/*! \brief Constructor
-		 *
-		 * The constructor sets the columns for the encryption type up
-		 */
-		EncTypeModelColumns();
-};
-
-
-#endif /* __COMBOMODELS_HXX__ */

src/gui/ListHandler.cxx

 /*
  * ListHandler.cxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
 {
 	m_listResEntries = p_listResEntries;
 	m_resColModel = p_resColModel;
-
-	FCompColModel = new CompTypeModelColumns();
-	FEncColModel = new EncTypeModelColumns();
 }
 
 ListHandler::~ListHandler()
 {
-	delete FEncColModel;
-	delete FCompColModel;
 }
 
 int ListHandler::newFilesAdded(std::vector<std::string> p_newFiles)
 		singleRow[m_resColModel->FUniqueResID] = "";
 		singleRow[m_resColModel->FResFilename] = singleEntry;
 		singleRow[m_resColModel->FCompressTypeName] = "Keine";
-//		singleRow[m_resColModel->FCompChoices] = FCompColModel;
 #ifndef NO_ENCRYPTION
 		singleRow[m_resColModel->FEncryptTypeName] = "Keine";
-//		singleRow[m_resColModel->FEncChoices] = FEncColModel;
 		singleRow[m_resColModel->FEncPassword] = "";
 #endif
 	};

src/gui/ListHandler.hxx

 /*
  * ListHandler.hxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
  * removing new entries
  *
  * \author Andreas Tscharner
- * \date 2012-08-31
+ * \date 2013-03-09
  */
 
 
 
 #include <gtkmm/liststore.h>
 #include <gtkmm/treeselection.h>
-#include "ComboModels.hxx"
 #include "ResColumnModel.hxx"
 
 
 		ResColumnModel *m_resColModel;                 //!< Class that defines the column model for the list store
 
 	public:
-		CompTypeModelColumns *FCompColModel;//!< Class that defines the column model for the compression type list store
-		EncTypeModelColumns *FEncColModel;  //!< Class that defines the column model for the encryption type list store
-
-	public:
 		/*! \brief Constructor
 		 *
 		 * The constructor expects a reference to the list store and a

src/gui/MainWindow.cxx

 /*
  * MainWindow.cxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
 #include "../include/EncryptDecrypt.hxx"
 #include "MainWindow.hxx"
 #include "AddRemoveHandlers.hxx"
-#include "ComboModels.hxx"
 #include "ResColumnModel.hxx"
 
 #ifdef HAVE_CONFIG_H
 MainWindow::MainWindow(Gtk::Window *p_mainWin, Glib::RefPtr<Gtk::Builder> p_refBuilder)
 {
 	Gtk::TreeView *resFileView;
-	Gtk::TreeModel::Row aRow;
-	Gtk::TreeView::Column *compCol;
-	Gtk::TreeView::Column *encCol;
-	Gtk::CellRendererCombo *compRenderer;
-	Gtk::CellRendererCombo *encRenderer;
 
 
 	m_mainWindow = p_mainWin;
 	m_listHandler = new ListHandler(m_listResFiles, m_resColModel);
 	m_addRemove->setListHandler(m_listHandler);
 
-	m_listCompTypes = Gtk::ListStore::create(*m_listHandler->FCompColModel);
-	aRow = *(m_listCompTypes->append());
-	aRow[m_listHandler->FCompColModel->FCompTypeName] = "Keine";
-	aRow[m_listHandler->FCompColModel->FCompTypeData] = lrc::NoneCompression;
-	aRow = *(m_listCompTypes->append());
-	aRow[m_listHandler->FCompColModel->FCompTypeName] = "zLib";
-	aRow[m_listHandler->FCompColModel->FCompTypeData] = lrc::zLibCompression;
-	aRow = *(m_listCompTypes->append());
-	aRow[m_listHandler->FCompColModel->FCompTypeName] = "bzip2";
-	aRow[m_listHandler->FCompColModel->FCompTypeData] = lrc::bz2LibCompression;
-
-	m_listEncTypes = Gtk::ListStore::create(*m_listHandler->FEncColModel);
-	aRow = *(m_listEncTypes->append());
-	aRow[m_listHandler->FEncColModel->FEncTypeName] = "Keine";
-	aRow[m_listHandler->FEncColModel->FEncTypeData] = lrc::NoneEncryption;
-#ifndef NO_ENCRYPTION
-	aRow = *(m_listEncTypes->append());
-	aRow[m_listHandler->FEncColModel->FEncTypeName] = "Serpent";
-	aRow[m_listHandler->FEncColModel->FEncTypeData] = lrc::SerpentEncryption;
-#endif
-
 	m_refBuilder->get_widget("resTreeView", resFileView);
 	resFileView->set_model(m_listResFiles);
 
 	resFileView->append_column_editable("Resource ID", m_resColModel->FUniqueResID);
 	resFileView->append_column("Dateiname", m_resColModel->FResFilename);
-	//resFileView->append_column("Komprimierung", m_resColModel->FCompressTypeName);
-	compCol = Gtk::manage(new Gtk::TreeView::Column("Komprimierung"));
-	compRenderer = Gtk::manage(new Gtk::CellRendererCombo);
-	compCol->pack_start(*compRenderer);
-	resFileView->append_column(*compCol);
-#ifdef GLIBMM_PROPERTIES_ENABLED
-	compCol->add_attribute(compRenderer->property_text(), m_resColModel->FCompressTypeName);
-#else
-	compCol->add_ttribute(*compRenderer, "Keine", m_resColModel->FCompressTypeName);
-#endif /* GLIBMM_PROPERTIES_ENABLED */
-
+	resFileView->append_column("Komprimierung", m_resColModel->FCompressTypeName);
 #ifndef NO_ENCRYPTION
-	//resFileView->append_column("Verschlüsselung", m_resColModel->FEncryptTypeName);
-	encCol = Gtk::manage(new Gtk::TreeView::Column("Verschlüsselung"));
-	encRenderer = Gtk::manage(new Gtk::CellRendererCombo);
-	encCol->pack_start(*encRenderer);
-	resFileView->append_column(*encCol);
-#ifdef GLIBMM_PROPERTIES_ENABLED
-	encCol->add_attribute(encRenderer->property_text(), m_resColModel->FEncryptTypeName);
-#else
-	encCol->add_ttribute(*encRenderer, "Keine", m_resColModel->FEncryptTypeName);
-#endif /* GLIBMM_PROPERTIES_ENABLED */
+	resFileView->append_column("Verschlüsselung", m_resColModel->FEncryptTypeName);
 	resFileView->append_column_editable("Passwort", m_resColModel->FEncPassword);
 #endif /* NO_ENCRYPTION */
 }

src/gui/MainWindow.hxx

 /*
  * MainWindow.hxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
  * classes
  *
  * \author Andreas Tscharner
- * \date 2012-09-01
+ * \date 2013-03-09
  */
 
 
 		Gtk::Window *m_mainWindow;     //!< Reference to main window class
 		Glib::RefPtr<Gtk::Builder> m_refBuilder;     //!< Reference to builder that created the UI from XML
 		Glib::RefPtr<Gtk::ListStore> m_listResFiles; //!< Reference to list store for the main list view
-		Glib::RefPtr<Gtk::ListStore> m_listCompTypes;//!< Reference to list store for the compression types combo
-		Glib::RefPtr<Gtk::ListStore> m_listEncTypes; //!< Reference to list store for the encryption types combo
 
 		AddRemoveHandlers *m_addRemove;//!< Class instance to handle the "Add" and "Remove" button
 		ResColumnModel *m_resColModel; //!< Class that defines the column model for the list store

src/gui/Makefile.am

 #      Makefile.am
 #
-#      Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+#      Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
 #
 #      This program is free software; you can redistribute it and/or modify
 #      it under the terms of the GNU Lesser General Public License as
 lrcResourceEditor_SOURCES = MainWindow.hxx MainWindow.cxx               \
                             AddRemoveHandlers.hxx AddRemoveHandlers.cxx \
                             ResColumnModel.hxx ResColumnModel.cxx       \
-                            ComboModels.hxx ComboModels.cxx             \
                             ListHandler.hxx ListHandler.cxx             \
                             lrcResourceEditor.cxx
 

src/gui/ResColumnModel.cxx

 /*
  * ResColumnModel.cxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
 	this->add(FUniqueResID);
 	this->add(FResFilename);
 	this->add(FCompressTypeName);
-	this->add(FCompChoices);
 #ifndef NO_ENCRYPTION
 	this->add(FEncryptTypeName);
-	this->add(FEncChoices);
 	this->add(FEncPassword);
 #endif
 }

src/gui/ResColumnModel.hxx

 /*
  * ResColumnModel.hxx
  *
- * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
+ * Copyright 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
  *
  * 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
  * main part of the main window).
  *
  * \author Andreas Tscharner
- * \date 2012-09-02
+ * \date 2013-03-09
  */
 
 
 		Gtk::TreeModelColumn<Glib::ustring> FUniqueResID;            //!< ID for resource
 		Gtk::TreeModelColumn<Glib::ustring> FResFilename;            //!< Filename for resource
 		Gtk::TreeModelColumn<Glib::ustring> FCompressTypeName;       //!< Compression type for resource
-		Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel>> FCompChoices;  //!< Combobox to select compression
 		Gtk::TreeModelColumn<Glib::ustring> FEncryptTypeName;        //!< Encryption type for resource
-		Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel>> FEncChoices;   //!< Combobox to select encryption
 		Gtk::TreeModelColumn<Glib::ustring> FEncPassword;            //!< Password if resource is encrypted
 
 	public: