Check-in [2fc493d0b9]

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

Overview
Comment:Remove unused/deprecated methods and other code clean-up
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | improvements-to-main-menu
Files: files | file ages | folders
SHA1:2fc493d0b9543ae47bbbe386f08e110e18be6524
User & Date: tion 2019-02-16 01:20:55
Context
2019-02-16
01:28
cleanup: tab to spaces check-in: 27ce672990 user: tion tags: improvements-to-main-menu
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
Changes

Changes to src/CoordinateData.cpp.

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
58
59
60
..
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
92
93
94
95
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
128
129
130
131
132
133
134

135

136
137
138
139
140
141
142
...
187
188
189
190
191
192
193

194
195
196
197
198
199
200
...
221
222
223
224
225
226
227

228
229
230
231
232
233
234
...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
//==================================================================
///////////////////////////
// CLASS: coordinateData //
///////////////////////////
//==================================================================
coordinateData::coordinateData()
{
   initCoordinates();
   initGlyphs();
}
//------------------------------------------------------------------
coordinateData::coordinateData (const QString &_code, bool isCoordinate)
{
	initCoordinates();
	initGlyphs();

   if ( isCoordinate == true )
      coordinates = _code;
   else
      glyph_code = _code;
}
//------------------------------------------------------------------
////////////////
// DESTRUCTOR //
////////////////
//------------------------------------------------------------------
coordinateData::~coordinateData()
{
   reset();



}
//------------------------------------------------------------------
///////////////////////
// COPY CONSTRUCTORS //
///////////////////////
//------------------------------------------------------------------
coordinateData::coordinateData (const coordinateData &other)
{
	initCoordinates();
	initGlyphs();

   portal = other.portal;
   coordinates = other.coordinates;
   glyph_code = other.glyph_code;
   error_info = other.error_info;
}
//------------------------------------------------------------------
coordinateData::coordinateData (coordinateData &other)
{
	initCoordinates();
	initGlyphs();

   portal = other.portal;
   coordinates = other.coordinates;
   glyph_code = other.glyph_code;
   error_info = other.error_info;
}
//------------------------------------------------------------------
................................................................................

   return (*this);
}
//------------------------------------------------------------------
coordinateData &coordinateData::operator = (coordinateData &other)
{
   // Handle self-assignment
   if ( this != &other )

   {
      portal = other.portal;
      coordinates = other.coordinates;
      glyph_code = other.glyph_code;
      error_info = other.error_info;
   }

   return (*this);
}
//------------------------------------------------------------------
//////////////////////
// PUBLIC FUNCTIONS //
//////////////////////
................................................................................
QStringList coordinateData::getErrorInfo() const
{
	return (error_info);
}
//------------------------------------------------------------------
QString coordinateData::showErrorInfo() const
{
   // Ideally this function should never be called unless
   // there is something to display from error_info.
   QString result = QString();

   if ( error_info.isEmpty() == false )
      result.append( QString("[" + getErrorInfo().join("] [") + "]") );

   return (result);
}
................................................................................
//------------------------------------------------------------------
QString coordinateData::toString() const
{
	QString result = QString();

	if ( (coordinates.isEmpty() == true && glyph_code.isEmpty() == true) 
	  || (coordinates == ":::" && glyph_code.isEmpty() == true) )

		result += "No coordinate data found." + QString ("\n");

	else
	{
		if ( coordinates.isEmpty() == false
		  && coordinates != ":::" )
		{
			result += coordinates;
			result += ", portal #" + QString::number (portal);
................................................................................
   clearGlyphCode();
   clearErrorInfo();
}
//------------------------------------------------------------------
void coordinateData::clearCoordinates()
{
	coordinates.clear();

}
//------------------------------------------------------------------
void coordinateData::clearGlyphCode()
{
	glyph_code.clear();
}
//------------------------------------------------------------------
................................................................................
          => Glyph #7, #8, #9: (coordinate_z - 0x81)
          => Glyph #10, #11, #12: (coordinate_x - 0x801)
      */
      QString coordinate_star, coordinate_x, coordinate_y, coordinate_z,
              temp_str, _glyph;
      int temp_value, offset = 0, temp_convert;
      _glyph.clear();

      // Iterate over the "strings" in _glyph, each of which is
      // a digit in the glyph code
      QStringList them_glyphs = glyph_code.split("");

      for (int i = 0; i < them_glyphs.size(); i++)
         _glyph += them_glyphs.at(i).toLocal8Bit().constData();

................................................................................
      temp_str = coordinate_x + ":" + coordinate_y + ":" + coordinate_z +
                 ":" +
                 coordinate_star;
      coordinates = (QString(temp_str).toUpper());
   }
   else
   {
      // Add invalid code segments to element info
      if ( temp_info.isEmpty() == false )
      {
         for (int i = 0; i < temp_info.size(); i++)
            addToErrorInfo (QString(temp_info.at(i)));
      }
      else
         addToErrorInfo (glyph_code);
   }
}
//------------------------------------------------------------------
void coordinateData::convertToGlyph()
................................................................................
   }
}
//------------------------------------------------------------------
///////////////////////
// PRIVATE FUNCTIONS //
///////////////////////
//------------------------------------------------------------------
void coordinateData::initGlyphs()
{
	glyph_code = QString();
}
//------------------------------------------------------------------
void coordinateData::initCoordinates()
{
	coordinates = QString();
	portal = int(1);
	error_info = QStringList();
}
//------------------------------------------------------------------
//////////////////////
// FRIEND FUNCTIONS //
//////////////////////
//------------------------------------------------------------------
QTextStream &operator >> (QTextStream &readInputInto, coordinateData &target)
{
   // Read into ins:
   //  coordinate portal glyph_code
   //
   // Error information will be determined upon conversion attempt.
   readInputInto >> target.coordinates >> target.portal;
   readInputInto >> target.glyph_code;

   return (readInputInto);







|
|




|
|













|
>
>
>








|
|









|
|







 







|
>
|
|
|
|
|
<







 







<
<







 







>

>







 







>







 







>







 







|



|







 







|




|












|







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
58
59
60
61
62
63
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91

92
93
94
95
96
97
98
...
115
116
117
118
119
120
121


122
123
124
125
126
127
128
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
...
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
...
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
//==================================================================
///////////////////////////
// CLASS: coordinateData //
///////////////////////////
//==================================================================
coordinateData::coordinateData()
{
   createCoordinates();
   createGlyphs();
}
//------------------------------------------------------------------
coordinateData::coordinateData (const QString &_code, bool isCoordinate)
{
	createCoordinates();
	createGlyphs();

   if ( isCoordinate == true )
      coordinates = _code;
   else
      glyph_code = _code;
}
//------------------------------------------------------------------
////////////////
// DESTRUCTOR //
////////////////
//------------------------------------------------------------------
coordinateData::~coordinateData()
{
	coordinates.clear();
	glyph_code.clear();
	error_info.clear();
	portal = -1;
}
//------------------------------------------------------------------
///////////////////////
// COPY CONSTRUCTORS //
///////////////////////
//------------------------------------------------------------------
coordinateData::coordinateData (const coordinateData &other)
{
	createCoordinates();
	createGlyphs();

   portal = other.portal;
   coordinates = other.coordinates;
   glyph_code = other.glyph_code;
   error_info = other.error_info;
}
//------------------------------------------------------------------
coordinateData::coordinateData (coordinateData &other)
{
	createCoordinates();
	createGlyphs();

   portal = other.portal;
   coordinates = other.coordinates;
   glyph_code = other.glyph_code;
   error_info = other.error_info;
}
//------------------------------------------------------------------
................................................................................

   return (*this);
}
//------------------------------------------------------------------
coordinateData &coordinateData::operator = (coordinateData &other)
{
   // Handle self-assignment
   if ( this == &other )
      return (*this);

   portal = other.portal;
   coordinates = other.coordinates;
   glyph_code = other.glyph_code;
   error_info = other.error_info;


   return (*this);
}
//------------------------------------------------------------------
//////////////////////
// PUBLIC FUNCTIONS //
//////////////////////
................................................................................
QStringList coordinateData::getErrorInfo() const
{
	return (error_info);
}
//------------------------------------------------------------------
QString coordinateData::showErrorInfo() const
{


   QString result = QString();

   if ( error_info.isEmpty() == false )
      result.append( QString("[" + getErrorInfo().join("] [") + "]") );

   return (result);
}
................................................................................
//------------------------------------------------------------------
QString coordinateData::toString() const
{
	QString result = QString();

	if ( (coordinates.isEmpty() == true && glyph_code.isEmpty() == true) 
	  || (coordinates == ":::" && glyph_code.isEmpty() == true) )
	{
		result += "No coordinate data found." + QString ("\n");
	}
	else
	{
		if ( coordinates.isEmpty() == false
		  && coordinates != ":::" )
		{
			result += coordinates;
			result += ", portal #" + QString::number (portal);
................................................................................
   clearGlyphCode();
   clearErrorInfo();
}
//------------------------------------------------------------------
void coordinateData::clearCoordinates()
{
	coordinates.clear();
	portal = 1;
}
//------------------------------------------------------------------
void coordinateData::clearGlyphCode()
{
	glyph_code.clear();
}
//------------------------------------------------------------------
................................................................................
          => Glyph #7, #8, #9: (coordinate_z - 0x81)
          => Glyph #10, #11, #12: (coordinate_x - 0x801)
      */
      QString coordinate_star, coordinate_x, coordinate_y, coordinate_z,
              temp_str, _glyph;
      int temp_value, offset = 0, temp_convert;
      _glyph.clear();

      // Iterate over the "strings" in _glyph, each of which is
      // a digit in the glyph code
      QStringList them_glyphs = glyph_code.split("");

      for (int i = 0; i < them_glyphs.size(); i++)
         _glyph += them_glyphs.at(i).toLocal8Bit().constData();

................................................................................
      temp_str = coordinate_x + ":" + coordinate_y + ":" + coordinate_z +
                 ":" +
                 coordinate_star;
      coordinates = (QString(temp_str).toUpper());
   }
   else
   {
      // Invalid glyph code entered. DO NOT COMPUTE coordinates.
      if ( temp_info.isEmpty() == false )
      {
         for (int i = 0; i < temp_info.size(); i++)
            addToErrorInfo (QString(temp_info.at (i)));
      }
      else
         addToErrorInfo (glyph_code);
   }
}
//------------------------------------------------------------------
void coordinateData::convertToGlyph()
................................................................................
   }
}
//------------------------------------------------------------------
///////////////////////
// PRIVATE FUNCTIONS //
///////////////////////
//------------------------------------------------------------------
void coordinateData::createGlyphs()
{
	glyph_code = QString();
}
//------------------------------------------------------------------
void coordinateData::createCoordinates()
{
	coordinates = QString();
	portal = int(1);
	error_info = QStringList();
}
//------------------------------------------------------------------
//////////////////////
// FRIEND FUNCTIONS //
//////////////////////
//------------------------------------------------------------------
QTextStream &operator >> (QTextStream &readInputInto, coordinateData &target)
{
   // Read the format:
   //  coordinate portal glyph_code
   //
   // Error information will be determined upon conversion attempt.
   readInputInto >> target.coordinates >> target.portal;
   readInputInto >> target.glyph_code;

   return (readInputInto);

Changes to src/CoordinateData.h.

1
2
3
4
5
6
7

8

9
10
11
12
13
14
15
..
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
58
59




60
61
62
63
64
65
66
67
68
69
70




71
72
73
74
75
76
77
78
79
80
81
82
83



84

85
86
87
88
89
90
91
...
157
158
159
160
161
162
163

164
165
166
167
168
169
170
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198

199
200
201
202
203
204








205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
//==================================================================
#ifndef __COORDINATE_DATA_H__
#define __COORDINATE_DATA_H__
//==================================================================
#include <QtCore>
//==================================================================
/** \class CoordinateData

 *  \brief Holds data about a coordinate and its glyph code.

 *  \details A coordinate is comprised a 19-digit hexadecimal value, 
 *  colon-separated every 4 digits. 
 *  Its corresponding glyph code is a 12-digit hexadecimal value.
 * 
 *  Valid coordinates exist between:
 * 
 *      0001:0001:0001:0001 ... 0FFF:00FF:0FFF:02FF
................................................................................
*/
class coordinateData : public QObject
{
   public:
      //////////////////
      // CONSTRUCTORS //
      //////////////////
      /** \details Default constructor. Initializes all variables to
       *  null/empty values.
      */
      coordinateData();
      /** \details Recommend constructor to initialize to a known
       *  coordinate or glyph code. By default, a coordinate is
       *  assumed to be provided as these are more common to
       *  encounter (requires less work to obtain).
       * 
       *  \param[in] _code A valid coordinate or glyph code.
       *  \param[in] isCoordinate Defines the input type.

       *  \warning No error-checking that isCoordinate correctly
       *  corresponds to the type of input _code is.
      */
      coordinateData(const QString &_code, bool isCoordinate = true);

		/** Destructor **/
		~coordinateData();

      // Copy Constructors
      /** \details Copy constructor for const CoordinateData object.
       * 
       *  \param[in] other An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData(const coordinateData &other);
      /** \overload coordinateData(coordinateData &other) **/




      coordinateData(coordinateData &other);
      
      // Assignment Operator
      /** \details Assignment operator for const CoordinateData
       *  object.
       * 
       *  \param[in] source An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData &operator = (const coordinateData &source);
      /** \overload operator=(coordinateData &source) */




      coordinateData &operator = (coordinateData &source);

      ////////////////////////////////
      // ACCESSING MEMBER FUNCTIONS //
      ////////////////////////////////
      /** \returns The glyph code of the coordinate. */
      QString getGlyphCode() const;
      /** \returns The coordinate. */
      QString getCoordinate() const;
      /** \returns The coordinate. */
      QString getCoordinates() const;
      /** \returns Error information about the code. */
      QStringList getErrorInfo() const;



      /** \returns Error information about the coordinate/glyph code. */

      QString showErrorInfo() const;
      /** \returns The portal number. */
      int getPortal() const;
      /** Prints the coordinates or glyph code in a human-readable
       *  format.
       *
       *  \returns A QString of coordinate values.
................................................................................
       *      <glyph code>
       * 
       *      0123:0045:0678:009A, portal #2
       *      000202002002
       * 
       *  \param[in,out] readInputInto The stream to read data from.
       *  \param[in,out] target The object to read data into.

       *  \warning Avoid using as this is not fully tested, nor functional.
      */
      friend QTextStream &operator >> (QTextStream &readInputInto, coordinateData &target);
      /** \details Outputs the contents of CoordinateData object in a
       *  human-readable format.
       * 
       *  \param[in,out] outs The stream to output data into.
................................................................................
      */
      friend QTextStream &operator << (QTextStream &outs, coordinateData &the_data);
      /** \overload operator<<(QDebug, const coordinateData &)
       *
       *  Allows output to QDebug stream. For example:
       *
       *			coordinateData b;
       *			b.setCoordinate ("0123:0045:0678:009A");
       *			qDebug() << b;
       *
       *  \param[in,out] dbg The QDebug stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend QDebug operator << (QDebug dbg, const coordinateData &the_data);
      /** \overload operator<<(QDebug, coordinateData &)
       * 
       *  \param[in,out] dbg The QDebug stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend QDebug operator << (QDebug dbg, coordinateData &the_data);
      /** \overload operator<<(std::ostream &, const coordinateData &)

       *  Allows output to a stream, for example std::cout.
		 *
       *  \param[in,out] outs The stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend std::ostream &operator << (std::ostream &outs, const coordinateData &the_data);









   private:
      /*
         PRIVATE FUNCTIONS
      */
      /** \details Sets glyph code to empty value. */
      void initGlyphs();
      /** \details Sets coordinate to empty value, and portal number
       *  to default value of one (1).
      */
      void initCoordinates();

      /*
         PRIVATE VARIABLES
      */
      /** \var QString coordinates
       *
       *  \brief The coordinate sequence.







>

>







 







|
<
<
|



|



>



|

|









|
>
>
>
>










|
>
>
>
>













>
>
>
|
>







 







>







 







|













>






>
>
>
>
>
>
>
>






|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//==================================================================
#ifndef __COORDINATE_DATA_H__
#define __COORDINATE_DATA_H__
//==================================================================
#include <QtCore>
//==================================================================
/** \class CoordinateData
 *
 *  \brief Holds data about a coordinate and its glyph code.
 *
 *  \details A coordinate is comprised a 19-digit hexadecimal value, 
 *  colon-separated every 4 digits. 
 *  Its corresponding glyph code is a 12-digit hexadecimal value.
 * 
 *  Valid coordinates exist between:
 * 
 *      0001:0001:0001:0001 ... 0FFF:00FF:0FFF:02FF
................................................................................
*/
class coordinateData : public QObject
{
   public:
      //////////////////
      // CONSTRUCTORS //
      //////////////////
      /** Default constructor. */


      explicit coordinateData();
      /** \details Recommend constructor to initialize to a known
       *  coordinate or glyph code. By default, a coordinate is
       *  assumed to be provided as these are more common to
       *  encounter (requires less effort to obtain).
       * 
       *  \param[in] _code A valid coordinate or glyph code.
       *  \param[in] isCoordinate Defines the input type.
       *
       *  \warning No error-checking that isCoordinate correctly
       *  corresponds to the type of input _code is.
      */
      explicit coordinateData(const QString &_code, bool isCoordinate = true);

		/** Default destructor **/
		~coordinateData();

      // Copy Constructors
      /** \details Copy constructor for const CoordinateData object.
       * 
       *  \param[in] other An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData(const coordinateData &other);
      /** \overload coordinateData(coordinateData &other)
       * 
       *  \param[in] other An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData(coordinateData &other);
      
      // Assignment Operator
      /** \details Assignment operator for const CoordinateData
       *  object.
       * 
       *  \param[in] source An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData &operator = (const coordinateData &source);
      /** \overload operator=(coordinateData &source)
       *
       *  \param[in] source An initialized CoordinateData object to
       *  copy data from.
      */
      coordinateData &operator = (coordinateData &source);

      ////////////////////////////////
      // ACCESSING MEMBER FUNCTIONS //
      ////////////////////////////////
      /** \returns The glyph code of the coordinate. */
      QString getGlyphCode() const;
      /** \returns The coordinate. */
      QString getCoordinate() const;
      /** \returns The coordinate. */
      QString getCoordinates() const;
      /** \returns Error information about the code. */
      QStringList getErrorInfo() const;
      /** Ideally this function should never be called unless
       *  there is something to display from error_info.
       *
       *  \returns Error information about the coordinate/glyph code.
      */
      QString showErrorInfo() const;
      /** \returns The portal number. */
      int getPortal() const;
      /** Prints the coordinates or glyph code in a human-readable
       *  format.
       *
       *  \returns A QString of coordinate values.
................................................................................
       *      <glyph code>
       * 
       *      0123:0045:0678:009A, portal #2
       *      000202002002
       * 
       *  \param[in,out] readInputInto The stream to read data from.
       *  \param[in,out] target The object to read data into.
       *
       *  \warning Avoid using as this is not fully tested, nor functional.
      */
      friend QTextStream &operator >> (QTextStream &readInputInto, coordinateData &target);
      /** \details Outputs the contents of CoordinateData object in a
       *  human-readable format.
       * 
       *  \param[in,out] outs The stream to output data into.
................................................................................
      */
      friend QTextStream &operator << (QTextStream &outs, coordinateData &the_data);
      /** \overload operator<<(QDebug, const coordinateData &)
       *
       *  Allows output to QDebug stream. For example:
       *
       *			coordinateData b;
       *			b.setCoordinate ("0123:0045:0678:009a");
       *			qDebug() << b;
       *
       *  \param[in,out] dbg The QDebug stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend QDebug operator << (QDebug dbg, const coordinateData &the_data);
      /** \overload operator<<(QDebug, coordinateData &)
       * 
       *  \param[in,out] dbg The QDebug stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend QDebug operator << (QDebug dbg, coordinateData &the_data);
      /** \overload operator<<(std::ostream &, const coordinateData &)
       *
       *  Allows output to a stream, for example std::cout.
		 *
       *  \param[in,out] outs The stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend std::ostream &operator << (std::ostream &outs, const coordinateData &the_data);
      /** \overload operator<<(std::ostream &, coordinateData &)
       *
       *  Allows output to a stream, for example std::cout.
		 *
       *  \param[in,out] outs The stream to output data into.
       *  \param[in] the_data The data to read data from.
      */
      friend std::ostream &operator << (std::ostream &outs, coordinateData &the_data);

   private:
      /*
         PRIVATE FUNCTIONS
      */
      /** \details Sets glyph code to empty value. */
      void createGlyphs();
      /** \details Sets coordinate to empty value, and portal number
       *  to default value of one (1).
      */
      void createCoordinates();

      /*
         PRIVATE VARIABLES
      */
      /** \var QString coordinates
       *
       *  \brief The coordinate sequence.

Changes to src/CoordinateMain.cpp.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
//==================================================================
void to_glyphs (const QString &code, const bool valid,
                QTextStream &outs, const bool verbosity)
{
   coordinateData *window = new coordinateData(code, valid);
   window -> convertToGlyph();

//	qDebug() << *window;

   if ( window -> getGlyphCode().isEmpty() == false )
      outs << window -> getGlyphCode() << "\n";
   else
   {
      if ( verbosity == true )
      {
      	if ( window -> getErrorInfo().size() > 0 )
................................................................................
//------------------------------------------------------------------
void to_coords (const QString &code, const bool valid,
                QTextStream &outs, const bool verbosity)
{
   coordinateData *guess = new coordinateData (code, valid);
   guess -> convertFromGlyph();

//	qDebug() << *guess;

   if ( guess -> getCoordinate().isEmpty() == false )
   {
      outs << guess -> getCoordinate() << ", portal #";
      outs << guess -> getPortal() << "\n";
   }
   else
   {
................................................................................
      app.quit();
   }
   else
   {
      QApplication app (argc, argv);
	  	setApplicationSettings();

      // Set GUI style
      QString gui_look = "Fusion", used = QString();

      if ( argc >= 1 && argv[2] != QString() )
      {
         const QString temp_string = argv[2];

         if ( temp_string.size() < 15 )
            gui_look = QString(argv[2]);	// Get GUI-style to use
      }

      QApplication::setStyle(QStyleFactory::create(gui_look));
      used = QApplication::style() -> objectName();

      if ( gui_look.toLower() != used.toLower() )
      {
         qDebug() << gui_look << "cannot be used. Defaulting to" <<
                  used;
         qDebug() << "Available options for \'-style\':" <<
                  QStyleFactory::keys().join(", ");
      }

      MainWindow main_screen;
      main_screen.show();
      return app.exec ();
   }

   return (0);
}







<
<







 







<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<








8
9
10
11
12
13
14


15
16
17
18
19
20
21
..
33
34
35
36
37
38
39


40
41
42
43
44
45
46
...
162
163
164
165
166
167
168


















169
170

171
172
173
174
175
176
177
178
//==================================================================
void to_glyphs (const QString &code, const bool valid,
                QTextStream &outs, const bool verbosity)
{
   coordinateData *window = new coordinateData(code, valid);
   window -> convertToGlyph();



   if ( window -> getGlyphCode().isEmpty() == false )
      outs << window -> getGlyphCode() << "\n";
   else
   {
      if ( verbosity == true )
      {
      	if ( window -> getErrorInfo().size() > 0 )
................................................................................
//------------------------------------------------------------------
void to_coords (const QString &code, const bool valid,
                QTextStream &outs, const bool verbosity)
{
   coordinateData *guess = new coordinateData (code, valid);
   guess -> convertFromGlyph();



   if ( guess -> getCoordinate().isEmpty() == false )
   {
      outs << guess -> getCoordinate() << ", portal #";
      outs << guess -> getPortal() << "\n";
   }
   else
   {
................................................................................
      app.quit();
   }
   else
   {
      QApplication app (argc, argv);
	  	setApplicationSettings();



















      qDebug() << "Available options for \'-style\':" <<
                  QStyleFactory::keys().join(", ");


      MainWindow main_screen;
      main_screen.show();
      return app.exec ();
   }

   return (0);
}

Changes to src/CoordinateMainWindow.cpp.

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
...
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#include "PortalAddressWindow.h"
#include "CoordinateMainWindow.h"
//==================================================================
///////////////////
// CLASS: Window //
///////////////////
//==================================================================
Window::Window (QWidget *parent) : QWidget (parent)

{
   initCoordinates();
   initGlyphs();

   createLayout();
}
//------------------------------------------------------------------
Window::Window (const QString &_code, bool isCoordinate)

{
   initCoordinates();
   initGlyphs();

   if ( isCoordinate == false )
      glyph_sequence -> setText (_code);
   else
      coordinates_input -> setText (_code);

	createLayout();
................................................................................
//------------------------------------------------------------------
void Window::preset_hova()
{
   setCoordinatePreset ("0467:0081:0D71:00AD", 1);
   GUI_convertToGlyph();
}
//------------------------------------------------------------------
void Window::initGlyphs()
{
   // QLineEdit to store glyph code sequence
   glyph_sequence = new QLineEdit;
   glyph_sequence -> setMaxLength (12);
   glyph_sequence -> setPlaceholderText ("F00101001001");
   glyph_sequence -> setCursorMoveStyle (Qt::VisualMoveStyle);
   glyph_sequence -> setClearButtonEnabled (true);
}
//------------------------------------------------------------------
void Window::initCoordinates()
{
   /*
      QLineEdit to store coordinate data
       Using inputMask rather than validator to allow for easier  
       user edits of this input field. With validator, the user will 
       have to either delete the whole line and retype, or 
       backspace/delete from the end of the line until where they 
................................................................................
	portal_number -> setValue (1);
}
//------------------------------------------------------------------
void Window::clearGlyphCode()
{
	glyph_sequence -> clear();
}
//------------------------------------------------------------------
void Window::clearMessages()
{
	//blackbox -> clearErrorInfo();
}
//------------------------------------------------------------------
void Window::GUI_convertFromGlyph()
{
   if ( glyph_sequence -> text().size() == 12 )
   {
   	coordinateData *blackbox = new coordinateData;

      // Move user input into blackbox for conversion
      blackbox -> setGlyphCode (glyph_sequence -> text());

      // Perform conversion: glyph code -> coordinates
      blackbox -> convertFromGlyph();

      if ( blackbox -> getCoordinates().size() == 19 )
      {
         // Move successful/valid conversion results to GUI
         coordinates_input -> setText (blackbox -> getCoordinate());
         glyph_sequence -> setText (blackbox -> getGlyphCode());
         portal_number -> setValue (blackbox -> getPortal());
         emit validCoordinate();
      }
      else
      {
      	qDebug() << "emitting haveErrors";
      	qDebug() << *blackbox;
         emit haveErrors (blackbox -> getErrorInfo());
      }
   }
}
//------------------------------------------------------------------
void Window::GUI_convertToGlyph()
{
   if ( coordinates_input -> text().isEmpty() == false
     && coordinates_input -> text() != ":::" )
   {
   	coordinateData *blackbox = new coordinateData;

      // Move user inputs to blackbox for conversion
      blackbox -> setPortal (portal_number -> value());
      blackbox -> setCoordinate (coordinates_input -> text());

      // Perform conversion: coordinates -> glyph code
      blackbox -> convertToGlyph();

      if ( blackbox -> getGlyphCode().size() == 12 )
      {
         // Move successful/valid conversion results to GUI
         glyph_sequence -> setText (blackbox -> getGlyphCode());
         coordinates_input -> setText (blackbox -> getCoordinate());
         portal_number -> setValue (blackbox -> getPortal());
         emit validGlyphCode();
      }
      else
      {
      	qDebug() << "emitting haveErrors";
      	qDebug() << *blackbox;
         emit haveErrors (blackbox -> getErrorInfo());
      }
   }
}
//------------------------------------------------------------------
void Window::syncGlyphCode()
{
	emit glyphChange();
}
//------------------------------------------------------------------







|
>

|
|




|
>

|
|







 







|









|







 







<
<
<
<
<





|


|


|

|

|
|
|
|




<
|
|









|


|
|


|

|

|
|
|
|




<
|
|









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
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
314
315
316
317
318
319
320





321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
381
382
383
384
#include "PortalAddressWindow.h"
#include "CoordinateMainWindow.h"
//==================================================================
///////////////////
// CLASS: Window //
///////////////////
//==================================================================
Window::Window (QWidget *parent)
	: QWidget (parent)
{
   createCoordinates();
   createGlyphs();

   createLayout();
}
//------------------------------------------------------------------
Window::Window (const QString &_code, bool isCoordinate, QWidget *parent)
	: QWidget (parent)
{
   createCoordinates();
   createGlyphs();

   if ( isCoordinate == false )
      glyph_sequence -> setText (_code);
   else
      coordinates_input -> setText (_code);

	createLayout();
................................................................................
//------------------------------------------------------------------
void Window::preset_hova()
{
   setCoordinatePreset ("0467:0081:0D71:00AD", 1);
   GUI_convertToGlyph();
}
//------------------------------------------------------------------
void Window::createGlyphs()
{
   // QLineEdit to store glyph code sequence
   glyph_sequence = new QLineEdit;
   glyph_sequence -> setMaxLength (12);
   glyph_sequence -> setPlaceholderText ("F00101001001");
   glyph_sequence -> setCursorMoveStyle (Qt::VisualMoveStyle);
   glyph_sequence -> setClearButtonEnabled (true);
}
//------------------------------------------------------------------
void Window::createCoordinates()
{
   /*
      QLineEdit to store coordinate data
       Using inputMask rather than validator to allow for easier  
       user edits of this input field. With validator, the user will 
       have to either delete the whole line and retype, or 
       backspace/delete from the end of the line until where they 
................................................................................
	portal_number -> setValue (1);
}
//------------------------------------------------------------------
void Window::clearGlyphCode()
{
	glyph_sequence -> clear();
}





//------------------------------------------------------------------
void Window::GUI_convertFromGlyph()
{
   if ( glyph_sequence -> text().size() == 12 )
   {
   	coordinateData blackbox = coordinateData();

      // Move user input into blackbox for conversion
      blackbox.setGlyphCode (glyph_sequence -> text());

      // Perform conversion: glyph code -> coordinates
      blackbox.convertFromGlyph();

      if ( blackbox.getCoordinates().size() == 19 )
      {
         // Move successful conversion results to GUI
         coordinates_input -> setText (blackbox.getCoordinate());
         glyph_sequence -> setText (blackbox.getGlyphCode());
         portal_number -> setValue (blackbox.getPortal());
         emit validCoordinate();
      }
      else
      {

      	qDebug() << blackbox;
         emit haveErrors (blackbox.getErrorInfo());
      }
   }
}
//------------------------------------------------------------------
void Window::GUI_convertToGlyph()
{
   if ( coordinates_input -> text().isEmpty() == false
     && coordinates_input -> text() != ":::" )
   {
   	coordinateData blackbox = coordinateData();

      // Move user inputs to blackbox for conversion
      blackbox.setPortal (portal_number -> value());
      blackbox.setCoordinate (coordinates_input -> text());

      // Perform conversion: coordinates -> glyph code
      blackbox.convertToGlyph();

      if ( blackbox.getGlyphCode().size() == 12 )
      {
         // Move successful conversion results to GUI
         glyph_sequence -> setText (blackbox.getGlyphCode());
         coordinates_input -> setText (blackbox.getCoordinate());
         portal_number -> setValue (blackbox.getPortal());
         emit validGlyphCode();
      }
      else
      {

      	qDebug() << blackbox;
         emit haveErrors (blackbox.getErrorInfo());
      }
   }
}
//------------------------------------------------------------------
void Window::syncGlyphCode()
{
	emit glyphChange();
}
//------------------------------------------------------------------

Changes to src/CoordinateMainWindow.h.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
      /** Default constructor */
      explicit Window(QWidget *parent = 0);
      /** \overload Window(const QString &, bool)
       * 
       *  \param[in] _code A valid coordinate or glyph code.
       *  \param[in] isCoordinate Denotes _code as being a coordinate.
      */
      Window(const QString &_code, bool isCoordinate = true);

      ////////////////////////////////
      // ACCESSING MEMBER FUNCTIONS //
      ////////////////////////////////
      /** Initialize GUI objects/elements */
      void createLayout();

................................................................................
      */
      /** Clears all private variable values to null/empty. */
      void reset(); 
      /** Clears coordinates value. */
      void clearCoordinates();
      /** Clears all glyph images. */
      void clearGlyphCode();
      /** Clears error messages about coordinate data.
       * 
       *  This function is mostly useless as reset will perform this
       *  functionality as well.
       * 
       *  \deprecated To be removed by version 1.0. Consider using 
       *  reset() instead.
      */
      void clearMessages();

   private:
   	/** Removes any existing glyphs. */
      void initGlyphs();
      /** Sets coordinates and portal number to default value:
       *  empty, 1.
      */
      void initCoordinates();

		/** \var coordinateData *blackbox
		 * 
		 *  \brief Holds temporary coordinate data.
		*/
      //coordinateData *blackbox;








|







 







<
<
<
<
<
<
<
<
<



|



|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
130
131
132
133
134
135
136









137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
      /** Default constructor */
      explicit Window(QWidget *parent = 0);
      /** \overload Window(const QString &, bool)
       * 
       *  \param[in] _code A valid coordinate or glyph code.
       *  \param[in] isCoordinate Denotes _code as being a coordinate.
      */
      explicit Window(const QString &_code, bool isCoordinate = true, QWidget *parent = 0);

      ////////////////////////////////
      // ACCESSING MEMBER FUNCTIONS //
      ////////////////////////////////
      /** Initialize GUI objects/elements */
      void createLayout();

................................................................................
      */
      /** Clears all private variable values to null/empty. */
      void reset(); 
      /** Clears coordinates value. */
      void clearCoordinates();
      /** Clears all glyph images. */
      void clearGlyphCode();










   private:
   	/** Removes any existing glyphs. */
      void createGlyphs();
      /** Sets coordinates and portal number to default value:
       *  empty, 1.
      */
      void createCoordinates();

		/** \var coordinateData *blackbox
		 * 
		 *  \brief Holds temporary coordinate data.
		*/
      //coordinateData *blackbox;

Changes to src/HelperFunctions.h.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/** \file HelperFunctions.h
 *
 *  \brief Helper functions to assist in manipulating coordinate data.
 *
 *  \details Provides convenience functions to facilitate converting
 *  between coordinates and glyph codes.
 * 
 *  \see CoordinateData
*/
//------------------------------------------------------------------
#ifndef __HELPER_FUNCTIONS_H__
#define __HELPER_FUNCTIONS_H__
//------------------------------------------------------------------
#include <QtCore>
//------------------------------------------------------------------







|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/** \file HelperFunctions.h
 *
 *  \brief Helper functions to assist in manipulating coordinate data.
 *
 *  \details Provides convenience functions to facilitate converting
 *  between coordinates and glyph codes.
 * 
 *  \see coordinateData
*/
//------------------------------------------------------------------
#ifndef __HELPER_FUNCTIONS_H__
#define __HELPER_FUNCTIONS_H__
//------------------------------------------------------------------
#include <QtCore>
//------------------------------------------------------------------

Changes to src/MainWindow.cpp.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//------------------------------------------------------------------
/////////////////
// CONSTRUCTOR //
/////////////////
//------------------------------------------------------------------
MainWindow::MainWindow (QWidget *parent)
	: QMainWindow (parent),
	conversion_screen (new Window)
{
   setCentralWidget (conversion_screen);
   setWindowTitle ("nmspd");

	// Create dock widget: Top
   portal_address = new Glyphs;
   QDockWidget *topWidget = new QDockWidget(tr ("Portal Address"), this);







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//------------------------------------------------------------------
/////////////////
// CONSTRUCTOR //
/////////////////
//------------------------------------------------------------------
MainWindow::MainWindow (QWidget *parent)
	: QMainWindow (parent),
	conversion_screen (new Window(this))
{
   setCentralWidget (conversion_screen);
   setWindowTitle ("nmspd");

	// Create dock widget: Top
   portal_address = new Glyphs;
   QDockWidget *topWidget = new QDockWidget(tr ("Portal Address"), this);

Changes to src/PortalAddressPickerWindow.cpp.

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
   setGlyphs(_code);
   createActions();
   createLayout();
}
//------------------------------------------------------------------
void PortalDialer::createGlyphs()
{




   code = new QStack<QChar>;
   code -> clear();

   for (int i = 0; i < 16; i++)
   {
      glyph_input[i] = new QPushButton;
      glyph_input[i] -> setDisabled (false);
................................................................................
      glyph_input[i] -> setIconSize (QSize(40, 40));
      glyph_input[i] -> setMaximumSize (QSize (60,60));
      glyph_input[i] -> setAutoFillBackground (false);
      glyph_input[i] -> setCheckable (false);
      glyph_input[i] -> setFlat (true);
      glyph_input[i] -> setIcon (QIcon (QString (":" + QString(
                                           convert_integer_to_hex(i)).toUpper() + QString(".jpg"))));
   /*
      if ( i < 12 ) {
         glyph_select[i] = new QPushButton;
         glyph_select[i] -> setFlat (false);
         glyph_select[i] -> setCheckable (false);
         glyph_select[i] -> setAutoFillBackground (true);
         glyph_select[i] -> setIconSize (QSize(60, 60));
         glyph_select[i] -> setIcon (QIcon (QString (":empty.png")));
      }
   */
   }
}
//------------------------------------------------------------------
void PortalDialer::setGlyphs (const QString &_code)
{
   if ( _code.size() <= 12 )
   {
      QString fileName = QString();

      if ( code -> isEmpty() == false &&
           (_code.toLower() != glyph_code -> text().toLower()) )
      {
         reset();
         QStack<QChar> temp;
         temp.clear();
         const QRegularExpression validHex ("[0-9A-F]");
         QRegularExpressionMatch isValidHex;

         for (int i = 0; i < 12; i++)
         {
            if ( _code.isEmpty() == true )
            {
................................................................................
            }
            else
            {
               isValidHex = validHex.match (_code.at(i).toUpper());

               if ( isValidHex.hasMatch() == true )
               {
                  //code -> push(_code.at(i).toUpper());
                  temp.push(_code.at(i).toUpper());
                  //emit codeChange();
                  fileName = ":" + QString(_code.at(i)).toUpper() + ".jpg";
               }
            }

            //glyph_select[i] -> setIcon (QIcon (QString (fileName)));
         }

         glyph_code -> setText (getCode());
         code -> swap (temp);
         emit codeChange();

         if ( glyph_code -> text().size() == 12 )
................................................................................
//------------------------------------------------------------------
QString PortalDialer::getCode()
{
   QString result = QString();

   for (int i = 0; i < code -> size(); i++)
   {
      result += QString(code -> at(i));
   }

   return (result);
}
//------------------------------------------------------------------
void PortalDialer::getGlyph (const int index)
{
   if ( code -> size() < 12 )
   {
      int i = (code -> size());
      QChar result = convert_integer_to_hex(index).at(0);

      if ( i < 0 )
         i = 0;

      if ( i < 12  )
      {
         //glyph_select[i] -> setIcon (QIcon (QString (":" + QString(result) + ".jpg")));
         code -> push(result);
         glyph_code -> setText (getCode());
         emit codeChange();
      }
   }

   // Update status of code after (any) change
   if ( code -> size() == 12 )
      emit codeReady();
   else
   {
................................................................................
}
//------------------------------------------------------------------
void PortalDialer::clearOne()
{
   if ( code -> isEmpty() == false )
   {
      code -> pop();
      //glyph_select[code -> size()] -> setIcon (QIcon (QString (":empty.png")));
      glyph_code -> setText (getCode());
      emit codeIncomplete();
   }

   emit codeChange();
}
//------------------------------------------------------------------
................................................................................

	// Re-enable input for less than full code
	QObject::connect (this, &PortalDialer::codeIncomplete, this, &PortalDialer::enableGlyphInput);
}
//------------------------------------------------------------------
void PortalDialer::createLayout()
{
   glyph_code = new QLineEdit;
   glyph_code -> setMaxLength (12);
   glyph_code -> setReadOnly (true);

   QPushButton *back_button = new QPushButton;
   back_button -> setText (tr ("Delete"));
   back_button -> setToolTip (
      tr ("Backspace/Delete one digit to the left"));
   back_button -> setCheckable (false);

   QPushButton *reset_button = new QPushButton;
................................................................................
   reset_button -> setText (tr ("Clear"));
   reset_button -> setToolTip (tr ("Reset all glyphs entered"));
   reset_button -> setCheckable (false);

   /*
      Create grid layout.

     control_group:
      +--------+-------+
      | delete | clear |
      +--------+-------+
      |   glyph_code   |
      +----------------+
   */
   QGroupBox *control_group = new QGroupBox;
   QGridLayout *buttons = new QGridLayout;
   buttons -> addWidget (back_button, 0, 0, 1, 1);
   buttons -> addWidget (reset_button, 0, 1, 1, 1);
   buttons -> addWidget (glyph_code, 1, 0, 1, 2);
   control_group -> setLayout (buttons);
................................................................................
//------------------------------------------------------------------
///////////////////
// PRIVATE SLOTS //
///////////////////
//------------------------------------------------------------------
void PortalDialer::disableGlyphInput()
{
	// TODO: Check that this wasn't called before codeReady(), or 
	// less than 12-digit code entered.
	for (int i = 0; i < 16; i++)
	{
		glyph_input[i] -> setDisabled (true);
	}
}
//------------------------------------------------------------------
void PortalDialer::enableGlyphInput()







>
>
>
>







 







<
<
<
<
<
<
<
<
<
<













|
<







 







<
|
<
|


<
<







 







|







|

<
|
<
<
<
<
<
<
<
<
|
|
<







 







<







 







<
<
<
<







 







|
|
|
|
|
|







 







<
<







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
58

59
60
61
62
63
64
65
..
68
69
70
71
72
73
74

75

76
77
78


79
80
81
82
83
84
85
..
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

109








110
111

112
113
114
115
116
117
118
...
134
135
136
137
138
139
140

141
142
143
144
145
146
147
...
158
159
160
161
162
163
164




165
166
167
168
169
170
171
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
236
237
238
239
240
241
242


243
244
245
246
247
248
249
   setGlyphs(_code);
   createActions();
   createLayout();
}
//------------------------------------------------------------------
void PortalDialer::createGlyphs()
{
   glyph_code = new QLineEdit;
   glyph_code -> setMaxLength (12);
   glyph_code -> setReadOnly (true);

   code = new QStack<QChar>;
   code -> clear();

   for (int i = 0; i < 16; i++)
   {
      glyph_input[i] = new QPushButton;
      glyph_input[i] -> setDisabled (false);
................................................................................
      glyph_input[i] -> setIconSize (QSize(40, 40));
      glyph_input[i] -> setMaximumSize (QSize (60,60));
      glyph_input[i] -> setAutoFillBackground (false);
      glyph_input[i] -> setCheckable (false);
      glyph_input[i] -> setFlat (true);
      glyph_input[i] -> setIcon (QIcon (QString (":" + QString(
                                           convert_integer_to_hex(i)).toUpper() + QString(".jpg"))));










   }
}
//------------------------------------------------------------------
void PortalDialer::setGlyphs (const QString &_code)
{
   if ( _code.size() <= 12 )
   {
      QString fileName = QString();

      if ( code -> isEmpty() == false &&
           (_code.toLower() != glyph_code -> text().toLower()) )
      {
         reset();
         QStack<QChar> temp = QStack<QChar>();

         const QRegularExpression validHex ("[0-9A-F]");
         QRegularExpressionMatch isValidHex;

         for (int i = 0; i < 12; i++)
         {
            if ( _code.isEmpty() == true )
            {
................................................................................
            }
            else
            {
               isValidHex = validHex.match (_code.at(i).toUpper());

               if ( isValidHex.hasMatch() == true )
               {

                  temp.push (_code.at (i).toUpper());

                  fileName = ":" + QString(_code.at (i)).toUpper() + ".jpg";
               }
            }


         }

         glyph_code -> setText (getCode());
         code -> swap (temp);
         emit codeChange();

         if ( glyph_code -> text().size() == 12 )
................................................................................
//------------------------------------------------------------------
QString PortalDialer::getCode()
{
   QString result = QString();

   for (int i = 0; i < code -> size(); i++)
   {
      result += QString(code -> at (i));
   }

   return (result);
}
//------------------------------------------------------------------
void PortalDialer::getGlyph (const int index)
{
   if ( code -> size() >= 0 && code -> size() < 12 )
   {

      code -> push (convert_integer_to_hex(index).at (0));








      glyph_code -> setText (getCode());
      emit codeChange();

   }

   // Update status of code after (any) change
   if ( code -> size() == 12 )
      emit codeReady();
   else
   {
................................................................................
}
//------------------------------------------------------------------
void PortalDialer::clearOne()
{
   if ( code -> isEmpty() == false )
   {
      code -> pop();

      glyph_code -> setText (getCode());
      emit codeIncomplete();
   }

   emit codeChange();
}
//------------------------------------------------------------------
................................................................................

	// Re-enable input for less than full code
	QObject::connect (this, &PortalDialer::codeIncomplete, this, &PortalDialer::enableGlyphInput);
}
//------------------------------------------------------------------
void PortalDialer::createLayout()
{




   QPushButton *back_button = new QPushButton;
   back_button -> setText (tr ("Delete"));
   back_button -> setToolTip (
      tr ("Backspace/Delete one digit to the left"));
   back_button -> setCheckable (false);

   QPushButton *reset_button = new QPushButton;
................................................................................
   reset_button -> setText (tr ("Clear"));
   reset_button -> setToolTip (tr ("Reset all glyphs entered"));
   reset_button -> setCheckable (false);

   /*
      Create grid layout.

      control_group:
       +--------+-------+
       | delete | clear |
       +--------+-------+
       |   glyph_code   |
       +----------------+
   */
   QGroupBox *control_group = new QGroupBox;
   QGridLayout *buttons = new QGridLayout;
   buttons -> addWidget (back_button, 0, 0, 1, 1);
   buttons -> addWidget (reset_button, 0, 1, 1, 1);
   buttons -> addWidget (glyph_code, 1, 0, 1, 2);
   control_group -> setLayout (buttons);
................................................................................
//------------------------------------------------------------------
///////////////////
// PRIVATE SLOTS //
///////////////////
//------------------------------------------------------------------
void PortalDialer::disableGlyphInput()
{


	for (int i = 0; i < 16; i++)
	{
		glyph_input[i] -> setDisabled (true);
	}
}
//------------------------------------------------------------------
void PortalDialer::enableGlyphInput()

Changes to src/PortalAddressWindow.cpp.

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
   glyph_code.clear();
   for (int i = 0; i < 12; i++)
      glyph[i] -> setIcon (QIcon (":empty.png"));
}
//------------------------------------------------------------------
void Glyphs::createLayout()
{
   /*
   QPushButton *go_back = new QPushButton;
   go_back -> setText (tr ("Hide"));
   go_back -> setToolTip (tr ("Hide portal address window"));
   go_back -> setCheckable (false);

   QPushButton *exit = new QPushButton;
   exit -> setText (tr ("Quit"));
   exit -> setToolTip (tr ("Exit the application"));
   exit -> setCheckable (false);
   */
   /*
      Create horizontal layout.

      the_glyphs:
       +--------+--------+-----+---------+
       | glyph1 | glyph2 | ... | glyph12 |
       +--------+--------+-----+---------+
................................................................................
   QHBoxLayout *sequence = new QHBoxLayout;

   for (int i = 0; i < 12; i++)
      sequence -> addWidget (glyph[i]);

   the_glyphs -> setLayout (sequence);

   /*
      Create vertical layout.

      the_buttons:
       +---------+
       | go_back |
       +---------+
       |   exit  |
       +---------+
   */
   //QGroupBox *the_buttons = new QGroupBox;
   //QVBoxLayout *_buttons = new QVBoxLayout;
   //_buttons -> addWidget (go_back);
   //_buttons -> addWidget (exit);
   //the_buttons -> setLayout (_buttons);

   /*
      Create grid layout for the program.

      _layout:
       +----------------------------+
       | the_buttons |  the_glyphs  |
       +---------+------------------+
   */
   QGridLayout *_layout = new QGridLayout;
   _layout -> addWidget (the_glyphs, 0, 1, 1, 1);
   //_layout -> addWidget (the_buttons, 0, 0, 2, 1);
   setLayout (_layout);

   // Handle button signals (events)
   // 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()));
}
//------------------------------------------------------------------







<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










<

|
<
<
<
<
<
<
<
<

74
75
76
77
78
79
80











81
82
83
84
85
86
87
..
90
91
92
93
94
95
96
















97
98
99
100
101
102
103
104
105
106

107
108








109
   glyph_code.clear();
   for (int i = 0; i < 12; i++)
      glyph[i] -> setIcon (QIcon (":empty.png"));
}
//------------------------------------------------------------------
void Glyphs::createLayout()
{











   /*
      Create horizontal layout.

      the_glyphs:
       +--------+--------+-----+---------+
       | glyph1 | glyph2 | ... | glyph12 |
       +--------+--------+-----+---------+
................................................................................
   QHBoxLayout *sequence = new QHBoxLayout;

   for (int i = 0; i < 12; i++)
      sequence -> addWidget (glyph[i]);

   the_glyphs -> setLayout (sequence);

















   /*
      Create grid layout for the program.

      _layout:
       +----------------------------+
       | the_buttons |  the_glyphs  |
       +---------+------------------+
   */
   QGridLayout *_layout = new QGridLayout;
   _layout -> addWidget (the_glyphs, 0, 1, 1, 1);

   setLayout (_layout);
}








//------------------------------------------------------------------