This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0c8db4
commit 522fe1b
Showing
12 changed files
with
407 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "logcontrolbar.h" | ||
#include "ui_logcontrolbar.h" | ||
|
||
LogControlBar::LogControlBar(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::LogControlBar) | ||
{ | ||
ui->setupUi(this); | ||
connect(ui->logTimeSlider,&QSlider::sliderPressed,this,&LogControlBar::sliderPressed); | ||
connect(ui->logTimeSlider,&QSlider::sliderReleased,this,&LogControlBar::sliderReleased); | ||
connect(ui->logTimeSlider,&QSlider::sliderMoved,this,&LogControlBar::sliderMoved); | ||
m_sliderPressed = false; | ||
} | ||
void LogControlBar::sliderPressed() | ||
{ | ||
m_sliderPressed = true; | ||
} | ||
void LogControlBar::sliderReleased() | ||
{ | ||
emit logPosChanged(m_currentPos); | ||
m_sliderPressed = false; | ||
} | ||
void LogControlBar::sliderMoved(int pos) | ||
{ | ||
if (m_sliderPressed) | ||
{ | ||
m_currentPos = pos; | ||
} | ||
} | ||
LogControlBar::~LogControlBar() | ||
{ | ||
delete ui; | ||
} | ||
void LogControlBar::setTime(int current,int total) | ||
{ | ||
if (m_sliderPressed) | ||
{ | ||
return; | ||
} | ||
m_currentPos = current; | ||
if (ui->logTimeSlider->maximum() != total) | ||
{ | ||
ui->logTimeSlider->setMaximum(total); | ||
} | ||
ui->logTimeSlider->setValue(current); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef LOGCONTROLBAR_H | ||
#define LOGCONTROLBAR_H | ||
|
||
#include <QWidget> | ||
|
||
namespace Ui { | ||
class LogControlBar; | ||
} | ||
|
||
class LogControlBar : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit LogControlBar(QWidget *parent = nullptr); | ||
~LogControlBar(); | ||
void setTime(int current,int total); | ||
signals: | ||
void logPosChanged(int pos); | ||
private slots: | ||
void sliderPressed(); | ||
void sliderReleased(); | ||
void sliderMoved(int pos); | ||
private: | ||
int m_currentPos; | ||
bool m_sliderPressed; | ||
Ui::LogControlBar *ui; | ||
}; | ||
|
||
#endif // LOGCONTROLBAR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>LogControlBar</class> | ||
<widget class="QWidget" name="LogControlBar"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>847</width> | ||
<height>115</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QPushButton" name="stopButton"> | ||
<property name="text"> | ||
<string>Stop</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="playButton"> | ||
<property name="text"> | ||
<string>Play</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QSlider" name="logTimeSlider"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.