GUI: fixed Bridge::CopyToClipboard (use Qt instead of WinAPI) + fixed various warnings
This commit is contained in:
parent
541e173633
commit
f3d44c8dfa
|
@ -946,7 +946,7 @@ int_t Disassembly::getNextInstructionRVA(int_t rva, uint_t count)
|
|||
int_t wMaxByteCountToRead;
|
||||
int_t wNewRVA;
|
||||
|
||||
if(mMemPage->getSize() < rva)
|
||||
if(mMemPage->getSize() < (uint_t)rva)
|
||||
return rva;
|
||||
wRemainingBytes = mMemPage->getSize() - rva;
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ void StdTable::copyLineSlot()
|
|||
finalText += "\r\n";
|
||||
}
|
||||
}
|
||||
Bridge::CopyToClipboard(finalText.toUtf8().constData());
|
||||
Bridge::CopyToClipboard(finalText);
|
||||
}
|
||||
|
||||
void StdTable::copyTableSlot()
|
||||
|
@ -353,7 +353,7 @@ void StdTable::copyTableSlot()
|
|||
finalText += finalRowText + "\r\n";
|
||||
}
|
||||
}
|
||||
Bridge::CopyToClipboard(finalText.toUtf8().constData());
|
||||
Bridge::CopyToClipboard(finalText);
|
||||
}
|
||||
|
||||
void StdTable::copyEntrySlot()
|
||||
|
@ -362,7 +362,7 @@ void StdTable::copyEntrySlot()
|
|||
if(!action)
|
||||
return;
|
||||
int col = action->objectName().toInt();
|
||||
Bridge::CopyToClipboard(getCellContent(getInitialSelection(), col).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(getCellContent(getInitialSelection(), col));
|
||||
}
|
||||
|
||||
void StdTable::setupCopyMenu(QMenu* copyMenu)
|
||||
|
|
|
@ -18,22 +18,10 @@ Bridge::~Bridge()
|
|||
delete mBridgeMutex;
|
||||
}
|
||||
|
||||
void Bridge::CopyToClipboard(const char* text)
|
||||
void Bridge::CopyToClipboard(const QString & text)
|
||||
{
|
||||
HGLOBAL hText;
|
||||
char* pText;
|
||||
int len = strlen(text);
|
||||
if(!len)
|
||||
return;
|
||||
|
||||
hText = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, len + 1);
|
||||
pText = (char*)GlobalLock(hText);
|
||||
strcpy(pText, text);
|
||||
|
||||
OpenClipboard(0);
|
||||
EmptyClipboard();
|
||||
SetClipboardData(CF_OEMTEXT, hText);
|
||||
CloseClipboard();
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(text);
|
||||
}
|
||||
|
||||
void Bridge::BridgeSetResult(int_t result)
|
||||
|
@ -650,7 +638,7 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
|||
QString finalInstruction = "";
|
||||
for(int i = 0; i < richText.size(); i++)
|
||||
finalInstruction += richText.at(i).text;
|
||||
strcpy(text, finalInstruction.toUtf8().constData());
|
||||
strcpy_s(text, GUI_MAX_DISASSEMBLY_SIZE, finalInstruction.toUtf8().constData());
|
||||
return (void*)1;
|
||||
}
|
||||
break;
|
||||
|
@ -696,9 +684,7 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
|||
QString text = "";
|
||||
if(Bridge::getBridge()->emitGetStrWindow(QString(reinterpret_cast<const char*>(param1)), &text))
|
||||
{
|
||||
if(text.length() >= GUI_MAX_LINE_SIZE)
|
||||
text.chop(text.length() - GUI_MAX_LINE_SIZE);
|
||||
strcpy((char*)param2, text.toUtf8().constData());
|
||||
strcpy_s((char*)param2, GUI_MAX_LINE_SIZE, text.toUtf8().constData());
|
||||
return (void*)(uint_t)true;
|
||||
}
|
||||
return (void*)(uint_t)false; //cancel/escape
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
static void initBridge();
|
||||
|
||||
// Misc functions
|
||||
static void CopyToClipboard(const char* text);
|
||||
static void CopyToClipboard(const QString & text);
|
||||
|
||||
//result function
|
||||
void BridgeSetResult(int_t result);
|
||||
|
|
|
@ -22,7 +22,7 @@ void CPUDisassembly::mousePressEvent(QMouseEvent* event)
|
|||
if(DbgIsDebugging())
|
||||
{
|
||||
QString addrText = QString("%1").arg(rvaToVa(getInitialSelection()), sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
Bridge::CopyToClipboard(addrText.toUtf8().constData());
|
||||
Bridge::CopyToClipboard(addrText);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -984,7 +984,7 @@ void CPUDisassembly::binaryCopySlot()
|
|||
mMemPage->read(data, selStart, selSize);
|
||||
hexEdit.mHexEdit->setData(QByteArray((const char*)data, selSize));
|
||||
delete [] data;
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true));
|
||||
}
|
||||
|
||||
void CPUDisassembly::binaryPasteSlot()
|
||||
|
|
|
@ -1147,7 +1147,7 @@ void CPUDump::binaryCopySlot()
|
|||
mMemPage->read(data, selStart, selSize);
|
||||
hexEdit.mHexEdit->setData(QByteArray((const char*)data, selSize));
|
||||
delete [] data;
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true));
|
||||
}
|
||||
|
||||
void CPUDump::binaryPasteSlot()
|
||||
|
|
|
@ -505,7 +505,7 @@ void CPUStack::binaryCopySlot()
|
|||
mMemPage->read(data, selStart, selSize);
|
||||
hexEdit.mHexEdit->setData(QByteArray((const char*)data, selSize));
|
||||
delete [] data;
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(hexEdit.mHexEdit->pattern(true));
|
||||
}
|
||||
|
||||
void CPUStack::binaryPasteSlot()
|
||||
|
|
|
@ -98,6 +98,7 @@ void CalculatorDialog::validateExpression()
|
|||
|
||||
void CalculatorDialog::on_txtExpression_textChanged(const QString & arg1)
|
||||
{
|
||||
Q_UNUSED(arg1);
|
||||
ui->txtHex->setStyleSheet("");
|
||||
ui->txtSignedDec->setStyleSheet("");
|
||||
ui->txtUnsignedDec->setStyleSheet("");
|
||||
|
|
|
@ -95,6 +95,7 @@ void GotoDialog::validateExpression()
|
|||
|
||||
void GotoDialog::on_editExpression_textChanged(const QString & arg1)
|
||||
{
|
||||
Q_UNUSED(arg1);
|
||||
ui->buttonOk->setEnabled(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ void PatchDialog::on_btnPatchFile_clicked()
|
|||
while(szModName[len] != '\\')
|
||||
len--;
|
||||
char szDirName[MAX_PATH] = "";
|
||||
strcpy(szDirName, szModName);
|
||||
strcpy_s(szDirName, szModName);
|
||||
szDirName[len] = '\0';
|
||||
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Save file", szDirName, "All files (*.*)");
|
||||
|
@ -513,7 +513,7 @@ void PatchDialog::on_btnImport_clicked()
|
|||
QString curLine = lines.at(i);
|
||||
if(curLine.startsWith(">")) //module
|
||||
{
|
||||
strcpy(curPatch.mod, curLine.toUtf8().constData() + 1);
|
||||
strcpy_s(curPatch.mod, curLine.toUtf8().constData() + 1);
|
||||
modbase = DbgFunctions()->ModBaseFromName(curPatch.mod);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ void WordEditDialog::validateExpression()
|
|||
|
||||
void WordEditDialog::on_expressionLineEdit_textChanged(const QString & arg1)
|
||||
{
|
||||
Q_UNUSED(arg1);
|
||||
ui->buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -633,10 +633,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent* event)
|
|||
}
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
if(result.length())
|
||||
{
|
||||
clipboard->setText(result.toUpper().trimmed());
|
||||
QApplication::beep();
|
||||
}
|
||||
}
|
||||
|
||||
// Switch between insert/overwrite mode
|
||||
|
|
Loading…
Reference in New Issue