Incorporate chat * -> std::string conversion.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2019-09-21 09:58:29 +01:00
parent 52bd4ba3d8
commit 0a6de645e0
10 changed files with 44 additions and 38 deletions

View file

@ -118,10 +118,10 @@ BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value)
return result;
}
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer)
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer)
{
Configuration::instance->putValue(section, key, buffer);
LogFileOutput("RegSaveString: %s - %s = %s\n", section, key, buffer);
LogFileOutput("RegSaveString: %s - %s = %s\n", section, key, buffer.c_str());
}
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value)

View file

@ -10,5 +10,5 @@ const boost::property_tree::ptree & getProperties();
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);

View file

@ -61,14 +61,14 @@ namespace
void setSlot4(const SS_CARDTYPE newCardType)
{
g_Slot4 = newCardType;
REGSAVE(TEXT(REGVALUE_SLOT4), (DWORD)g_Slot4);
g_Slot[4] = newCardType;
REGSAVE(TEXT(REGVALUE_SLOT4), (DWORD)g_Slot[4]);
}
void setSlot5(const SS_CARDTYPE newCardType)
{
g_Slot5 = newCardType;
REGSAVE(TEXT(REGVALUE_SLOT5), (DWORD)g_Slot5);
g_Slot[5] = newCardType;
REGSAVE(TEXT(REGVALUE_SLOT5), (DWORD)g_Slot[5]);
}
const std::vector<eApple2Type> computerTypes = {A2TYPE_APPLE2, A2TYPE_APPLE2PLUS, A2TYPE_APPLE2E, A2TYPE_APPLE2EENHANCED,
@ -131,27 +131,27 @@ Preferences::Data getCurrentOptions(const std::shared_ptr<QGamepad> & gamepad)
currentOptions.disks.resize(diskIDs.size());
for (size_t i = 0; i < diskIDs.size(); ++i)
{
const char * diskName = sg_Disk2Card.GetFullName(diskIDs[i]);
if (diskName)
const std::string & diskName = sg_Disk2Card.GetFullName(diskIDs[i]);
if (!diskName.empty())
{
currentOptions.disks[i] = diskName;
currentOptions.disks[i] = QString::fromStdString(diskName);
}
}
currentOptions.hds.resize(hdIDs.size());
for (size_t i = 0; i < hdIDs.size(); ++i)
{
const char * diskName = HD_GetFullName(hdIDs[i]);
if (diskName)
const std::string & diskName = HD_GetFullName(hdIDs[i]);
if (!diskName.empty())
{
currentOptions.hds[i] = diskName;
currentOptions.hds[i] = QString::fromStdString(diskName);
}
}
currentOptions.enhancedSpeed = sg_Disk2Card.GetEnhanceDisk();
currentOptions.cardInSlot0 = getSlot0Card();
currentOptions.mouseInSlot4 = g_Slot4 == CT_MouseInterface;
currentOptions.cpmInSlot5 = g_Slot5 == CT_Z80;
currentOptions.mouseInSlot4 = g_Slot[4] == CT_MouseInterface;
currentOptions.cpmInSlot5 = g_Slot[5] == CT_Z80;
currentOptions.hdInSlot7 = HD_CardIsEnabled();
currentOptions.ramWorksSize = getRamWorksMemorySize();
@ -167,10 +167,10 @@ Preferences::Data getCurrentOptions(const std::shared_ptr<QGamepad> & gamepad)
currentOptions.joystickId = 0;
}
const char* saveState = Snapshot_GetFilename();
if (saveState)
const std::string & saveState = Snapshot_GetFilename();
if (!saveState.empty())
{
currentOptions.saveState = QString::fromUtf8(saveState);;
currentOptions.saveState = QString::fromStdString(saveState);
}
currentOptions.screenshotTemplate = getScreenshotTemplate();
@ -253,7 +253,7 @@ void setNewOptions(const Preferences::Data & currentOptions, const Preferences::
{
const std::string name = newOptions.saveState.toStdString();
Snapshot_SetFilename(name);
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, name.c_str());
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, name);
}
if (currentOptions.screenshotTemplate != newOptions.screenshotTemplate)

View file

