mw4print: MySQL export, configurable banner text

MySQL database export (dbexport.h / dbexport.cpp):
- New files dbexport.h / dbexport.cpp implement late-bound MySQL export.
  libmysql.dll is loaded at runtime via LoadLibrary/GetProcAddress so no
  MySQL SDK is required at compile time; the app runs normally if the DLL
  is absent.
- After each print job, match data is exported to a MySQL server before
  PrintDlg() is called: one row in 'match', one row per player in
  'player_result', one row per attacker/victim pair in 'pvp'.  An optional
  'event' table records every individual SRecScore entry (off by default).
  Tables are created automatically (CREATE TABLE IF NOT EXISTS) on first
  connect.
- Config stored in mw4print.ini (app directory), section [MySQLExport]:
  Enabled, Host, Port, Database, Username, Password, ExportEvents.
- Config loaded at startup (OnCreate); DB_LoadConfig() / DB_SaveConfig().
- Connection timeout set to 5 seconds so the app does not hang if the
  server is unreachable.
- libmysql.dll (MySQL Connector/C 32-bit) added to Gameleap/mw4/ so the
  deploy script copies it to MW4/ alongside mw4print.exe.

Database Settings dialog (File > Database Settings... / Ctrl+D):
- MFC dialog: enable checkbox, Host/Port/Database/Username/Password fields,
  Export Events checkbox, Test Connection button with live status label,
  OK/Cancel.  OK persists settings to mw4print.ini immediately.

Configurable banner text (File > Banner Setting...):
- The 'WWW.MECHJOCK.COM' URL string printed at the bottom of every score
  sheet is now configurable.  Stored as BannerText= in options.ini under
  [battle tech print] (same section/file as the other print layout params).
  File > Banner Setting... opens a dialog to edit it; OK saves to options.ini
  and takes effect on the next print job with no restart needed.
  Default value is the original MECHJOCK string if the key is absent.
This commit is contained in:
2026-07-18 14:05:31 -05:00
parent 92aaedfcbb
commit b98cb87ef3
8 changed files with 786 additions and 6 deletions
@@ -9,11 +9,41 @@
#pragma once
#endif // _MSC_VER > 1000
class CDlgBannerSetting : public CDialog
{
public:
CDlgBannerSetting(CWnd* pParent = NULL);
enum { IDD = IDD_BANNER_SETTING };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
virtual void OnOK();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CChildView window
class MW4PRINT_COPYDATASTRUCT;
/////////////////////////////////////////////////////////////////////////////
// CDlgDBSettings dialog
class CDlgDBSettings : public CDialog
{
public:
CDlgDBSettings(CWnd* pParent = NULL);
enum { IDD = IDD_DB_SETTINGS };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
virtual void OnOK();
afx_msg void OnTestConnection();
DECLARE_MESSAGE_MAP()
};
class CMyPrintInfo : public TDBLNK(CMyPrintInfo*)
{
public:
@@ -131,6 +161,8 @@ protected:
afx_msg void OnFileOpen();
afx_msg void OnFileLogReport();
afx_msg void OnFileLog2Dates();
afx_msg void OnFileDbSettings();
afx_msg void OnFileBannerSetting();
DECLARE_MESSAGE_MAP()
};