Skip to content

Commit 4e7adba

Browse files
authored
A bug-fix and feature bonanza!
So much stuff, can't remember it all... * Added 'Last connected' info feature to Quick Info area * Made Quick Note editing widget bigger, multi-line and with wrapping (NOW WITH BLINKING CURSOR!! WOO!!! :-P) * Re-did tooltip code to eliminate quite a few unneeded lines of code * Disabled and deprecated 'SSH password' entry / editing because most Unix-like systems don't include sshpass by default. Just use private keys after setting up remote systems through an interactive SSH session * Make timed scanning code a little more robust * Bumped version to 0.5.0 * Replaced SV_ constants with FL_ constants where possible * Window / taskbar icon is back, this time using standardized FLTK methods and not X11 hackery -- still doesn't look very good, though * Code clean-up, more commenting and minor fixes
1 parent 2e0c6b3 commit 4e7adba

File tree

9 files changed

+714
-830
lines changed

9 files changed

+714
-830
lines changed

src/app.cxx

Lines changed: 456 additions & 383 deletions
Large diffs are not rendered by default.

src/app.h

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include <FL/Fl_Scroll.H>
5555
#include <FL/Fl_Secret_Input.H>
5656
#include <FL/Fl_Spinner.H>
57-
//#include <FL/Fl_Text_Editor.H>
57+
#include <FL/Fl_Tooltip.H>
5858
#include <FL/Fl_Multiline_Output.H>
5959
#include <FL/Fl_Widget.H>
6060
#include <FL/Fl_Window.H>
@@ -80,6 +80,8 @@
8080

8181
class SVInput;
8282
class SVQuickNoteInput;
83+
class SVQuickNoteBox;
84+
class SVQuickNotePack;
8385

8486
/* global app class */
8587
class AppVars
@@ -90,6 +92,7 @@ class AppVars
9092
hostList(NULL),
9193
scroller(NULL),
9294
vncViewer(NULL),
95+
iconApp(NULL),
9396
iconDisconnected(NULL),
9497
iconDisconnectedError(NULL),
9598
iconDisconnectedBigError(NULL),
@@ -100,6 +103,7 @@ class AppVars
100103
userName(""),
101104
configPath(""),
102105
configPathAndFile(""),
106+
requestedListWidth(170),
103107
nConnectionTimeout(SV_CONNECTION_TIMEOUT_SECS),
104108
nViewersWaiting(0),
105109
verboseLogging(false),
@@ -128,7 +132,6 @@ class AppVars
128132
nListFontSize(10),
129133
nMenuFontSize(11),
130134
blockLocalClipboardHandling(false),
131-
packButtons(NULL),
132135
showReverseConnect(true),
133136
savedX(0),
134137
savedY(0),
@@ -138,11 +141,15 @@ class AppVars
138141
msgThread(0),
139142
strF12ClipVar(""),
140143
sshCommand("ssh"),
141-
quickNoteGroup(NULL),
142-
quickNoteLabel(NULL),
144+
quickInfoPack(NULL),
145+
quickInfoLabel(NULL),
146+
lastConnectedLabel(),
147+
lastConnected(NULL),
148+
lastError(NULL),
143149
quickNote(NULL),
144-
quickNoteWindow(NULL),
145-
quickNoteInput(NULL)
150+
quickNotePack(NULL),
151+
quickNoteInput(NULL),
152+
packButtons(NULL)
146153
{
147154
// get user's login name for reading/writing config file
148155

@@ -189,6 +196,7 @@ class AppVars
189196
Fl_Hold_Browser * hostList;
190197
Fl_Scroll * scroller;
191198
VncViewer * vncViewer;
199+
Fl_RGB_Image * iconApp;
192200
Fl_Image * iconDisconnected;
193201
Fl_Image * iconDisconnectedError;
194202
Fl_Image * iconDisconnectedBigError;
@@ -199,7 +207,8 @@ class AppVars
199207
std::string userName;
200208
std::string configPath;
201209
std::string configPathAndFile;
202-
int nConnectionTimeout;
210+
int requestedListWidth;
211+
uint16_t nConnectionTimeout;
203212
int nViewersWaiting;
204213
bool verboseLogging;
205214
bool colorBlindIcons;
@@ -217,8 +226,8 @@ class AppVars
217226
HostItem * itmBeingEdited;
218227
bool scanIsRunning;
219228
int nCurrentScanItem;
220-
int nScanTimeout;
221-
int nDeadTimeout;
229+
uint16_t nScanTimeout;
230+
uint16_t nDeadTimeout;
222231
int nStartingLocalPort;
223232
bool showTooltips;
224233
bool debugMode;
@@ -227,7 +236,6 @@ class AppVars
227236
int nListFontSize;
228237
int nMenuFontSize;
229238
bool blockLocalClipboardHandling;
230-
Fl_Pack * packButtons;
231239
bool showReverseConnect;
232240
int savedX;
233241
int savedY;
@@ -237,11 +245,15 @@ class AppVars
237245
pthread_t msgThread;
238246
std::string strF12ClipVar;
239247
std::string sshCommand;
240-
Fl_Group * quickNoteGroup;
241-
Fl_Box * quickNoteLabel;
242-
Fl_Multiline_Output * quickNote;
243-
Fl_Window * quickNoteWindow;
248+
Fl_Pack * quickInfoPack;
249+
Fl_Box * quickInfoLabel;
250+
Fl_Box * lastConnectedLabel;
251+
Fl_Box * lastConnected;
252+
Fl_Multiline_Output * lastError;
253+
SVQuickNoteBox * quickNote;
254+
SVQuickNotePack * quickNotePack;
244255
SVQuickNoteInput * quickNoteInput;
256+
Fl_Pack * packButtons;
245257
} extern * app;
246258

