add:视频窗口始终在前

This commit is contained in:
Barry 2019-06-15 07:56:06 +08:00
parent d7532cef33
commit 3bee801fd7
5 changed files with 68 additions and 24 deletions

View file

@ -106,6 +106,9 @@ void Dialog::on_startServerBtn_clicked()
// this is ok that "native" toUshort is 0
quint16 videoSize = ui->videoSizeBox->currentText().trimmed().toUShort();
m_videoForm = new VideoForm(ui->serialBox->currentText().trimmed(), videoSize, bitRate, absFilePath);
if (ui->alwaysTopCheck->isChecked()) {
m_videoForm->staysOnTop();
}
outLog("start server...", false);
}
@ -222,3 +225,16 @@ void Dialog::on_recordPathEdt_textChanged(const QString &arg1)
{
ui->recordPathEdt->setToolTip(arg1);
}
void Dialog::on_alwaysTopCheck_stateChanged(int arg1)
{
if (!m_videoForm) {
return;
}
if (Qt::Checked == arg1) {
m_videoForm->staysOnTop(true);
} else {
m_videoForm->staysOnTop(false);
}
}

View file

@ -41,6 +41,8 @@ private slots:
void on_recordPathEdt_textChanged(const QString &arg1);
void on_alwaysTopCheck_stateChanged(int arg1);
private:
bool checkAdbRun();
void initUI();

View file

@ -158,17 +158,13 @@
<string>Config</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>record save path:</string>
</property>
</widget>
<item row="0" column="5">
<widget class="QComboBox" name="formatBox"/>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_6">
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>record format</string>
<string>video size:</string>
</property>
</widget>
</item>
@ -179,13 +175,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>bit rate:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="bitRateBox">
<property name="toolTip">
@ -196,15 +185,19 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>video size:</string>
<string>bit rate:</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QComboBox" name="formatBox"/>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>record save path:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="recordPathEdt">
@ -220,6 +213,23 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_6">
<property name="text">
<string>record format</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="alwaysTopCheck">
<property name="text">
<string>always top</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -28,9 +28,7 @@ VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate, co
m_bitRate(bitRate)
{
ui->setupUi(this);
initUI();
setWindowFlag(Qt::WindowStaysOnTopHint);
initUI();
m_server = new Server();
m_frames.init();
@ -356,6 +354,22 @@ void VideoForm::postTextInput(const QString& text)
m_inputConvert.sendControlEvent(controlEvent);
}
void VideoForm::staysOnTop(bool top)
{
bool needShow = false;
if (isVisible()) {
needShow = true;
}
if (top) {
setWindowFlag(Qt::WindowStaysOnTopHint);
} else {
setWindowFlag(Qt::WindowStaysOnTopHint, false);
}
if (needShow) {
show();
}
}
void VideoForm::postGoHome()
{
postKeyCodeClick(AKEYCODE_HOME);

View file

@ -38,6 +38,8 @@ public:
void postTurnOn();
void postTextInput(const QString& text);
void staysOnTop(bool top = true);
private:
void updateShowSize(const QSize &newSize);
void updateStyleSheet(bool vertical);