1 Star 0 Fork 1

rykren / HotelPlatformServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hotelplatformserver.cpp 6.97 KB
一键复制 编辑 原始数据 按行查看 历史
Orange_Kang 提交于 2019-09-01 11:56 . 功能完善
#include "hotelplatformserver.h"
#include "ui_hotelplatformserver.h"
HotelPlatformServer::HotelPlatformServer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::HotelPlatformServer)
{
ui->setupUi(this);
ui->menuBar->hide();
ui->statusBar->hide();
this->setContextMenuPolicy(Qt::NoContextMenu); //去掉工具栏的右键菜单
this->setCentralWidget(ui->widget);
ExecSQL::searchAllReserveInfos();
ExecSQL::searchAllUserInfos();
ExecSQL::searchAllHotelInfos();
ExecSQL::searchAllHouseInfos();
ExecSQL::searchAllCommentInfos();
ExecSQL::searchAllSaveInfos();
m_saveImageCount = 0;
m_msgServer = new MsgServer();
connect(m_msgServer, SIGNAL(signalShowImageServer(QImage)),
this, SLOT(slotShowImageServer(const QImage&)));
connect(m_msgServer, SIGNAL(signalSaveCommentImage(const QString&,const QImage&)),
this, SLOT(slotSaveCommentImage(const QString&,const QImage&)));
connect(m_msgServer, SIGNAL(signalSaveHouseImage(const QString&,const QImage&)),
this, SLOT(slotSaveHouseImage(const QString&,const QImage&)));
connect(m_msgServer, SIGNAL(signalSaveHotelImage(const QString&,const QImage&)),
this, SLOT(slotSaveHotelImage(const QString&,const QImage&)));
connect(m_msgServer, SIGNAL(signalUploadPicSuccessed()),
this, SLOT(slotUploadPicSuccessed()));
/// 保存用户头像 + 用户实名认证图片
connect(m_msgServer, SIGNAL(signalSaveUserCertImage(const QString&,const QImage&)),
this, SLOT(slotSaveUserCertImage(const QString&,const QImage&)));
connect(m_msgServer, SIGNAL(signalSaveUserHeadImage(const QString&,const QImage&)),
this, SLOT(slotSaveUserHeadImage(const QString&,const QImage&)));
m_userManage = new UserManage(ui->widget);
m_hotelManage = new HotelManage(ui->widget);
m_hotelManage->close();
m_pictureShow = new PictureShow(this);
m_pictureShow->show();
}
HotelPlatformServer::~HotelPlatformServer()
{
delete ui;
}
void HotelPlatformServer::slotShowImageServer(const QImage& image)
{
qDebug() << "show image " << image.width() << " " << image.height();
m_pictureShow->showPic(image);
}
void HotelPlatformServer::on_actionUserManage_triggered()
{
m_userManage->show();
m_hotelManage->close();
}
void HotelPlatformServer::on_actionHotelManage_triggered()
{
m_hotelManage->show();
m_userManage->close();
}
void HotelPlatformServer::slotUploadPicSuccessed()
{
m_currentCommentID.clear();
m_currentHouseID.clear();
m_currentHotelID.clear();
m_currentUserID.clear();
}
void HotelPlatformServer::slotSaveCommentImage(const QString& commentID, const QImage& image)
{
if(image.width() > 0 && image.height() > 0)
{
qDebug() << "here" << m_currentCommentID << commentID << m_saveImageCount;
if (m_currentCommentID != commentID)
{
m_saveImageCount = 1;
m_currentCommentID = commentID;
}
else
{
m_saveImageCount++;
}
QString path = GlobalVars::g_localConfig.readCommentImagePath();
QString imageName = QString("%1_%2.jpg").arg(commentID).arg(m_saveImageCount);
image.save(path + "/" + imageName);
for (int i = 0; i < m_saveImageCount; i++)
{
path += ("#" + QString("%1_%2.jpg").arg(commentID).arg(i+1));
}
ExecSQL::modifyCommentInfoForPhoto(commentID,path);
}
}
void HotelPlatformServer::slotSaveHouseImage(const QString& houseID, const QImage& image)
{
qDebug() << "here" << m_currentHouseID << houseID << m_saveImageCount;
if(image.width() > 0 && image.height() > 0)
{
if (m_currentHouseID != houseID)
{
m_saveImageCount = 1;
m_currentHouseID = houseID;
}
else
{
m_saveImageCount++;
}
QString path = GlobalVars::g_localConfig.readHouseImagePath();
QString imageName = QString("%1_%2.jpg").arg(houseID).arg(m_saveImageCount);
image.save(path + "/" + imageName);
for (int i = 0; i < m_saveImageCount; i++)
{
path += ("#" + QString("%1_%2.jpg").arg(houseID).arg(i+1));
}
ExecSQL::modifyHouseInfoForPhoto(houseID,path);
}
}
void HotelPlatformServer::slotSaveHotelImage(const QString& hotelID, const QImage& image)
{
qDebug() << "here" << m_currentHotelID << hotelID << m_saveImageCount;
if (m_currentHotelID != hotelID)
{
m_saveImageCount = 1;
m_currentHotelID = hotelID;
}
if (m_saveImageCount == 1)
{
m_saveImageCount++;
if(image.width() > 0 && image.height() > 0)
{
QString path = GlobalVars::g_localConfig.readLicenseImagePath();
QString imageName = QString("%1License.jpg").arg(hotelID);
QString imagePath = path + "/" + imageName;
image.save(imagePath);
ExecSQL::modifyHotelInfoForLicense(hotelID,imagePath);
}
}
else
{
if(image.width() > 0 && image.height() > 0)
{
QString path = GlobalVars::g_localConfig.readHotelImagePath();
QString imageName = QString("%1_%2.jpg").arg(hotelID).arg(m_saveImageCount-1);
image.save(path + "/" + imageName);
for (int i = 1; i < m_saveImageCount; i++)
{
path += ("#" + QString("%1_%2.jpg").arg(hotelID).arg(i));
}
qDebug() << imageName << path;
ExecSQL::modifyHotelInfoForPhoto(hotelID,path);
m_saveImageCount++;
}
}
}
void HotelPlatformServer::slotSaveUserCertImage(const QString& userID, const QImage& image)
{
qDebug() << "here" << m_currentUserID << userID << m_saveImageCount;
if(image.width() > 0 && image.height() > 0)
{
if (m_currentUserID != userID)
{
m_saveImageCount = 1;
m_currentUserID = userID;
}
else
{
m_saveImageCount++;
}
QString path = GlobalVars::g_localConfig.readCertImagePath();
QString imageName = QString("%1_%2.jpg").arg(userID).arg(m_saveImageCount-1);
image.save(path + "/" + imageName);
for (int i = 0; i < m_saveImageCount; i++)
{
path += ("#" + QString("%1_%2.jpg").arg(userID).arg(i));
}
qDebug() << imageName << path;
ExecSQL::modifyUserInfoForCertPath(userID,path);
}
}
void HotelPlatformServer::slotSaveUserHeadImage(const QString& userID, const QImage& image)
{
qDebug() << "here" << m_currentUserID << userID << m_saveImageCount;
if(image.width() > 0 && image.height() > 0)
{
if (m_currentUserID != userID)
{
m_currentUserID = userID;
}
QString path = GlobalVars::g_localConfig.readHeadImagePath();
QString imageName = QString("%1Head.jpg").arg(userID);
QString imagePath = path + "/" + imageName;
image.save(imagePath);
ExecSQL::modifyUserInfoForHeadPic(userID,imagePath);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/rykren/HotelPlatformServer.git
git@gitee.com:rykren/HotelPlatformServer.git
rykren
HotelPlatformServer
HotelPlatformServer
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891