src/colorSelectDialog.cpp

changeset 455
c5d14d112034
parent 421
7d26db0be944
child 461
fbcc91ae1dd2
--- a/src/colorSelectDialog.cpp	Sat Aug 17 11:48:27 2013 +0300
+++ b/src/colorSelectDialog.cpp	Sun Aug 18 15:33:00 2013 +0300
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "misc.h"
 #include "ui_colorsel.h"
+#include "build/moc_colorSelectDialog.cpp"
 
 static const int g_numColumns = 16;
 static const short g_squareSize = 32;
@@ -36,43 +37,39 @@
 extern_cfg (float, gl_maincolor_alpha);
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 ColorSelector::ColorSelector (short defval, QWidget* parent) : QDialog (parent) {
 	// Remove the default color if it's invalid
 	if (!::getColor (defval))
 		defval = -1;
-
+	
 	m_firstResize = true;
 	ui = new Ui_ColorSelUI;
 	ui->setupUi (this);
-
+	
 	m_scene = new QGraphicsScene;
 	ui->viewport->setScene (m_scene);
 	setSelection (::getColor (defval));
-
+	
 	// not really an icon but eh
 	m_scene->setBackgroundBrush (getIcon ("checkerboard"));
-
 	drawScene();
-
+	
 	int width = viewportWidth();
 	ui->viewport->setMinimumWidth (width);
 	ui->viewport->setMaximumWidth (width);
-
+	
 	drawColorInfo();
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 ColorSelector::~ColorSelector() {
 	delete ui;
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 void ColorSelector::drawScene() {
 	const int numCols = g_numColumns;
 	const int square = g_squareSize;
@@ -119,22 +116,19 @@
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 int ColorSelector::numRows() const {
 	return (MAX_COLORS / g_numColumns);
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 int ColorSelector::viewportWidth() const {
 	return g_numColumns * g_squareSize + 21;
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 void ColorSelector::drawColorInfo() {
 	if (!sel()) {
 		ui->colorLabel->setText ("---");
@@ -145,8 +139,7 @@
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 void ColorSelector::resizeEvent (QResizeEvent* ev) {
 	// If this is the first resize, check if we need to scroll down to see the
 	// currently selected color. We cannot do this in the constructor because the
@@ -167,8 +160,7 @@
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 void ColorSelector::mousePressEvent (QMouseEvent* event) {
 	QPointF scenepos = ui->viewport->mapToScene (event->pos());
 	
@@ -187,8 +179,7 @@
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
+// -----------------------------------------------------------------------------
 bool ColorSelector::getColor (short& val, short int defval, QWidget* parent) {
 	ColorSelector dlg (defval, parent);
 	
@@ -198,6 +189,4 @@
 	}
 	
 	return false;
-}
-
-#include "build/moc_colorSelectDialog.cpp"
\ No newline at end of file
+}
\ No newline at end of file

mercurial