Removed unused class RadioGroup.

Thu, 23 Feb 2017 20:29:44 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 23 Feb 2017 20:29:44 +0200
changeset 1163
6562cd40565e
parent 1162
94e12806d741
child 1164
eabcd749759a

Removed unused class RadioGroup.

CMakeLists.txt file | annotate | diff | comparison | revisions
src/glrenderer.h file | annotate | diff | comparison | revisions
src/radioGroup.cpp file | annotate | diff | comparison | revisions
src/radioGroup.h file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
src/toolsets/extprogramtoolset.cpp file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Thu Feb 23 20:28:17 2017 +0200
+++ b/CMakeLists.txt	Thu Feb 23 20:29:44 2017 +0200
@@ -53,7 +53,6 @@
 	src/partdownloader.cpp
 	src/partdownloadrequest.cpp
 	src/primitives.cpp
-	src/radioGroup.cpp
 	src/ringFinder.cpp
 	src/version.cpp
 	src/dialogs/colorselector.cpp
@@ -119,7 +118,6 @@
 	src/partdownloader.h
 	src/partdownloadrequest.h
 	src/primitives.h
-	src/radioGroup.h
 	src/ringFinder.h
 	src/transform.h
 	src/dialogs/colorselector.h
--- a/src/glrenderer.h	Thu Feb 23 20:28:17 2017 +0200
+++ b/src/glrenderer.h	Thu Feb 23 20:29:44 2017 +0200
@@ -27,7 +27,6 @@
 class GLCompiler;
 class MessageManager;
 class QDialogButtonBox;
-class RadioGroup;
 class QDoubleSpinBox;
 class QSpinBox;
 class QLineEdit;
