Commit 5565ea3f by yunpeng.song

改成msvc版本

parent c3ce0fa4
#include "ClickedLineEdit.h"
#include "ClickedLineEdit.h"
#ifndef CLICKEDLINEEDIT_H
#ifndef CLICKEDLINEEDIT_H
#define CLICKEDLINEEDIT_H
#include <QMouseEvent>
......
#include "dataManger.h"
#include "dataManger.h"
#include "preDefine.h"
#include <QJsonArray>
......
#ifndef DATAMANGER_H
#ifndef DATAMANGER_H
#define DATAMANGER_H
#include <QJsonObject>
......
#ifndef FM_DUMP_H
#define FM_DUMP_H
#include <windows.h>
#include <DbgHelp.h>
#include <schannel.h>
void CreateMiniDump(char *file, EXCEPTION_POINTERS* pep)
{
// Open the file
HANDLE hFile = CreateFileA(file, GENERIC_READ | GENERIC_WRITE,
0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
if( ( hFile != NULL ) && ( hFile != INVALID_HANDLE_VALUE ) )
{
// Create the minidump
BOOL rv = 0;
MINIDUMP_EXCEPTION_INFORMATION mdei;
MINIDUMP_TYPE mdt;
mdei.ThreadId = GetCurrentThreadId();
mdei.ExceptionPointers = pep;
mdei.ClientPointers = TRUE;
mdt = MiniDumpWithFullMemory;
rv = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hFile, mdt, (pep != 0) ? &mdei : 0, 0, 0 );
// Close the file
CloseHandle( hFile );
}
}
long __stdcall FMExcpHandler(PEXCEPTION_POINTERS excp)
{
char mod[MAX_PATH] = { 0 };
FILE* ferr = NULL;
GetModuleFileNameA(NULL, mod, MAX_PATH);
strcat(mod, ".err");
ferr = fopen(mod, "w");
fprintf(ferr, "Error address %x\n",excp->ExceptionRecord->ExceptionAddress);
fprintf(ferr, "CPU register:\n");
fprintf(ferr, "eax %x ebx %x ecx %x edx %x\n",excp->ContextRecord->Eax,
excp->ContextRecord->Ebx,excp->ContextRecord->Ecx,
excp->ContextRecord->Edx);
fclose(ferr);
strcat(mod, ".dmp");
CreateMiniDump(mod, excp);
return EXCEPTION_EXECUTE_HANDLER;
}
#endif // DUMP
#include "headframe.h"
#include "headframe.h"
void HeadFrame::mouseMoveEvent(QMouseEvent *event)
{
......
#ifndef HEADFRAME_H
#ifndef HEADFRAME_H
#define HEADFRAME_H
#include <QMouseEvent>
#include <QFrame>
......
#ifndef SYSTRAY_H
#ifndef SYSTRAY_H
#define SYSTRAY_H
#include <QSystemTrayIcon>
......
#include "util.h"
#include "util.h"
#include "preDefine.h"
QString Penny2Dollar(int penny)
......
#ifndef UTIL_H
#ifndef UTIL_H
#define UTIL_H
#include <QString>
......
......@@ -15,9 +15,9 @@
# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#
QT *= core gui
QT += core gui
CONFIG *= c++11
CONFIG += c++11
INCLUDEPATH *= \
$$PWD/include/
......
......@@ -100,12 +100,12 @@ private:
QString requestCrlf_;
QMap< QString, QString > headersData_;
bool headerAcceptedFinish_ = false;
bool alreadyReply_ = false;
bool headerAcceptedFinish_;
bool alreadyReply_;
QByteArray requestRawData_;
qint64 waitWrittenByteCount_ = 0;
qint64 waitWrittenByteCount_;
QSharedPointer< QIODevice > ioDeviceForReply_;
};
......
......@@ -67,7 +67,10 @@ static QString replyImageFormat(
// Session
Session::Session(const QPointer<QIODevice> &tcpSocket):
ioDevice_( tcpSocket ),
timerForClose_( new QTimer )
timerForClose_( new QTimer ),
headerAcceptedFinish_(false),
alreadyReply_ (false),
waitWrittenByteCount_(0)
{
qDebug() << __FUNCTION__ << QThread::currentThreadId();
timerForClose_->setInterval( 30 * 1000 );
......
......@@ -32,7 +32,7 @@ QNetworkAddressEntry JQNet::getNetworkAddressEntry()
QPair< QNetworkAddressEntry, QNetworkInterface > JQNet::getNetworkAddressEntryWithNetworkInterface(const bool &ridVm)
{
for (const auto &interface: QNetworkInterface::allInterfaces())
foreach (const auto &interface, QNetworkInterface::allInterfaces())
{
if ( interface.flags() != (QNetworkInterface::IsUp
| QNetworkInterface::IsRunning
......@@ -41,16 +41,16 @@ QPair< QNetworkAddressEntry, QNetworkInterface > JQNet::getNetworkAddressEntryWi
if ( ridVm && interface.humanReadableName().startsWith( "vm" ) ) { continue; }
for ( const auto &entry: interface.addressEntries() )
foreach ( const auto &entry, interface.addressEntries() )
{
if ( entry.ip().toIPv4Address() )
{
return { entry, interface };
return QPair<QNetworkAddressEntry, QNetworkInterface>(entry,interface);
}
}
}
return { };
return QPair<QNetworkAddressEntry, QNetworkInterface>();
}
QString JQNet::getHostName()
......@@ -168,7 +168,7 @@ QPair< bool, QByteArray > HTTP::get(const QString &url, const int &timeout)
const auto &&flag = HTTP().get( networkRequest, buf, timeout );
return { flag, buf };
return QPair< bool, QByteArray >(flag, buf);
}
QPair< bool, QByteArray > HTTP::get(const QNetworkRequest &request, const int &timeout)
......@@ -178,7 +178,7 @@ QPair< bool, QByteArray > HTTP::get(const QNetworkRequest &request, const int &t
const auto &&flag = http.get( request, buf, timeout );
return { flag, buf };
return QPair< bool, QByteArray > ( flag, buf );
}
QPair< bool, QByteArray > HTTP::post(const QString &url, const QByteArray &appendData, const int &timeout)
......@@ -190,7 +190,7 @@ QPair< bool, QByteArray > HTTP::post(const QString &url, const QByteArray &appen
const auto &&flag = HTTP().post( networkRequest, appendData, buf, timeout );
return { flag, buf };
return QPair< bool, QByteArray >(flag, buf );
}
QPair< bool, QByteArray > HTTP::post(const QNetworkRequest &request, const QByteArray &appendData, const int &timeout)
......@@ -200,7 +200,7 @@ QPair< bool, QByteArray > HTTP::post(const QNetworkRequest &request, const QByte
const auto &&flag = http.post( request, appendData, buf, timeout );
return { flag, buf };
return QPair< bool, QByteArray >(flag, buf );
}
void HTTP::handle(QNetworkReply *reply, const int &timeout,
......
#include "baseObject.h"
#include "baseObject.h"
#include <QStringList>
#include <QVariant>
#include "preDefine.h"
BaseObject::BaseObject(const BaseObject &p, QObject *parent):QObject{parent}
BaseObject::BaseObject(const BaseObject &p, QObject *parent)
{
const QMetaObject *m = p.metaObject();
for( int i=m->propertyOffset(); i<m->propertyCount(); i++)
......
#ifndef BASEOBJECT_H
#ifndef BASEOBJECT_H
#define BASEOBJECT_H
#include <QObject>
......
#include "cashierObject.h"
#include "cashierObject.h"
#ifndef CASHIEROBJECT_H
#ifndef CASHIEROBJECT_H
#define CASHIEROBJECT_H
#include <QString>
......
#include "dailyObject.h"
#include "dailyObject.h"
QString DailyObject::getChannel() const
{
......
#ifndef DAILYOBJECT_H
#ifndef DAILYOBJECT_H
#define DAILYOBJECT_H
#include "baseObject.h"
......
#include "deliverObject.h"
#include "deliverObject.h"
QString DeliverObject::getId() const
{
......
#ifndef DELIVEROBJECT_H
#ifndef DELIVEROBJECT_H
#define DELIVEROBJECT_H
#include "baseObject.h"
......
#include "dishesObject.h"
#include "dishesObject.h"
#ifndef DISHESOBJECT_H
#ifndef DISHESOBJECT_H
#define DISHESOBJECT_H
#include <QObject>
......
#include "orderObject.h"
#include "orderObject.h"
#include "preDefine.h"
#include <QJsonArray>
......
#include "productObject.h"
#include "productObject.h"
#include <QJsonArray>
void ProductObject::FromJson(const QJsonObject &json)
......
#ifndef PRODUCTOBJECT_H
#ifndef PRODUCTOBJECT_H
#define PRODUCTOBJECT_H
#include "baseObject.h"
......
#include "billSocket.h"
#include "billSocket.h"
#include <QtNetwork/QNetworkReply>
#include "preDefine.h"
......
#ifndef BILLSOCKET_H
#ifndef BILLSOCKET_H
#define BILLSOCKET_H
#include <QJsonObject>
......
INCLUDEPATH += $$PWD
#DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message
DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message
#DEFINES += QS_LOG_DISABLE # logging code is replaced with a no-op
DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread
#DEFINES += QS_LOG_WIN_PRINTF_CONSOLE # Use fprintf instead of OutputDebugString on Windows
......
#include "RejectForm.h"
#include "RejectForm.h"
#include "ui_RejectForm.h"
RejectForm::RejectForm(QWidget *parent) :
......
#ifndef REJECTFORM_H
#ifndef REJECTFORM_H
#define REJECTFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RejectForm</class>
<widget class="QDialog" name="RejectForm">
......
#include "alertForm.h"
#include "alertForm.h"
#include "ui_alertForm.h"
AlertForm::AlertForm(QWidget *parent) :
......
#ifndef ALERTFORM_H
#ifndef ALERTFORM_H
#define ALERTFORM_H
// 通知窗口
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AlertForm</class>
<widget class="QDialog" name="AlertForm">
......
#include "bstatusForm.h"
#include "bstatusForm.h"
#include "ui_bstatusForm.h"
#include "Control/flowControl.h"
#include "bstatusItem.h"
......
#ifndef BSTATUSFORM_H
#ifndef BSTATUSFORM_H
#define BSTATUSFORM_H
#include <QDialog>
#include "bstatusItem.h"
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BStatusForm</class>
<widget class="QDialog" name="BStatusForm">
......
#include "bstatusItem.h"
#include "bstatusItem.h"
#include "ui_bstatusItem.h"
#include <QStringList>
#include "Control/flowControl.h"
......
#ifndef BSTATUSITEM_H
#ifndef BSTATUSITEM_H
#define BSTATUSITEM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BStatusItem</class>
<widget class="QDialog" name="BStatusItem">
......
#include "dailyreportForm.h"
#include "dailyreportForm.h"
#include "ui_dailyreportForm.h"
#include <QPainter>
#include "preDefine.h"
......
#ifndef DAYREPORTFORM_H
#ifndef DAYREPORTFORM_H
#define DAYREPORTFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DailyReportForm</class>
<widget class="QDialog" name="DailyReportForm">
......
......@@ -41,8 +41,8 @@ void DetailForm::InitData(OrderObject *orderObject)
ui->detailLab1->setText(QString("%1:%2").arg(orderObject->customer,orderObject->phone));
//ui->detailLab3->setText(orderObject->address);
//ui->detailLab4->setText(QString("[配送方式]%1 [配送费]%2").arg(orderObject->delivery_party,Penny2Dollar(orderObject->send_fee)));
ui->detailLab2->setText(orderObject->delivery_time==0? "立即送出" : QDateTime::fromTime_t(orderObject->delivery_time).toString("MM/dd hh:mm"));
ui->detailLab3->setText(orderObject->courier_name.isEmpty() ? "暂未指定" : QString("[姓名]%1 [电话]%2")
ui->detailLab2->setText(orderObject->delivery_time==0? QString::fromLocal8Bit("立即送出") : QDateTime::fromTime_t(orderObject->delivery_time).toString("MM/dd hh:mm"));
ui->detailLab3->setText(orderObject->courier_name.isEmpty() ? QString::fromLocal8Bit("暂未指定") : QString::fromLocal8Bit("[姓名]%1 [电话]%2")
.arg(orderObject->courier_name, orderObject->courier_phone));
ui->detailLab4->setText(Penny2Dollar(orderObject->product_fee));
//ui->detailLab8->setText(orderObject->has_invoiced? QString("发票抬头:%1").arg(orderObject->invoice_title) : "不需要发票");
......@@ -135,7 +135,7 @@ void DetailForm::onOperaBtnClicked()
{
hide();
QPushButton *pBtn = (QPushButton*)sender();
if(pBtn->text()=="拒单"||pBtn->text()=="退单")
if(pBtn->text()==QString::fromLocal8Bit("拒单")||pBtn->text()==QString::fromLocal8Bit("退单"))
{
// m_rejectForm->show();
// if(m_rejectForm->exec()==QDialog::Accepted)
......
#ifndef DETAILFORM_H
#ifndef DETAILFORM_H
#define DETAILFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DetailForm</class>
<widget class="QDialog" name="DetailForm">
......
#include "disTabWdg.h"
#include "disTabWdg.h"
#include "ui_disTabWdg.h"
#include "Control/flowControl.h"
#include <QScrollBar>
......
#ifndef DISTABWDG_H
#ifndef DISTABWDG_H
#define DISTABWDG_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>disTabWdg</class>
<widget class="QDialog" name="disTabWdg">
......
#include "dishesForm.h"
#include "dishesForm.h"
#include "ui_dishesForm.h"
#include <QPushButton>
#include "Control/flowControl.h"
......
#ifndef DISHESFORM_H
#ifndef DISHESFORM_H
#define DISHESFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dishesForm</class>
<widget class="QDialog" name="dishesForm">
......
#include "dishesItem.h"
#include "dishesItem.h"
#include "ui_dishesItem.h"
#include <QDebug>
#include "Control/flowControl.h"
......
#ifndef DISHESITEM_H
#ifndef DISHESITEM_H
#define DISHESITEM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dishesItem</class>
<widget class="QDialog" name="dishesItem">
......
#ifndef FLOATFORM_H
#ifndef FLOATFORM_H
#define FLOATFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FloatForm</class>
<widget class="QDialog" name="FloatForm">
......
......@@ -18,6 +18,9 @@ CONFIG +=c++11
INCLUDEPATH += DTools
LIBS += -luser32
LIBS += -lUserenv -ldbghelp
DEFINES += TEST TODO
SOURCES += main.cpp\
......@@ -81,7 +84,8 @@ HEADERS += \
refuseForm.h \
Model/dishesObject.h \
dailyreportForm.h \
Model/dailyObject.h
Model/dailyObject.h \
DTools/dump.h
FORMS += mainForm.ui \
alertForm.ui \
......
......@@ -11,6 +11,7 @@
#include <windows.h>
#include <QProcess>
#include <QSqlDatabase>
#include "DTools/dump.h"
using namespace QsLogging;
......@@ -53,10 +54,12 @@ void LoadTheme(const QString& theme)
int main(int argc, char *argv[])
{
#ifdef Q_OS_WIN
SetUnhandledExceptionFilter(FMExcpHandler);
#endif
HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"Global\\fmTakeaway" );
if(NULL!=m_hMutex){
if (GetLastError() == ERROR_ALREADY_EXISTS) {
if (GetLastError() == ERROR_ALREADY_EXISTS||GetLastError() == ERROR_ACCESS_DENIED) {
CloseHandle(m_hMutex);
m_hMutex = NULL;
return -1;
......
......@@ -126,14 +126,14 @@ void MainForm::_Init()
setWindowIcon(QIcon(":fm.ico"));
// 初始化文字
ui->mainLabStoreid->setText(UI_STOREID);
ui->mainLabStoreid->setText(QString::fromLocal8Bit(UI_STOREID));
ui->mainLabVersion->setText(APP_VERSION);
// 初始化表
int scales6[] = {3, 4, 2, 3, 3, 3};
int scales5[] = {3, 6, 2, 3, 3};
int tableWidth = this->width() - 75;
qDebug() << "宽度" << this->width();
qDebug() << "width" << this->width();
foreach(QTableWidget *table, m_tableList)
{
table->hide();
......@@ -172,7 +172,7 @@ void MainForm::onSetCurrentTime()
m_raiseIndex=0;
raise();
}
ui->mainSlabTime->setText(QDateTime::currentDateTime().toString("yyyy年MM月dd日 hh:mm:ss"));
ui->mainSlabTime->setText(QDateTime::currentDateTime().toString(QString::fromLocal8Bit("yyyy年MM月dd日 hh:mm:ss")));
}
void MainForm::onMainTabBtnClicked()
......
#ifndef MAINFORM_H
#ifndef MAINFORM_H
#define MAINFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainForm</class>
<widget class="QWidget" name="MainForm">
......
#include "padForm.h"
#include "padForm.h"
#include "ui_padForm.h"
PadForm::PadForm(QWidget *parent) :
......
#ifndef PADFORM_H
#ifndef PADFORM_H
#define PADFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PadForm</class>
<widget class="QDialog" name="PadForm">
......
#include "pickForm.h"
#include "pickForm.h"
#include "ui_pickForm.h"
#include "preDefine.h"
#include "Control/flowControl.h"
......
#ifndef PICKFORM_H
#ifndef PICKFORM_H
#define PICKFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PickForm</class>
<widget class="QDialog" name="PickForm">
......
#include "refdishesForm.h"
#include "refdishesForm.h"
#include "ui_refdishesForm.h"
#include "Control/flowControl.h"
......
#ifndef REFDISHESFORM_H
#ifndef REFDISHESFORM_H
#define REFDISHESFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>refDishesForm</class>
<widget class="QDialog" name="refDishesForm">
......
#include "refuseForm.h"
#include "refuseForm.h"
#include "ui_refuseForm.h"
#include <QDebug>
......@@ -44,7 +44,7 @@ void RefuseForm::on_reason1_toggled(bool checked)
if(checked)
{
ui->refuseBtnOk->setEnabled(true);
m_reasonStr="餐厅已打烊";
m_reasonStr=QString::fromLocal8Bit("餐厅已打烊");
m_reasonCode=2;
}
}
......@@ -68,7 +68,7 @@ void RefuseForm::on_reason2_toggled(bool checked)
if(checked)
{
ui->refuseBtnOk->setEnabled(true);
m_reasonStr="菜品已售完";
m_reasonStr=QString::fromLocal8Bit("菜品已售完");
m_reasonCode=3;
}
}
......@@ -78,7 +78,7 @@ void RefuseForm::on_reason3_toggled(bool checked)
if(checked)
{
ui->refuseBtnOk->setEnabled(true);
m_reasonStr="餐厅太忙";
m_reasonStr=QString::fromLocal8Bit("餐厅太忙");
m_reasonCode=5;
}
}
......@@ -88,7 +88,7 @@ void RefuseForm::on_reason4_toggled(bool checked)
if(checked)
{
ui->refuseBtnOk->setEnabled(true);
m_reasonStr="联系不上客户";
m_reasonStr=QString::fromLocal8Bit("联系不上客户");
m_reasonCode=6;
}
}
......@@ -98,7 +98,7 @@ void RefuseForm::on_reason5_toggled(bool checked)
if(checked)
{
ui->refuseBtnOk->setEnabled(true);
m_reasonStr="无人配送";
m_reasonStr=QString::fromLocal8Bit("无人配送");
m_reasonCode=-1;
}
}
......
#ifndef REFUSEFORM_H
#ifndef REFUSEFORM_H
#define REFUSEFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RefuseForm</class>
<widget class="QDialog" name="RefuseForm">
......
#ifndef SETTINGFORM_H
#ifndef SETTINGFORM_H
#define SETTINGFORM_H
#include <QDialog>
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingForm</class>
<widget class="QDialog" name="SettingForm">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment