Roflo wrote:The resources could be supplied in source form in a zip file next to the program's one and parsed at runtime. If you want I can do that for you, because text processing is always fun to me.
I'm not sure I get the idea you're proposing, but I would very much appreciate help in making the resources runtime parsed.
It should -- now -- be a fairly simple text processing affair. I just haven't bothered with it.
As an example, all taken from https://github.com/christopherpow/nesic ... racker.cpp:
Code: Select all
#include "SpeedDlg.h"
void qtMfcInitDialogResource_IDD_SPEED(CDialog* parent1)
{
CSpeedDlg* parent = dynamic_cast<CSpeedDlg*>(parent1);
QHash<int,CWnd*>* mfcToQtWidget = parent->mfcToQtWidgetMap();
// IDD_SPEED DIALOGEX 0, 0, 196, 44
CRect rect(CPoint(0,0),CSize(196,44));
parent->MapDialogRect(&rect);
parent->setFixedSize(rect.Width(),rect.Height());
// STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
parent->toQWidget()->setWindowFlags(parent->toQWidget()->windowFlags()|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint|Qt::WindowTitleHint);
// CAPTION "Custom speed"
parent->SetWindowText("Custom speed");
// FONT 8, "MS Shell Dlg", 400, 0, 0x1
// BEGIN
// DEFPUSHBUTTON "OK",IDOK,139,7,50,14
CButton* mfc1 = new CButton(parent);
CRect r1(CPoint(139,7),CSize(50,14));
parent->MapDialogRect(&r1);
mfc1->Create(_T("OK"),BS_DEFPUSHBUTTON | WS_VISIBLE,r1,parent,IDOK);
mfcToQtWidget->insert(IDOK,mfc1);
// PUSHBUTTON "Cancel",IDCANCEL,139,23,50,14
CButton* mfc2 = new CButton(parent);
CRect r2(CPoint(139,23),CSize(50,14));
parent->MapDialogRect(&r2);
mfc2->Create(_T("Cancel"),WS_VISIBLE,r2,parent,IDCANCEL);
mfcToQtWidget->insert(IDCANCEL,mfc2);
// CONTROL "",IDC_SPEED_SLD,"msctls_trackbar32",WS_TABSTOP,7,7,101,16
CSliderCtrl* mfc3 = new CSliderCtrl(parent);
CRect r3(CPoint(7,7),CSize(101,16));
parent->MapDialogRect(&r3);
mfc3->Create(WS_TABSTOP | WS_VISIBLE,r3,parent,IDC_SPEED_SLD);
mfcToQtWidget->insert(IDC_SPEED_SLD,mfc3);
// LTEXT "60 Hz",IDC_SPEED,112,11,26,12
CStatic* mfc4 = new CStatic(parent);
CRect r4(CPoint(112,11),CSize(26,12));
parent->MapDialogRect(&r4);
mfc4->Create(_T("60 Hz"),WS_VISIBLE,r4,parent,IDC_SPEED);
mfcToQtWidget->insert(IDC_SPEED,mfc4);
// END
}
You can see that it should be a straightforward A<-B replacement. Where each dialog element has a specific MFC instantiation.
Code: Select all
// CONTROL "",IDC_SPEED_SLD,"msctls_trackbar32",WS_TABSTOP,7,7,101,16
CSliderCtrl* mfc3 = new CSliderCtrl(parent);
CRect r3(CPoint(7,7),CSize(101,16));
parent->MapDialogRect(&r3);
mfc3->Create(WS_TABSTOP | WS_VISIBLE,r3,parent,IDC_SPEED_SLD);
mfcToQtWidget->insert(IDC_SPEED_SLD,mfc3);
I left the dialog resource file content in as comments, and build the actual dialog element underneath it.
The control's rectangle, style flags, and ID are used directly. The control's Create method is invoked. Then the Qt/MFC linkage is established.