@ -58,7 +58,7 @@ namespace
CheckCpu();
SetWindowTitle();
window->setWindowTitle(g_pAppTitle);
window->setWindowTitle(QString::fromStdString(g_pAppTitle));
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
@ -317,7 +317,7 @@ void QApple::on_actionReboot_triggered()
emit endEmulator();
stopEmulator();
startEmulator(myEmulatorWindow);
myEmulatorWindow->setWindowTitle(g_pAppTitle);
myEmulatorWindow->setWindowTitle(QString::fromStdString(g_pAppTitle));
myEmulator->updateVideo();
restartTimeCounters();
}
@ -378,7 +378,7 @@ void QApple::on_actionLoad_state_triggered()
{
emit endEmulator();
Snapshot_LoadState();
myEmulatorWindow->setWindowTitle(g_pAppTitle);
myEmulatorWindow->setWindowTitle(QString::fromStdString(g_pAppTitle));
myEmulator->updateVideo();
}

View file

@ -17,10 +17,10 @@ namespace
}
}
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer)
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer)
{
Q_UNUSED(peruser)
const QString s = QString::fromUtf8(buffer);
const QString s = QString::fromStdString(buffer);
getOurSettings().setValue(getKey(section, key), QVariant::fromValue(s));
}

View file

@ -2,11 +2,12 @@
#define SETTINGS_H
#include "linux/wincompat.h"
#include <string>
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);
#endif // SETTINGS_H

View file

@ -26,16 +26,21 @@ int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.c
DWORD g_dwCyclesThisFrame = 0;
bool g_bFullSpeed = false;
SS_CARDTYPE g_Slot0 = CT_LanguageCard;
SS_CARDTYPE g_Slot2 = CT_SSC;
SS_CARDTYPE g_Slot4 = CT_Empty;
SS_CARDTYPE g_Slot5 = CT_Empty;
SS_CARDTYPE g_Slot[8] = {
/*0*/ CT_LanguageCard, // Just for Apple II or II+ or similar clones
/*1*/ CT_GenericPrinter,
/*2*/ CT_SSC,
/*3*/ CT_Uthernet,
/*4*/ CT_Empty,
/*5*/ CT_Empty,
/*6*/ CT_Disk2,
/*7*/ CT_Empty };
SS_CARDTYPE g_SlotAux = CT_Extended80Col;
HANDLE g_hCustomRomF8 = INVALID_HANDLE_VALUE; // Cmd-line specified custom ROM at $F800..$FFFF
TCHAR g_sProgramDir[MAX_PATH] = TEXT(""); // Directory of where AppleWin executable resides
TCHAR g_sCurrentDir[MAX_PATH] = TEXT(""); // Also Starting Dir. Debugger uses this when load/save
const TCHAR *g_pAppTitle = TITLE_APPLE_2E_ENHANCED;
std::string g_sProgramDir; // Directory of where AppleWin executable resides
std::string g_sCurrentDir; // Also Starting Dir. Debugger uses this when load/save
std::string g_pAppTitle = TITLE_APPLE_2E_ENHANCED;
bool g_bRestart = false;
CSuperSerialCard sg_SSC;
CMouseInterface sg_Mouse;
@ -275,11 +280,11 @@ void LoadConfiguration(void)
#endif
if(REGLOAD(TEXT(REGVALUE_SLOT0), &dwTmp))
g_Slot0 = (SS_CARDTYPE) dwTmp;
g_Slot[0] = (SS_CARDTYPE) dwTmp;
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
g_Slot4 = (SS_CARDTYPE) dwTmp;
g_Slot[4] = (SS_CARDTYPE) dwTmp;
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
g_Slot5 = (SS_CARDTYPE) dwTmp;
g_Slot[5] = (SS_CARDTYPE) dwTmp;
//

View file

@ -235,7 +235,7 @@ BYTE VideoSetMode (WORD pc, WORD address, BYTE bWrite, BYTE d, ULONG uExecutedCy
return MemReadFloatingBus(uExecutedCycles);
}
void Video_ResetScreenshotCounter( char *pImageName )
void Video_ResetScreenshotCounter( const std::string & pImageName )
{
}

View file

@ -29,7 +29,7 @@ void Phasor_SaveSnapshot(YamlSaveHelper&, unsigned int) { }
std::string Phasor_GetSnapshotCardName() { return ""; }
void IPropertySheet::ApplyNewConfig(CConfigNeedingRestart const&, CConfigNeedingRestart const&) { }
void FrameUpdateApple2Type() { }
bool SetCurrentImageDir(char const*) { return true; }
bool SetCurrentImageDir(const std::string & ) { return true; }
void CSuperSerialCard::SaveSnapshot(YamlSaveHelper&) { }
// Copied from Video.cpp as it is too complicated to compile and use Video.cpp

View file

@ -34,7 +34,7 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCycle
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars) { return FALSE; }
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value) { return FALSE; }
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value) { return FALSE; }
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer) { }
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer) { }
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) { }
// MessageBox