247259

@@ -275,6 +287,16 @@ class SVQuickNoteBox : public Fl_Multiline_Output
275287
int handle (int event);
276288
};
277289

290+
/* subclassed group */
291+
class SVQuickNotePack : public Fl_Pack
292+
{
293+
public:
294+
SVQuickNotePack (int x, int y, int w, int h, const char * label = 0) :
295+
Fl_Pack(x, y, w, h, label) {}
296+
private:
297+
int handle (int event);
298+
};
299+
278300
/* subclassed input box */
279301
class SVQuickNoteInput : public SVInput
280302
{
@@ -287,6 +309,7 @@ class SVQuickNoteInput : public SVInput
287309

288310

289311
/* forward function declarations */
312+
void svBlinkCursor (void *);
290313
void svCloseChildWindow (Fl_Widget *, void *);
291314
void svCloseSSHConnection (void *);
292315
void svConfigCreateNew ();
@@ -297,9 +320,11 @@ void svCreateAppIcons (bool fromAppOptions = false);
297320
std::string svConvertBooleanToString (bool);
298321
bool svConvertStringToBoolean (const std::string&);
299322
void svCreateGUI ();
323+
void svCreateQuickNoteEditWidgets ();
300324
void svDebugLog (const std::string&);
301325
void svDeleteItem (int);
302326
void svDeselectAllItems ();
327+
void svEnableDisableTooltips ();
303328
int svFindFreeTcpPort ();
304329
std::string svGetConfigProperty (char *);
305330
std::string svGetConfigValue (char *);
@@ -311,9 +336,11 @@ void svHandleHostListEvents (Fl_Widget *, void *);
311336
void svHandleMainWindowEvents (Fl_Widget *, void *);
312337
void svPositionWidgets ();
313338
void svHandleListItemIconChange (void *);
314-
void svHandleQuickNoteWindowEvents (Fl_Widget *, void *);
339+
//void svHandleQuickNoteButtonEvents (Fl_Widget *, void *);
340+
//void svHandleQuickNoteWindowEvents (Fl_Widget *, void *);
315341
void svHandleThreadConnection (void *);
316342
void svHandleThreadCursorChange (void *);
343+
void svHideQuickNoteEditWidgets ();
317344
void svInsertEmptyItem ();
318345
int svItemNumFromItm (const HostItem *);
319346
HostItem * svItmFromVnc (const VncObject *);
@@ -325,13 +352,13 @@ void svLogToFile (const std::string&);
325352
void svMessageWindow (const std::string&, const std::string& = "SpiritVNC");
326353
bool svThereAreConnectedItems ();
327354
void svPopUpEditMenu (Fl_Input_ *);
328-
void svQuickNoteSetLabelAndText (HostItem *);
329-
void svQuickNoteSetToEmpty ();
355+
void svQuickInfoSetLabelAndText (HostItem *);
356+
void svQuickInfoSetToEmpty ();
330357
void svResizeScroller ();
331358
void svRestoreWindowSizePosition (void *);
332359
void svScanTimer (void *);
333360
void svSendKeyStrokesToHost (std::string&, VncObject *);
334-
void svSetUnsetMainWindowTooltips ();
361+
void svSetAppTooltips ();
335362
void svShowAboutHelp ();
336363
void svShowAppOptions ();
337364
void svShowF8Window ();

src/consts_enums.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define CONSTS_H
3737

3838
/* constants */
39-
#define SV_APP_VERSION "0.4.15"
39+
#define SV_APP_VERSION "0.5.0" //"0.4.16"
4040

4141
#define SV_CURRENT_YEAR "2023"
4242

@@ -46,8 +46,9 @@
4646
#define SV_APP_FONT_SIZE 14
4747
#define SV_MAX_PROP_LEN 1024
4848
#define SV_MAX_HOSTLIST_ENTRIES 65000
49-
#define SV_FLTK_FONT_0 0
5049
#define SV_CHOICE_2 2
50+
#define SV_LIST_FONT_ID 31
51+
#define SV_BLINK_TIME 0.6
5152

5253
// return type for threads
5354
#define SV_RET_VOID static_cast<void *>(NULL)
@@ -60,6 +61,7 @@
6061
#define SV_OPTS_APP_FONT_SIZE const_cast<char *>("inAppFontSize")
6162
#define SV_OPTS_LIST_FONT_NAME const_cast<char *>("inListFont")
6263
#define SV_OPTS_LIST_FONT_SIZE const_cast<char *>("inListFontSize")
64+
#define SV_OPTS_LIST_WIDTH const_cast<char *>("inListWidth")
6365
#define SV_OPTS_USE_CB_ICONS const_cast<char *>("chkCBIcons")
6466
#define SV_OPTS_SHOW_TOOLTIPS const_cast<char *>("chkShowTooltips")
6567
#define SV_OPTS_SHOW_REV_CON const_cast<char *>("chkShowReverseConnect")

src/hostitem.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class HostItem
8888
sshWaitTime(5),
8989
sshCmdStream(NULL),
9090
sshCloseThread(0),
91-
quickNote("")
91+
quickNote(""),
92+
lastConnectedTime("")
9293
{}
9394

9495
std::string name;
@@ -113,8 +114,8 @@ class HostItem
113114
char scaling;
114115
bool scalingFast;
115116
bool showRemoteCursor;
116-
int compressLevel;
117-
int qualityLevel;
117+
uint8_t compressLevel;
118+
uint8_t qualityLevel;
118119
bool ignoreInactive;
119120
bool centerX;
120121
bool centerY;
@@ -129,10 +130,11 @@ class HostItem
129130
bool hasEnded;
130131
Fl_Image * icon;
131132
std::string lastErrorMessage;
132-
int sshWaitTime;
133+
uint16_t sshWaitTime;
133134
FILE * sshCmdStream;
134135
pthread_t sshCloseThread;
135136
std::string quickNote;
137+
std::string lastConnectedTime;
136138
};
137139

138140
#endif

0 commit comments

Comments
 (0)