--- a/src/radioGroup.cpp	Thu Feb 23 20:28:17 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 - 2017 Teemu 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/>.
- */
-
-// I still find the radio group useful... find a way to use this in Designer.
-// I probably need to look into how to make Designer plugins.
-// TODO: try make this usable in Designer
-
-#include <QBoxLayout>
-#include <QRadioButton>
-#include <QButtonGroup>
-#include <QCheckBox>
-#include <map>
-
-#include "radioGroup.h"
-
-// =============================================================================
-//
-RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent)
-{
-	init (Qt::Vertical);
-}
-
-// =============================================================================
-//
-QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false)
-{
-	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
-}
-
-// =============================================================================
-//
-bool RadioGroup::isChecked (int n) const
-{
-	return m_buttonGroup->checkedId() == n;
-}
-
-// =============================================================================
-//
-void RadioGroup::init (Qt::Orientation orient)
-{
-	m_vert = orient == Qt::Vertical;
-
-	m_buttonGroup = new QButtonGroup;
-	m_oldId = m_curId = 0;
-	m_coreLayout = nullptr;
-
-	m_coreLayout = new QBoxLayout ( (orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
-	setLayout (m_coreLayout);
-
-	// Init the first row with a break
-	rowBreak();
-
-	connect (m_buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_buttonPressed (int)));
-	connect (m_buttonGroup, SIGNAL (buttonReleased (int)), this, SLOT (slot_buttonReleased (int)));
-}
-
-// =============================================================================
-//
-RadioGroup::RadioGroup (const QString& title, QList<char const*> entries, int const defaultId,
-						const Qt::Orientation orient, QWidget* parent) :
-	QGroupBox (title, parent),
-	m_defId (defaultId)
-{
-	init (orient);
-	m_oldId = m_defId;
-
-	for (const char* entry : entries)
-		addButton (entry);
-}
-
-// =============================================================================
-//
-void RadioGroup::rowBreak()
-{
-	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
-	m_currentLayout = newLayout;
-	m_layouts << newLayout;
-
-	m_coreLayout->addLayout (newLayout);
-}
-
-// =============================================================================
-//
-void RadioGroup::addButton (QString entry)
-{
-	QRadioButton* button = new QRadioButton (entry);
-	addButton (button);
-}
-
-// =============================================================================
-//
-void RadioGroup::addButton (QRadioButton* button)
-{
-	bool const selectThis = (m_curId == m_defId);
-
-	m_objects << button;
-	m_buttonGroup->addButton (button, m_curId++);
-	m_currentLayout->addWidget (button);
-
-	if (selectThis)
-		button->setChecked (true);
-}
-
-// =============================================================================
-//
-RadioGroup& RadioGroup::operator<< (QRadioButton* button)
-{
-	addButton (button);
-	return *this;
-}
-
-// =============================================================================
-//
-RadioGroup& RadioGroup::operator<< (const char* entry)
-{
-	addButton (entry);
-	return *this;
-}
-
-// =============================================================================
-//
-void RadioGroup::setCurrentRow (int row)
-{
-	m_currentLayout = m_layouts[row];
-}
-
-// =============================================================================
-//
-int RadioGroup::value() const
-{
-	return m_buttonGroup->checkedId();
-}
-
-// =============================================================================
-//
-void RadioGroup::setValue (int val)
-{
-	m_buttonGroup->button (val)->setChecked (true);
-}
-
-// =============================================================================
-//
-QRadioButton* RadioGroup::operator[] (int n) const
-{
-	return m_objects[n];
-}
-
-// =============================================================================
-//
-void RadioGroup::slot_buttonPressed (int btn)
-{
-	emit buttonPressed (btn);
-
-	m_oldId = m_buttonGroup->checkedId();
-}
-
-// =============================================================================
-//
-void RadioGroup::slot_buttonReleased (int btn)
-{
-	emit buttonReleased (btn);
-	int newid = m_buttonGroup->checkedId();
-
-	if (m_oldId != newid)
-		emit valueChanged (newid);
-}
-
-// =============================================================================
-//
-RadioGroup::Iterator RadioGroup::begin()
-{
-	return m_objects.begin();
-}
-
-// =============================================================================
-//
-RadioGroup::Iterator RadioGroup::end()
-{
-	return m_objects.end();
-}
--- a/src/radioGroup.h	Thu Feb 23 20:28:17 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- *  LDForge: LDraw parts authoring CAD
- *  Copyright (C) 2013 - 2017 Teemu 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/>.
- */
-
-#pragma once
-#include <QGroupBox>
-#include <QSpinBox>
-#include <map>
-#include "main.h"
-#include "basics.h"
-
-class QIcon;
-class QCheckBox;
-class QButtonGroup;
-class QBoxLayout;
-class QRadioButton;
-
-//
-// Convenience widget - is a groupbox of radio buttons.
-//
-class RadioGroup : public QGroupBox
-{
-	Q_OBJECT
-
-public:
-	typedef QList<QRadioButton*>::Iterator Iterator;
-
-	explicit RadioGroup()
-	{
-		init (Qt::Vertical);
-	}
-
-	explicit RadioGroup (QWidget* parent = nullptr) : QGroupBox (parent)
-	{
-		init (Qt::Vertical);
-	}
-
-	explicit RadioGroup (const QString& title, QWidget* parent = nullptr);
-	explicit RadioGroup (const QString& title, QList<char const*> entries, int const defaultId,
-		const Qt::Orientation orient = Qt::Vertical, QWidget* parent = nullptr);
-
-	void            addButton	(QString entry);
-	void            addButton	(QRadioButton* button);
-	Iterator        begin();
-	Iterator        end();
-	void            init (Qt::Orientation orient);
-	bool            isChecked (int n) const;
-	void            rowBreak();
-	void            setCurrentRow (int row);
-	void            setValue (int val);
-	int             value() const;
-
-	QRadioButton*   operator[] (int n) const;
-	RadioGroup&     operator<< (QRadioButton* button);
-	RadioGroup&     operator<< (const char* entry);
-
-signals:
-	void buttonPressed (int btn);
-	void buttonReleased (int btn);
-	void valueChanged (int val);
-
-private:
-	QList<QRadioButton*> m_objects;
-	QList<QBoxLayout*> m_layouts;
-	QBoxLayout* m_coreLayout;
-	QBoxLayout* m_currentLayout;
-	bool m_vert;
-	int m_curId, m_defId, m_oldId;
-	QButtonGroup* m_buttonGroup;
-
-	Q_DISABLE_COPY (RadioGroup)
-
-private slots:
-	void slot_buttonPressed (int btn);
-	void slot_buttonReleased (int btn);
-};
--- a/src/toolsets/algorithmtoolset.cpp	Thu Feb 23 20:28:17 2017 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Thu Feb 23 20:29:44 2017 +0200
@@ -24,7 +24,6 @@
 #include "../main.h"
 #include "../lddocument.h"
 #include "../miscallenous.h"
-#include "../radioGroup.h"
 #include "../glrenderer.h"
 #include "../colors.h"
 #include "../mathfunctions.h"
--- a/src/toolsets/extprogramtoolset.cpp	Thu Feb 23 20:28:17 2017 +0200
+++ b/src/toolsets/extprogramtoolset.cpp	Thu Feb 23 20:29:44 2017 +0200
@@ -32,7 +32,6 @@
 #include "../miscallenous.h"
 #include "../mainwindow.h"
 #include "../lddocument.h"
-#include "../radioGroup.h"
 #include "../editHistory.h"
 #include "../documentmanager.h"
 #include "../grid.h"

mercurial