添加图片翻页
This commit is contained in:
parent
7f55f4b6a1
commit
4572fc445f
Binary file not shown.
|
@ -129,6 +129,16 @@
|
|||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_setburnsn.cpp" line="36"/>
|
||||
<source>tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_setburnsn.cpp" line="36"/>
|
||||
<source>Serial num is empty</source>
|
||||
<translation>序列号为空</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Dialog_UserInput</name>
|
||||
|
@ -665,11 +675,21 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.ui" line="129"/>
|
||||
<source>PrePage</source>
|
||||
<translation>上一张</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.ui" line="136"/>
|
||||
<source>NextPage</source>
|
||||
<translation>下一张</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.ui" line="143"/>
|
||||
<source>LeftRotate</source>
|
||||
<translation>左旋转</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.ui" line="136"/>
|
||||
<location filename="form_maininterface.ui" line="150"/>
|
||||
<source>RightRotate</source>
|
||||
<translation>右旋转</translation>
|
||||
</message>
|
||||
|
@ -689,94 +709,94 @@
|
|||
<translation>下一步</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="48"/>
|
||||
<location filename="form_maininterface.cpp" line="49"/>
|
||||
<source>Device has connected</source>
|
||||
<translation>设备已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="52"/>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<source>Device hasnot connected</source>
|
||||
<translation>设备未连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<location filename="form_maininterface.cpp" line="54"/>
|
||||
<source>Device type:</source>
|
||||
<translation>设备型号:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="53"/>
|
||||
<location filename="form_maininterface.cpp" line="54"/>
|
||||
<source> SerialNum:</source>
|
||||
<translation> 序列号:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="54"/>
|
||||
<location filename="form_maininterface.cpp" line="116"/>
|
||||
<location filename="form_maininterface.cpp" line="55"/>
|
||||
<location filename="form_maininterface.cpp" line="123"/>
|
||||
<source> connect status:</source>
|
||||
<translation> 设备连接状态:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="63"/>
|
||||
<location filename="form_maininterface.cpp" line="64"/>
|
||||
<source>load last image which uploaded last time</source>
|
||||
<translation>加载上一次上传的图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="115"/>
|
||||
<location filename="form_maininterface.cpp" line="122"/>
|
||||
<source>Device has disconnected</source>
|
||||
<translation>设备已断开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="131"/>
|
||||
<location filename="form_maininterface.cpp" line="473"/>
|
||||
<location filename="form_maininterface.cpp" line="139"/>
|
||||
<location filename="form_maininterface.cpp" line="494"/>
|
||||
<source>tips</source>
|
||||
<translation>提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="158"/>
|
||||
<location filename="form_maininterface.cpp" line="173"/>
|
||||
<source>yes</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="159"/>
|
||||
<location filename="form_maininterface.cpp" line="174"/>
|
||||
<source>no</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<location filename="form_maininterface.cpp" line="293"/>
|
||||
<source>ID</source>
|
||||
<translation>序号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<location filename="form_maininterface.cpp" line="293"/>
|
||||
<source>Test items</source>
|
||||
<translation>测试项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="278"/>
|
||||
<location filename="form_maininterface.cpp" line="293"/>
|
||||
<source>status</source>
|
||||
<translation>测试状态</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<location filename="form_maininterface.cpp" line="375"/>
|
||||
<source>not test</source>
|
||||
<translation>未测试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<location filename="form_maininterface.cpp" line="375"/>
|
||||
<source>not pass</source>
|
||||
<translation>不通过</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<location filename="form_maininterface.cpp" line="375"/>
|
||||
<source>not support</source>
|
||||
<translation>不支持</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="360"/>
|
||||
<location filename="form_maininterface.cpp" line="375"/>
|
||||
<source>pass</source>
|
||||
<translation>通过</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="form_maininterface.cpp" line="473"/>
|
||||
<location filename="form_maininterface.cpp" line="494"/>
|
||||
<source>no image</source>
|
||||
<translation>无图</translation>
|
||||
</message>
|
||||
|
|
|
@ -30,6 +30,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
|
|||
, m_devName(devName)
|
||||
, m_devFwNum(devFwNum)
|
||||
, m_isTesting(false)
|
||||
, m_multiIndex(-1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -74,6 +75,12 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
|
|||
|
||||
Form_mainInterface::~Form_mainInterface()
|
||||
{
|
||||
m_multiIndex = -1;
|
||||
m_list_images.clear();
|
||||
QDir dir(getCachePath());
|
||||
if (dir.exists())
|
||||
dir.removeRecursively();
|
||||
|
||||
delete m_hg;
|
||||
m_hg = nullptr;
|
||||
|
||||
|
@ -121,6 +128,7 @@ void Form_mainInterface::paintEvent(QPaintEvent *event)
|
|||
{
|
||||
(void)event;
|
||||
QPainter p(this);
|
||||
p.fillRect(0, 0, this->width(), this->height(), qRgb(230, 230, 230));
|
||||
p.setPen(QColor("gray"));
|
||||
p.drawRect(0, 0, width() -1, height() -1);
|
||||
}
|
||||
|
@ -143,6 +151,13 @@ void Form_mainInterface::on_testResult(QString text)
|
|||
void Form_mainInterface::on_testResultImg(void *img)
|
||||
{
|
||||
HGImage image = (HGImage)img;
|
||||
|
||||
std::string filename = getStdString(getCacheFileName());
|
||||
HGResult ret = HGImgFmt_SaveImage(image, 0, 0, filename.c_str());
|
||||
|
||||
m_list_images.push_back(QString::fromStdString(filename));
|
||||
m_multiIndex = m_list_images.size() - 1;
|
||||
|
||||
ui->stackedWidget->setCurrentWidget(m_view);
|
||||
m_view->addImage(image);
|
||||
ui->pbtn_leftRotate->setVisible(true);
|
||||
|
@ -364,7 +379,7 @@ QString Form_mainInterface::getItemStatusStr(HGUInt status)
|
|||
QString Form_mainInterface::getCachePath()
|
||||
{
|
||||
HGChar cachePath[512];
|
||||
HGBase_GetTmpPath(cachePath, 512);
|
||||
HGBase_GetConfigPath(cachePath, 512);
|
||||
strcat(cachePath, "/Cache/");
|
||||
|
||||
return getStdFileName(StdStringToUtf8(cachePath).c_str());
|
||||
|
@ -399,6 +414,8 @@ void Form_mainInterface::updateUiEnabled(bool enable)
|
|||
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
|
||||
{
|
||||
(void)previous;
|
||||
if (current != nullptr)
|
||||
{
|
||||
ui->pbtn_showImg->setVisible(false);
|
||||
ui->pbtn_leftRotate->setVisible(false);
|
||||
ui->pbtn_rightRotate->setVisible(false);
|
||||
|
@ -431,10 +448,17 @@ void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *cur
|
|||
{
|
||||
ui->pbtn_showImg->setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Form_mainInterface::on_pbtn_start_clicked()
|
||||
{
|
||||
m_multiIndex = -1;
|
||||
m_list_images.clear();
|
||||
QDir dir(getCachePath());
|
||||
if (dir.exists())
|
||||
dir.removeRecursively();
|
||||
|
||||
int row = ui->tableWidget->currentRow();
|
||||
QTableWidgetItem *item = ui->tableWidget->item(row, 1);
|
||||
QString title = item->text();
|
||||
|
@ -483,3 +507,32 @@ void Form_mainInterface::on_pbtn_rightRotate_clicked()
|
|||
{
|
||||
m_view->rotateRight();
|
||||
}
|
||||
|
||||
void Form_mainInterface::on_pbtn_prePage_clicked()
|
||||
{
|
||||
if (m_multiIndex > 0)
|
||||
--m_multiIndex;
|
||||
|
||||
HGImage img = nullptr;
|
||||
QString filename = m_list_images.at(m_multiIndex);
|
||||
HGImgFmt_LoadImage(filename.toStdString().c_str(), 0, 0, 0, 0, &img);
|
||||
if (nullptr != img)
|
||||
{
|
||||
m_view->addImage(img);
|
||||
HGBase_DestroyImage(img);
|
||||
}
|
||||
}
|
||||
|
||||
void Form_mainInterface::on_pbtn_nextPage_clicked()
|
||||
{
|
||||
if (m_multiIndex < m_list_images.size() - 1)
|
||||
++m_multiIndex;
|
||||
HGImage img = nullptr;
|
||||
QString filename = m_list_images.at(m_multiIndex);
|
||||
HGImgFmt_LoadImage(filename.toStdString().c_str(), 0, 0, 0, 0, &img);
|
||||
if (nullptr != img)
|
||||
{
|
||||
m_view->addImage(img);
|
||||
HGBase_DestroyImage(img);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,11 @@ private slots:
|
|||
|
||||
void on_pbtn_rightRotate_clicked();
|
||||
|
||||
void on_pbtn_prePage_clicked();
|
||||
|
||||
void on_pbtn_nextPage_clicked();
|
||||
|
||||
private:
|
||||
void initTableWidgetUi();
|
||||
QString getItemStatusStr(HGUInt status);
|
||||
QString getCachePath();
|
||||
|
@ -93,6 +98,8 @@ private:
|
|||
QString m_devName;
|
||||
QString m_devFwNum;
|
||||
bool m_isTesting;
|
||||
int m_multiIndex;
|
||||
QStringList m_list_images;
|
||||
|
||||
QMap<QString, AnalysisJson::json_node> m_map_title_name;
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>716</width>
|
||||
<height>439</height>
|
||||
<width>854</width>
|
||||
<height>492</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -123,6 +123,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbtn_prePage">
|
||||
<property name="text">
|
||||
<string>PrePage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbtn_nextPage">
|
||||
<property name="text">
|
||||
<string>NextPage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbtn_leftRotate">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in New Issue