更新遥控器画面
This commit is contained in:
@@ -15,41 +15,17 @@ P00_PublicPage::P00_PublicPage(QWidget *parent)
|
||||
, ui(new Ui::P00_PublicPage)
|
||||
, m_opcManager(OpcUaManager::instance(this))
|
||||
, m_dataCenter(DataCenter::instance(this))
|
||||
, tts(nullptr)
|
||||
, UIRefresh_Timer(nullptr)
|
||||
, CursorScan_Timer(nullptr)
|
||||
, PLC_Started(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
CursorInit();
|
||||
WinInit();
|
||||
SignalSlotInit();
|
||||
|
||||
QTimer::singleShot(10, this, &P00_PublicPage::WinInit);
|
||||
|
||||
// 连接服务器
|
||||
tsServerAddr tmpServerAddr = ConfigFiles::ReadServerAddr();
|
||||
m_opcManager->connectToServer(tmpServerAddr.Host, tmpServerAddr.UserName, tmpServerAddr.Passwd);
|
||||
|
||||
// 初始化TTS
|
||||
tts = new QTextToSpeech(this);
|
||||
tts->setLocale(QLocale("zh_CN"));
|
||||
tts->setRate(0.0);
|
||||
tts->setPitch(1.0);
|
||||
tts->setVolume(1.0);
|
||||
|
||||
qDebug() << "可用语音列表:";
|
||||
for (const QVoice &v : tts->availableVoices()) {
|
||||
qDebug() << v.name();
|
||||
}
|
||||
|
||||
connect(tts, &QTextToSpeech::stateChanged,
|
||||
[](QTextToSpeech::State s){
|
||||
if (s == QTextToSpeech::Ready)
|
||||
qDebug() << "TTS ready";
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
P00_PublicPage::~P00_PublicPage()
|
||||
@@ -64,11 +40,7 @@ P00_PublicPage::~P00_PublicPage()
|
||||
delete CursorScan_Timer;
|
||||
}
|
||||
|
||||
// 清理TTS
|
||||
if (tts) {
|
||||
tts->stop();
|
||||
delete tts;
|
||||
}
|
||||
|
||||
|
||||
// 清理缓存的窗口
|
||||
qDeleteAll(m_widgetCache);
|
||||
@@ -126,6 +98,7 @@ void P00_PublicPage::onCursorMoved(const QPoint &global)
|
||||
|
||||
void P00_PublicPage::WinInit()
|
||||
{
|
||||
CursorInit();
|
||||
|
||||
ui->Label_VoiceWidget->resize(960,0);
|
||||
ui->Label_VoiceWidget->move(32,70+576/2);
|
||||
@@ -149,6 +122,9 @@ void P00_PublicPage::WinInit()
|
||||
ui->Label_BorderImg->setMinimumSize(QSize(1024,768));
|
||||
ui->Label_BorderImg->move(0,0);
|
||||
#endif
|
||||
|
||||
SignalSlotInit();
|
||||
gPageIndexStr = "P01";
|
||||
}
|
||||
|
||||
void P00_PublicPage::SignalSlotInit()
|
||||
@@ -189,6 +165,7 @@ void P00_PublicPage::onOpcStateChanged(QOpcUaClient::ClientState state)
|
||||
|
||||
|
||||
void P00_PublicPage::UIRefreshTimeOut(){
|
||||
|
||||
ui->Title->setText(gPageName[gPageIndexStr]);
|
||||
// 获取当前时间
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
@@ -254,15 +231,6 @@ void P00_PublicPage::UIRefreshTimeOut(){
|
||||
}
|
||||
if(!isVoice) VoiceWin("",false);
|
||||
|
||||
// qDebug()<<Bools_4<<gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B4"].toString()
|
||||
// <<getBitOf32Data(Bools_4, 0,false)
|
||||
// <<getBitOf32Data(Bools_4, 1,false)
|
||||
// <<getBitOf32Data(Bools_4, 2,false)
|
||||
// <<getBitOf32Data(Bools_4, 3,false)
|
||||
// <<getBitOf32Data(Bools_4, 4,false)
|
||||
// <<getBitOf32Data(Bools_4, 5,false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 静态变量初始化
|
||||
@@ -326,7 +294,7 @@ void P00_PublicPage::on_But_Page_7_clicked(){ ChangePage( 7, 8, "P08");}
|
||||
void P00_PublicPage::on_But_Page_8_clicked(){ ChangePage( 8, 9, "P09");}
|
||||
void P00_PublicPage::on_But_Page_9_clicked(){ ChangePage( 9, 10, "P10");}
|
||||
void P00_PublicPage::on_But_Page_10_clicked(){ ChangePage(10, 11, "P11");}
|
||||
void P00_PublicPage::on_But_Page_11_clicked(){ ChangePage(11, 12, "P12.00");}
|
||||
void P00_PublicPage::on_But_Page_11_clicked(){ ChangePage(11, 12, gPageIndexStr12);}
|
||||
void P00_PublicPage::on_But_Page_12_clicked(){ ChangePage(12, 13, "P13");}
|
||||
void P00_PublicPage::on_But_Page_13_clicked(){ ChangePage(13, 14, "P14");}
|
||||
void P00_PublicPage::on_But_Page_14_clicked(){ ChangePage(14, 15, "P15");}
|
||||
@@ -335,6 +303,7 @@ void P00_PublicPage::ChangePage(uint16_t PageIndex,uint16_t PageNum,QString Page
|
||||
smoothScrollTo(PageIndex);
|
||||
m_opcManager->writeNodeValue("ns=6;s=::AsGlobalPV:PageContol.CurrentPage", PageNum,5,100);
|
||||
gPageIndexStr = PageName;
|
||||
|
||||
}
|
||||
/* 1. 读写属性 */
|
||||
QRect P00_PublicPage::voiceGeometry() const
|
||||
|
||||
Reference in New Issue
Block a user