Check-in [f0a1250abe]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Glyphs: make initialization method names consistent
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | improvements-to-main-menu
Files: files | file ages | folders
SHA1:f0a1250abef7148ff2ed8e49915b835caa4d0a95
User & Date: tion 2019-02-16 00:08:22
Context
2019-02-16
01:20
Remove unused/deprecated methods and other code clean-up check-in: 2fc493d0b9 user: tion tags: improvements-to-main-menu
00:08
Glyphs: make initialization method names consistent check-in: f0a1250abe user: tion tags: improvements-to-main-menu
2019-02-15
23:34
MainWindow: improve constructor code check-in: 27ded31637 user: tion tags: improvements-to-main-menu
Changes

Changes to src/PortalAddressWindow.cpp.

1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
31
32
33
34
35
36
37

38

39
40
41
42
43

44
45

46
47
48
49
50
51
52
...
133
134
135
136
137
138
139
140
//==================================================================
#include "PortalAddressWindow.h"
#include "HelperFunctions.h"
//==================================================================
///////////////////
// CLASS: Glyphs //
///////////////////
//==================================================================
Glyphs::Glyphs (QWidget *parent) : QWidget (parent)

{
   initGlyphs();
   setGlyphs (QString());
   createLayout();
}
//------------------------------------------------------------------
Glyphs::Glyphs (const QString &_code)
{
   initGlyphs();
   setGlyphs (_code);
   createLayout();
}
//------------------------------------------------------------------
void Glyphs::initGlyphs()
{
   for (int i = 0; i < 12; i++)
      glyph[i] = new QPushButton;
}
//------------------------------------------------------------------
void Glyphs::setGlyphs (const QString &_code)
{
................................................................................
   QStringList ignoreThis;

   // Do not change glyph code if provided code is the same as 
   // what we already have; just redraw it. Also must be a valid 
   // glyph code.
   if ( glyph_code.toLower() != _code.toLower() &&
        (is_valid_glyph_code (_code, ignoreThis) == true) )

      glyph_code = _code;


   for (int i = 0; i < 12; i++)
   {
      // Using aliases from qrc
      if ( _code.isEmpty() == false )

         glyph[i] -> setIcon (QIcon (QString(":" + QString(glyph_code.at(
                                                i).toUpper()) + ".jpg")));

      else
         glyph[i] -> setIcon (QIcon (QString(":empty.png")));

      glyph[i] -> setIconSize (QSize(40, 40));		// (60,60) is nice, too
      glyph[i] -> setAutoFillBackground (true);
      glyph[i] -> setText (QString());
      glyph[i] -> setCheckable (false);
................................................................................
   // Note: Using hide() rather than close() seems to keep memory
   // usage more consistent while application is open.
   //QObject::connect (go_back, SIGNAL (clicked(bool)),
   //                  this, SLOT (hide()));
   //QObject::connect (exit, SIGNAL (clicked(bool)),
   //                  QApplication::instance(), SLOT (quit()));
}
//==================================================================
|


|



|
|
>

|






|




|







 







>

>





>


>







 







|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
138
139
140
141
142
143
144
145
//------------------------------------------------------------------
#include "PortalAddressWindow.h"
#include "HelperFunctions.h"
//------------------------------------------------------------------
///////////////////
// CLASS: Glyphs //
///////////////////
//------------------------------------------------------------------
Glyphs::Glyphs (QWidget *parent)
	: QWidget (parent)
{
   createGlyphs();
   setGlyphs (QString());
   createLayout();
}
//------------------------------------------------------------------
Glyphs::Glyphs (const QString &_code)
{
   createGlyphs();
   setGlyphs (_code);
   createLayout();
}
//------------------------------------------------------------------
void Glyphs::createGlyphs()
{
   for (int i = 0; i < 12; i++)
      glyph[i] = new QPushButton;
}
//------------------------------------------------------------------
void Glyphs::setGlyphs (const QString &_code)
{
................................................................................
   QStringList ignoreThis;

   // Do not change glyph code if provided code is the same as 
   // what we already have; just redraw it. Also must be a valid 
   // glyph code.
   if ( glyph_code.toLower() != _code.toLower() &&
        (is_valid_glyph_code (_code, ignoreThis) == true) )
   {
      glyph_code = _code;
	}

   for (int i = 0; i < 12; i++)
   {
      // Using aliases from qrc
      if ( _code.isEmpty() == false )
      {
         glyph[i] -> setIcon (QIcon (QString(":" + QString(glyph_code.at(
                                                i).toUpper()) + ".jpg")));
      }
      else
         glyph[i] -> setIcon (QIcon (QString(":empty.png")));

      glyph[i] -> setIconSize (QSize(40, 40));		// (60,60) is nice, too
      glyph[i] -> setAutoFillBackground (true);
      glyph[i] -> setText (QString());
      glyph[i] -> setCheckable (false);
................................................................................
   // Note: Using hide() rather than close() seems to keep memory
   // usage more consistent while application is open.
   //QObject::connect (go_back, SIGNAL (clicked(bool)),
   //                  this, SLOT (hide()));
   //QObject::connect (exit, SIGNAL (clicked(bool)),
   //                  QApplication::instance(), SLOT (quit()));
}
//------------------------------------------------------------------

Changes to src/PortalAddressWindow.h.

86
87
88
89
90
91
92
93
94
95
96
97
      */
      QPushButton *glyph[12];

		/** Initializes private variables:
		 * 
		 *  glyph_code of size zero, and empty QPushButtons for the glyphs.
		*/
      void initGlyphs();
};
//==================================================================
#endif	// __NMS_GLYPHS_H__
//==================================================================







|




86
87
88
89
90
91
92
93
94
95
96
97
      */
      QPushButton *glyph[12];

		/** Initializes private variables:
		 * 
		 *  glyph_code of size zero, and empty QPushButtons for the glyphs.
		*/
      void createGlyphs();
};
//==================================================================
#endif	// __NMS_GLYPHS_H__
//==================================================================