first commit
This commit is contained in:
144
project/fm_viewer/ui/QProgressIndicator.cpp
Normal file
144
project/fm_viewer/ui/QProgressIndicator.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2011 Morgan Leborgne
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "QProgressIndicator.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
|
||||
QProgressIndicator::QProgressIndicator(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
m_angle(0),
|
||||
m_timerId(-1),
|
||||
m_delay(40),
|
||||
m_displayedWhenStopped(false),
|
||||
m_color(QColor(0xc2c4d6)) //Qt::white)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setFixedSize(50,50);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
|
||||
bool QProgressIndicator::isAnimated () const
|
||||
{
|
||||
return (m_timerId != -1);
|
||||
}
|
||||
|
||||
void QProgressIndicator::setDisplayedWhenStopped(bool state)
|
||||
{
|
||||
m_displayedWhenStopped = state;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
bool QProgressIndicator::isDisplayedWhenStopped() const
|
||||
{
|
||||
return m_displayedWhenStopped;
|
||||
}
|
||||
|
||||
void QProgressIndicator::startAnimation()
|
||||
{
|
||||
m_angle = 0;
|
||||
|
||||
if (m_timerId == -1)
|
||||
m_timerId = startTimer(m_delay);
|
||||
}
|
||||
|
||||
void QProgressIndicator::stopAnimation()
|
||||
{
|
||||
if (m_timerId != -1)
|
||||
killTimer(m_timerId);
|
||||
|
||||
m_timerId = -1;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QProgressIndicator::setAnimationDelay(int delay)
|
||||
{
|
||||
if (m_timerId != -1)
|
||||
killTimer(m_timerId);
|
||||
|
||||
m_delay = delay;
|
||||
|
||||
if (m_timerId != -1)
|
||||
m_timerId = startTimer(m_delay);
|
||||
}
|
||||
|
||||
void QProgressIndicator::setColor(const QColor & color)
|
||||
{
|
||||
m_color = color;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
QSize QProgressIndicator::sizeHint() const
|
||||
{
|
||||
return QSize(20,20);
|
||||
}
|
||||
|
||||
int QProgressIndicator::heightForWidth(int w) const
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
void QProgressIndicator::timerEvent(QTimerEvent * /*event*/)
|
||||
{
|
||||
m_angle = (m_angle+30)%360;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
|
||||
{
|
||||
if (!m_displayedWhenStopped && !isAnimated())
|
||||
return;
|
||||
|
||||
int width = qMin(this->width(), this->height());
|
||||
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// qInfo() << width;
|
||||
|
||||
int outerRadius = (width-1)*0.5;
|
||||
int innerRadius = (width-1)*0.5*0.6;
|
||||
|
||||
int capsuleHeight = outerRadius - innerRadius;
|
||||
int capsuleWidth = (width > 32 ) ? capsuleHeight *.35 : capsuleHeight *.35;
|
||||
int capsuleRadius = capsuleWidth/2;
|
||||
|
||||
for (int i=0; i<12; i++)
|
||||
{
|
||||
QColor color = m_color;
|
||||
color.setAlphaF(1.0f - (i/12.0f));
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(color);
|
||||
p.save();
|
||||
p.translate(rect().center());
|
||||
p.rotate(m_angle - i*30.0f);
|
||||
p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
|
||||
p.restore();
|
||||
}
|
||||
}
|
||||
111
project/fm_viewer/ui/QProgressIndicator.h
Normal file
111
project/fm_viewer/ui/QProgressIndicator.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2011 Morgan Leborgne
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QPROGRESSINDICATOR_H
|
||||
#define QPROGRESSINDICATOR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
|
||||
/*!
|
||||
\class QProgressIndicator
|
||||
\brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
|
||||
|
||||
Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
|
||||
\sa QProgressBar
|
||||
*/
|
||||
class QProgressIndicator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
|
||||
Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
public:
|
||||
QProgressIndicator(QWidget* parent = 0);
|
||||
|
||||
/*! Returns the delay between animation steps.
|
||||
\return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
|
||||
\sa setAnimationDelay
|
||||
*/
|
||||
int animationDelay() const { return m_delay; }
|
||||
|
||||
/*! Returns a Boolean value indicating whether the component is currently animated.
|
||||
\return Animation state.
|
||||
\sa startAnimation stopAnimation
|
||||
*/
|
||||
bool isAnimated () const;
|
||||
|
||||
/*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
|
||||
\return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
|
||||
\sa setDisplayedWhenStopped
|
||||
*/
|
||||
bool isDisplayedWhenStopped() const;
|
||||
|
||||
/*! Returns the color of the component.
|
||||
\sa setColor
|
||||
*/
|
||||
const QColor & color() const { return m_color; }
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
int heightForWidth(int w) const;
|
||||
public slots:
|
||||
/*! Starts the spin animation.
|
||||
\sa stopAnimation isAnimated
|
||||
*/
|
||||
void startAnimation();
|
||||
|
||||
/*! Stops the spin animation.
|
||||
\sa startAnimation isAnimated
|
||||
*/
|
||||
void stopAnimation();
|
||||
|
||||
/*! Sets the delay between animation steps.
|
||||
Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller value speeds it up.
|
||||
\param delay The delay, in milliseconds.
|
||||
\sa animationDelay
|
||||
*/
|
||||
void setAnimationDelay(int delay);
|
||||
|
||||
/*! Sets whether the component hides itself when it is not animating.
|
||||
\param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true.
|
||||
\sa isDisplayedWhenStopped
|
||||
*/
|
||||
void setDisplayedWhenStopped(bool state);
|
||||
|
||||
/*! Sets the color of the components to the given color.
|
||||
\sa color
|
||||
*/
|
||||
void setColor(const QColor & color);
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent * event);
|
||||
virtual void paintEvent(QPaintEvent * event);
|
||||
private:
|
||||
int m_angle;
|
||||
int m_timerId;
|
||||
int m_delay;
|
||||
bool m_displayedWhenStopped;
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
#endif // QPROGRESSINDICATOR_H
|
||||
268
project/fm_viewer/ui/fm_360_position_view.cpp
Normal file
268
project/fm_viewer/ui/fm_360_position_view.cpp
Normal file
@@ -0,0 +1,268 @@
|
||||
|
||||
#include "fm_360_position_view.h"
|
||||
#if (USE_360_POSITION_VIEW)
|
||||
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#define POS_VIEW_SIZE 80
|
||||
#define POS_VIEW_RIGHT_MARGIN 83
|
||||
#define POS_VIEW_OFFSET 10
|
||||
|
||||
FM360PositionView::FM360PositionView(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
//setFixedSize(POS_VIEW_SIZE,POS_VIEW_SIZE);
|
||||
_ax = 0.0;
|
||||
_ay = 0.0;
|
||||
}
|
||||
void FM360PositionView::setAngle(double ax,double ay)
|
||||
{
|
||||
//qInfo() << _ax << _ay << __FUNCTION__;
|
||||
_ax = ax;
|
||||
_ay = ay;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FM360PositionView::map_to_custom_angles(double x, double y, double *ax, double* ay)
|
||||
{
|
||||
// 0.0~1.0 => -1.0~1.0 로 변경
|
||||
double X = (x-0.5) * 2.0;
|
||||
double Y = (y-0.5) * 2.0;
|
||||
|
||||
const double M_PI = 3.14159265359f;
|
||||
|
||||
// 2. Yaw (Z축 기준의 좌우 각도) 계산
|
||||
// atan2(Y, X)를 사용하여 -PI ~ PI 라디안 값 획득
|
||||
// 각도는 x축의 양의 방향(오른쪽)을 0∘ 로 하여 반시계 방향으로 0∘에서 360∘까지 측정됨
|
||||
double yaw = atan2(-Y, X);
|
||||
|
||||
// 라디안을 도로 변환하고, 0 ~ 360도 범위로 조정
|
||||
yaw = yaw * 180.0 / M_PI;
|
||||
|
||||
if (yaw < 0.0) {
|
||||
yaw += 360.0;
|
||||
}
|
||||
yaw = 90.0 - yaw; // 시계 방향 각도로 변환 (Y축(90도)을 0도로 기준 잡기 위해 90에서 뺌)
|
||||
|
||||
if (yaw < 0.0) {
|
||||
yaw += 360.0;
|
||||
}
|
||||
*ax = yaw;
|
||||
|
||||
// 3. Pitch = 거리 계산
|
||||
double pitch_90_deg;
|
||||
double horizontal_dist = sqrt(X * X + Y * Y);
|
||||
if(horizontal_dist > 1.0) {
|
||||
horizontal_dist = 1.0;
|
||||
}
|
||||
pitch_90_deg = (horizontal_dist * 70.0) + 270.0;
|
||||
*ay = pitch_90_deg;
|
||||
}
|
||||
|
||||
void FM360PositionView::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
QRect pr = _posRect();
|
||||
// 마우스 클릭용으로 POS_VIEW_OFFSET 제거한 큰 영역
|
||||
const int margin = 10;
|
||||
QRect containRect = pr.adjusted(-margin,-margin,margin,margin);
|
||||
|
||||
if(containRect.contains(e->pos())) {
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
QWidget::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void FM360PositionView::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
QRect pr = _posRect();
|
||||
// 마우스 클릭용으로 POS_VIEW_OFFSET 제거한 큰 영역
|
||||
const int margin = 10;
|
||||
QRect containRect = pr.adjusted(-margin,-margin,margin,margin);
|
||||
|
||||
if(containRect.contains(e->pos())) {
|
||||
const double ex = (double)(e->pos().x() - pr.left()) / (double)pr.width();
|
||||
const double ey = (double)(e->pos().y() - pr.top()) / (double)pr.height();
|
||||
double yaw, pitch;
|
||||
//convert_2d_to_yaw_pitch(ex,ey,&yaw,&pitch);
|
||||
map_to_custom_angles(ex,ey,&yaw,&pitch);
|
||||
//qInfo() << "yaw.pitch:" << yaw << pitch << __FUNCTION__;
|
||||
//pitch = 340.0;
|
||||
setAngle(yaw,pitch);
|
||||
emit angleUpdated(yaw,pitch);
|
||||
} else { // 네비게이션 클릭시 하위에 클릭 이벤트 발생시키지 않는다..
|
||||
QWidget::mouseReleaseEvent(e);
|
||||
}
|
||||
}
|
||||
QRect FM360PositionView::_posRect()
|
||||
{
|
||||
const int lx = size().width() - POS_VIEW_RIGHT_MARGIN;
|
||||
const int end = POS_VIEW_SIZE-(POS_VIEW_OFFSET*2);
|
||||
// 실제 영역
|
||||
return QRect(lx+POS_VIEW_OFFSET, POS_VIEW_OFFSET, end, end);
|
||||
}
|
||||
|
||||
void FM360PositionView::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe)
|
||||
|
||||
const int lx = size().width() - POS_VIEW_RIGHT_MARGIN;
|
||||
//const QColor color = QColor(0xCC, 0x99, 0x33, 0xCC);
|
||||
const QColor color = QColor(0xFF, 0xCC, 0x33, 0xCC);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
const int width = 3;
|
||||
QPen pen = QPen(color,width, Qt::SolidLine);
|
||||
//QPen pen = QPen(color,width, Qt::SolidLine);
|
||||
|
||||
painter.setPen(pen);
|
||||
//const int offset = POS_VIEW_OFFSET;
|
||||
const int end = POS_VIEW_SIZE-(POS_VIEW_OFFSET*2);
|
||||
painter.drawEllipse(QRect(lx+POS_VIEW_OFFSET, POS_VIEW_OFFSET, end, end));
|
||||
//painter.drawRect(QRect(lx+offset, offset, end, end));
|
||||
painter.drawLine(lx+POS_VIEW_SIZE/2, POS_VIEW_OFFSET + width,lx+POS_VIEW_SIZE/2, POS_VIEW_SIZE-POS_VIEW_OFFSET-width);
|
||||
painter.drawLine(lx+POS_VIEW_OFFSET+width,POS_VIEW_SIZE/2,lx+POS_VIEW_SIZE-POS_VIEW_OFFSET-width,POS_VIEW_SIZE/2);
|
||||
|
||||
const double DEG_PI = 3.14159265359f;
|
||||
double r = ((_ay- 200.0) / 140.0) - 0.5; // 340~200 => -0.5~0.5
|
||||
|
||||
double xoffset = 270;
|
||||
if(r < 0.0) {
|
||||
xoffset += 180;
|
||||
}
|
||||
double seta = ((_ax+xoffset) * DEG_PI / 180.0);
|
||||
|
||||
r = abs(r) * 2.0; // 0.0~1.0
|
||||
const double hsize = POS_VIEW_SIZE/2;
|
||||
const double x = (cos(seta) * r * (hsize*0.7)) + hsize; // -1.0~1.0 => 0~POS_VIEW_SIZE
|
||||
const double y = (sin(seta) * r * (hsize*0.7)) + hsize; // -1.0~1.0 => 0~POS_VIEW_SIZE
|
||||
|
||||
const int csize = 9;//12;
|
||||
QColor white = QColor(0xFF, 0xFF, 0xFF);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(white); // QColor(0xCC, 0x99, 0x33, 0xA0)
|
||||
QRect rect = QRect(lx+x-csize,y-csize,(csize*2),(csize*2));
|
||||
painter.drawEllipse(rect);
|
||||
|
||||
//qInfo() << "XY:" << x << y << "RP:" << _ax << _ay << "R:" << r << __FUNCTION__;
|
||||
}
|
||||
|
||||
FM360StaticPositionView::FM360StaticPositionView(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
|
||||
ptl = QPixmap(":/image/cam_01.png");
|
||||
ptr = QPixmap(":/image/cam_02.png");
|
||||
pbr = QPixmap(":/image/cam_04.png"); // 2025/10/15 표지 변경 -> 2026/01/08 다시 변경
|
||||
pbl = QPixmap(":/image/cam_03.png"); //
|
||||
pc = QPixmap(":/image/cam_center.png");
|
||||
}
|
||||
void FM360StaticPositionView::setMode(int mode)
|
||||
{
|
||||
_mode = mode;
|
||||
//qInfo() << _mode << __FUNCTION__;
|
||||
}
|
||||
void FM360StaticPositionView::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe)
|
||||
if(_mode == 0) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
//_mode : 1=4분할, 4=5분할
|
||||
if(_mode == 1) { // 4분할
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
const int width = 42;
|
||||
const int height = 42;
|
||||
const int xOffset = 10;
|
||||
const int yOffset = 10;
|
||||
const int hw = size().width() / 2;
|
||||
const int hh = size().height() / 2;
|
||||
|
||||
QRect tl = QRect(hw-width-xOffset,hh - height - yOffset,width,height);
|
||||
painter.drawPixmap(tl, ptl);
|
||||
|
||||
//QRect tr = QRect((hw*2)-width-xOffset,yOffset,width,height);
|
||||
QRect tr = QRect(hw+xOffset,hh - height - yOffset,width,height);
|
||||
painter.drawPixmap(tr, ptr);
|
||||
|
||||
QRect bl = QRect(hw-width-xOffset,hh + yOffset,width,height);
|
||||
painter.drawPixmap(bl, pbl);
|
||||
|
||||
//QRect br = QRect((hw*2)-width-xOffset,hh + yOffset,width,height);
|
||||
QRect br = QRect(hw+xOffset,hh + yOffset,width,height);
|
||||
painter.drawPixmap(br, pbr);
|
||||
|
||||
painter.end();
|
||||
} else if (_mode == 4) { // 5분할
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
#if (MULTI_5CH_LR)
|
||||
|
||||
const float leftArea = 0.5f;
|
||||
const int bwidth = (int)(((float)size().width()) * ((1.0f - leftArea) * 0.5f));
|
||||
// 좌측영역 PX
|
||||
const int left = (int)(((float)size().width()) * leftArea);
|
||||
QRect cr = QRect(left-84-10,10,84,84);
|
||||
painter.drawPixmap(cr, pc);
|
||||
|
||||
const int width = 42;
|
||||
const int height = 42;
|
||||
const int xOffset = 3;
|
||||
const int yOffset = 3;
|
||||
const int left2 = left + bwidth;
|
||||
|
||||
const int hOffset = (int)((float)size().height() * (float)0.5f);
|
||||
|
||||
//QRect tl = QRect(left+bwidth-width-xOffset,yOffset,width,height);
|
||||
QRect tl = QRect(left+bwidth-width-xOffset,hOffset - height - yOffset,width,height);
|
||||
painter.drawPixmap(tl, ptl);
|
||||
|
||||
//QRect tr = QRect(left2+bwidth-width-xOffset,yOffset,width,height);
|
||||
QRect tr = QRect(left+bwidth+xOffset,hOffset - height - yOffset,width,height);
|
||||
painter.drawPixmap(tr, ptr);
|
||||
|
||||
|
||||
QRect bl = QRect(left+bwidth-width-xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(bl, pbl);
|
||||
|
||||
//QRect br = QRect(left2+bwidth-width-xOffset,hOffset+yOffset,width,height);
|
||||
QRect br = QRect(left+bwidth+xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(br, pbr);
|
||||
|
||||
#else // !MULTI_5CH_LR
|
||||
|
||||
QRect cr = QRect(size().width()-84-10,10,84,84);
|
||||
painter.drawPixmap(cr, pc);
|
||||
|
||||
|
||||
const int width = 42;
|
||||
const int height = 42;
|
||||
const int xOffset = 3;
|
||||
const int yOffset = 3;
|
||||
const int qw = size().width() / 4;
|
||||
const int hOffset = (int)((float)size().height() * (float)0.75f);
|
||||
|
||||
QRect tl = QRect((qw * 1)-width-xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(tl, ptl);
|
||||
|
||||
QRect tr = QRect((qw * 2)-width-xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(tr, ptr);
|
||||
|
||||
QRect bl = QRect((qw * 3)-width-xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(bl, pbl);
|
||||
|
||||
QRect br = QRect((qw * 4)-width-xOffset,hOffset+yOffset,width,height);
|
||||
painter.drawPixmap(br, pbr);
|
||||
#endif // #else // !MULTI_5CH_LR
|
||||
painter.end();
|
||||
}
|
||||
|
||||
}
|
||||
#endif // #if (USE_360_POSITION_VIEW)
|
||||
48
project/fm_viewer/ui/fm_360_position_view.h
Normal file
48
project/fm_viewer/ui/fm_360_position_view.h
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
#ifndef FM_360_POSITION_VIEW_H
|
||||
#define FM_360_POSITION_VIEW_H
|
||||
|
||||
#if (USE_360_POSITION_VIEW)
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class FM360PositionView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
double _ax;
|
||||
double _ay;
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
/**
|
||||
* @brief 더블클릭으로 전체화면 전환 방지
|
||||
*/
|
||||
void mouseDoubleClickEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
QRect _posRect();
|
||||
void map_to_custom_angles(double x, double y, double *px, double* py);
|
||||
public:
|
||||
explicit FM360PositionView(QWidget *parent = nullptr);
|
||||
|
||||
void setAngle(double ax,double ay);
|
||||
signals:
|
||||
void angleUpdated(double yow, double pitch);
|
||||
};
|
||||
|
||||
class FM360StaticPositionView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
int _mode;
|
||||
QPixmap ptl;
|
||||
QPixmap ptr;
|
||||
QPixmap pbl;
|
||||
QPixmap pbr;
|
||||
QPixmap pc;
|
||||
public:
|
||||
void setMode(int mode);
|
||||
explicit FM360StaticPositionView(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
#endif // #if (USE_360_POSITION_VIEW)
|
||||
#endif // FM_360_POSITION_VIEW_H
|
||||
837
project/fm_viewer/ui/fm_button.cpp
Normal file
837
project/fm_viewer/ui/fm_button.cpp
Normal file
@@ -0,0 +1,837 @@
|
||||
#include "fm_button.h"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QVariant>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QTimer>
|
||||
#include <QFile>
|
||||
#include "../rm_include.h"
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
#include "../core/rm_language.h"
|
||||
#endif
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
FM_COLOR_SET g_default_text_button_color_set[5] = {
|
||||
0xDDDDDD, // normal
|
||||
0xFFFFFF, // pressed
|
||||
0xcc9933, // hover
|
||||
0x595959, // disabled
|
||||
0xDDDDDD, // checked
|
||||
};
|
||||
|
||||
FMButton::FMButton(QWidget *parent) : RMButton(parent)
|
||||
{
|
||||
#if (LIVE_LANGUAGE2)
|
||||
type = BUTTON_TYPE_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
FMButton::~FMButton()
|
||||
{
|
||||
}
|
||||
|
||||
void FMButton::_setColorStyleSheet(const char* iconName, FM_COLOR_SET* color)
|
||||
{
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
background-color: #%color_normal%;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
background-color: #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
background-color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
background-color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_3.png);\
|
||||
background-color: #%color_disabled%;\
|
||||
}";
|
||||
// QString disabledName = QString(iconName) + "_3.png";
|
||||
// if(!QFile::exists(":/images/" + disabledName))
|
||||
// {
|
||||
// src = src.replace("%name%_3.png);","%name%.png); opacity:50;");
|
||||
// }
|
||||
|
||||
//qInfo() << src << __FUNCTION__;
|
||||
setStyleSheet(src.replace("%name%",iconName)
|
||||
.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED]))
|
||||
.replace("%name%",iconName));
|
||||
}
|
||||
FMButton* FMButton::btnTypeChecked(QWidget* parent, QLayout* layout,const char* iconName, const char* iconName2, QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
border:1px solid #666666;\
|
||||
image: url(:/image/%name%.png);\
|
||||
background-color: #%color_normal%;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
background-color: #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
background-color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
image: url(:/image/%checked_name%.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
background-color: #%color_disabled%;\
|
||||
}";
|
||||
btn->setStyleSheet(src.replace("%name%",iconName)
|
||||
.replace("%checked_name%",iconName2)
|
||||
.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED]))
|
||||
.replace("%name%",iconName));
|
||||
|
||||
btn->setCheckable(true);
|
||||
btn->setObjectName(iconName);
|
||||
if(size.width() > 0 && size.height() > 0) {
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
} else if (size.height() > 0) {
|
||||
btn->setFixedHeight(size.height());
|
||||
btn->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
} else if (size.width() > 0) {
|
||||
btn->setFixedWidth(size.width());
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
}
|
||||
layout->addWidget(btn);
|
||||
return btn;
|
||||
}
|
||||
FMButton* FMButton::btnTypeText(QWidget* parent, QLayout* layout,QString title, QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
if(title.length() > 0) {
|
||||
btn->setText(title);
|
||||
}
|
||||
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
color : white;\
|
||||
font-family: 'Malgun Gothic';\
|
||||
font-size: 16px;\
|
||||
border:1px solid #666666;\
|
||||
background-color: #%color_normal%;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
background-color: #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
background-color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
background-color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
background-color: #%color_disabled%;\
|
||||
}";
|
||||
btn->setStyleSheet(src.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED])));
|
||||
|
||||
//btn->setObjectName(iconName);
|
||||
if(size.width() > 0 && size.height() > 0) {
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
} else if (size.height() > 0) {
|
||||
btn->setFixedHeight(size.height());
|
||||
btn->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
} else if (size.width() > 0) {
|
||||
btn->setFixedWidth(size.width());
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
}
|
||||
layout->addWidget(btn);
|
||||
return btn;
|
||||
}
|
||||
FMButton* FMButton::btnTypeTextColor(QWidget* parent, QLayout* layout,QString title, QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
if(title.length() > 0) {
|
||||
btn->setText(title);
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
color : #%color_normal%;\
|
||||
font-family: 'Fixedsys';\
|
||||
font-size: 13px;\
|
||||
background-color: transparent;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
color : #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
color: #%color_disabled%;\
|
||||
}";
|
||||
#else
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
color : #%color_normal%;\
|
||||
font-family: 'Malgun Gothic';\
|
||||
font-size: 16px;\
|
||||
background-color: transparent;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
color : #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
color: #%color_disabled%;\
|
||||
}";
|
||||
#endif // #RM_MODEL_TYPE_AN6000
|
||||
btn->setStyleSheet(src.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED])));
|
||||
|
||||
//btn->setObjectName(iconName);
|
||||
if(size.width() > 0 && size.height() > 0) {
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
} else if (size.height() > 0) {
|
||||
btn->setFixedHeight(size.height());
|
||||
btn->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
} else if (size.width() > 0) {
|
||||
btn->setFixedWidth(size.width());
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
}
|
||||
layout->addWidget(btn);
|
||||
return btn;
|
||||
}
|
||||
FMButton* FMButton::btnEmpty(QWidget* parent, QLayout* layout,QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
border:1px solid #666666;\
|
||||
background-color: #%color_normal%;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
background-color: #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
background-color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
background-color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
background-color: #%color_disabled%;\
|
||||
}";
|
||||
btn->setStyleSheet(src.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED]))
|
||||
);
|
||||
|
||||
if(size.width() > 0 && size.height() > 0) {
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
} else if (size.height() > 0) {
|
||||
btn->setFixedHeight(size.height());
|
||||
btn->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
} else if (size.width() > 0) {
|
||||
btn->setFixedWidth(size.width());
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
}
|
||||
layout->addWidget(btn);
|
||||
return btn;
|
||||
}
|
||||
FMButton* FMButton::btnType0(QWidget* parent, QLayout* layout,const char* iconName, QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
//btn->_setColorStyleSheet(iconName,color);
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
border:1px solid #666666;\
|
||||
image: url(:/image/%name%.png);\
|
||||
background-color: #%color_normal%;\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
background-color: #%color_pressed%;\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
background-color: #%color_hover%;\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
background-color: #%color_checked%;\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
background-color: #%color_disabled%;\
|
||||
}";
|
||||
btn->setStyleSheet(src.replace("%name%",iconName)
|
||||
.replace("%color_normal%",FMColor(color[FM_COLOR_SET_NORMAL]))
|
||||
.replace("%color_pressed%",FMColor(color[FM_COLOR_SET_PRESSED]))
|
||||
.replace("%color_hover%",FMColor(color[FM_COLOR_SET_HOVER]))
|
||||
.replace("%color_checked%",FMColor(color[FM_COLOR_SET_CHECKED]))
|
||||
.replace("%color_disabled%",FMColor(color[FM_COLOR_SET_DISABLED]))
|
||||
.replace("%name%",iconName));
|
||||
|
||||
btn->setObjectName(iconName);
|
||||
if(size.width() > 0 && size.height() > 0) {
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
} else if (size.height() > 0) {
|
||||
btn->setFixedHeight(size.height());
|
||||
btn->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
} else if (size.width() > 0) {
|
||||
btn->setFixedWidth(size.width());
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
}
|
||||
layout->addWidget(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* FMButton::btnColor2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_COLOR_ICON;
|
||||
#endif
|
||||
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setColorStyleSheet(iconName,color);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
|
||||
if(color != NULL) {
|
||||
for(int i=0;i<FM_COLOR_SET_COUNT;i++) {
|
||||
btn->colorset[i] = color[i];
|
||||
}
|
||||
}
|
||||
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
#endif
|
||||
return btn;
|
||||
}
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* FMButton::btnColor(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size, FM_COLOR_SET* color)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_COLOR_ICON;
|
||||
#endif
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
btn->_setColorStyleSheet(iconName,color);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
if(color != NULL) {
|
||||
for(int i=0;i<FM_COLOR_SET_COUNT;i++) {
|
||||
btn->colorset[i] = color[i];
|
||||
}
|
||||
}
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip.length() > 0 ) {
|
||||
|
||||
#if (SUB_MODEL_BV5000)
|
||||
RMLanguage::instance()->append(RMLanguage::instance()->language(),RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#else
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return btn;
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
void FMButton::_setStyleSheet(const char* iconName)
|
||||
{
|
||||
// border: 1px solid red;
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_2.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_1.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_3.png);\
|
||||
}";
|
||||
setStyleSheet(src.replace("%name%",iconName));
|
||||
}
|
||||
void FMButton::_setStaticStyleSheet(const char* iconName)
|
||||
{
|
||||
// border: 1px solid red;
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}";
|
||||
setStyleSheet(src.replace("%name%",iconName));
|
||||
}
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* FMButton::btnStatic2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_STATIC;
|
||||
#endif
|
||||
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setStaticStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
btn->setEnabled(false);
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* FMButton::btnStatic(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_STATIC;
|
||||
#endif
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
btn->_setStaticStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
btn->setEnabled(false);
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip.length() > 0 ) {
|
||||
#if (SUB_MODEL_BV5000)
|
||||
RMLanguage::instance()->append(RMLanguage::instance()->language(),RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#else
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return btn;
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* FMButton::btn2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size, int index)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_ICON;
|
||||
#endif
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
if(index < 0) {
|
||||
layout->addWidget(btn);
|
||||
}
|
||||
else {
|
||||
QHBoxLayout* hl = qobject_cast<QHBoxLayout*>(layout);
|
||||
if(hl != NULL) {
|
||||
hl->insertWidget(index,btn);
|
||||
}
|
||||
}
|
||||
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* FMButton::btn(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size, int index)
|
||||
{
|
||||
|
||||
FMButton* btn = new FMButton(parent);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_ICON;
|
||||
#endif
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
btn->_setStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
if(index < 0) {
|
||||
layout->addWidget(btn);
|
||||
}
|
||||
else {
|
||||
QHBoxLayout* hl = qobject_cast<QHBoxLayout*>(layout);
|
||||
if(hl != NULL) {
|
||||
hl->insertWidget(index,btn);
|
||||
}
|
||||
}
|
||||
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip.length() > 0 ) {
|
||||
#if (SUB_MODEL_BV5000)
|
||||
RMLanguage::instance()->append(RMLanguage::instance()->language(),RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#else
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return btn;
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
void FMButton::updateProperty(const char* property,bool enable)
|
||||
{
|
||||
//qInfo() << "property:" << enable << __FUNCTION__;
|
||||
setProperty(property,enable);
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
update();
|
||||
}
|
||||
|
||||
void FMButton::_setPropertyStyleSheet(const char* iconName,const char* property) {
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_2.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_1.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_3.png);\
|
||||
}\
|
||||
FMButton[%property%=true]\
|
||||
{\
|
||||
image: url(:/image/%name%_%property%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed[%property%=true]\
|
||||
{\
|
||||
image: url(:/image/%name%_%property%_2.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed[%property%=true]\
|
||||
{\
|
||||
image: url(:/image/%name%_%property%_1.png);\
|
||||
}\
|
||||
FMButton:disabled[%property%=true]\
|
||||
{\
|
||||
image: url(:/image/%name%_%property%_3.png);\
|
||||
}";
|
||||
//qInfo() << src.replace("%name%",iconName).replace("%property%",property) << __FUNCTION__;
|
||||
setStyleSheet(src.replace("%name%",iconName).replace("%property%",property));
|
||||
}
|
||||
void FMButton::_setCheckStyleSheet(const char* iconName)
|
||||
{
|
||||
// border: 1px solid red;
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_2.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_1.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_3.png);\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
image: url(:/image/%name%_checked.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:checked:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_checked_2.png);\
|
||||
}\
|
||||
FMButton:checked:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_checked_1.png);\
|
||||
}\
|
||||
FMButton:checked:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_checked_3.png);\
|
||||
}";
|
||||
setStyleSheet(src.replace("%name%",iconName));
|
||||
}
|
||||
void FMButton::_setPressCheckStyleSheet(const char* iconName)
|
||||
{
|
||||
|
||||
// border: 1px solid red;
|
||||
QString src = "\
|
||||
FMButton\
|
||||
{\
|
||||
image: url(:/image/%name%.png);\
|
||||
}\
|
||||
\
|
||||
FMButton:pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_2.png);\
|
||||
}\
|
||||
FMButton:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%name%_1.png);\
|
||||
}\
|
||||
FMButton:disabled\
|
||||
{\
|
||||
image: url(:/image/%name%_3.png);\
|
||||
}\
|
||||
FMButton:checked\
|
||||
{\
|
||||
image: url(:/image/%name%_1.png);\
|
||||
}";
|
||||
setStyleSheet(src.replace("%name%",iconName));
|
||||
}
|
||||
void FMButton::blockFor(int ms)
|
||||
{
|
||||
setEnabled(false);
|
||||
QTimer::singleShot(ms, [this]() {
|
||||
setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* FMButton::btnPressCheck2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
btn->type = BUTTON_TYPE_CHECK_ICON;
|
||||
btn->setCheckable(true);
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setPressCheckStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
|
||||
btn->setObjectName(iconName);
|
||||
//btn->setFixedSize(size);
|
||||
//btn->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
FMButton* FMButton::btnProperty(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, const char* property, QSize size)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
btn->type = BUTTON_TYPE_PROPERTY_ICON;
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setPropertyStyleSheet(iconName,property);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
|
||||
FMButton* FMButton::btnCheck2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
btn->type = BUTTON_TYPE_CHECK_ICON;
|
||||
btn->setCheckable(true);
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->_setCheckStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* FMButton::btnCheck(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size)
|
||||
{
|
||||
FMButton* btn = new FMButton(parent);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
btn->type = BUTTON_TYPE_CHECK_ICON;
|
||||
#endif
|
||||
btn->setCheckable(true);
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
btn->_setCheckStyleSheet(iconName);
|
||||
//LAYOUT_DEBUG(btn);
|
||||
btn->setObjectName(iconName);
|
||||
btn->setFixedSize(size);
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip.length() > 0 ) {
|
||||
#if (SUB_MODEL_BV5000)
|
||||
RMLanguage::instance()->append(RMLanguage::instance()->language(),RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#else
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return btn;
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
|
||||
83
project/fm_viewer/ui/fm_button.h
Normal file
83
project/fm_viewer/ui/fm_button.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#ifndef FM_BUTTON_H
|
||||
#define FM_BUTTON_H
|
||||
|
||||
#include "rm_button.h"
|
||||
#include "fm_layer.h"
|
||||
|
||||
|
||||
|
||||
extern FM_COLOR_SET g_default_text_button_color_set[5];
|
||||
|
||||
class FMButton : public RMButton
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
void _setStyleSheet(const char* iconName);
|
||||
void _setColorStyleSheet(const char* iconName, FM_COLOR_SET* color);
|
||||
void _setCheckStyleSheet(const char* iconName);
|
||||
void _setPropertyStyleSheet(const char* iconName,const char* property);
|
||||
void _setStaticStyleSheet(const char* iconName);
|
||||
public:
|
||||
void _setPressCheckStyleSheet(const char* iconName);
|
||||
|
||||
void updateProperty(const char* property,bool enable);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
enum FMBUTTON_TYPE{
|
||||
BUTTON_TYPE_UNKNOWN = 0,
|
||||
BUTTON_TYPE_ICON = 1,
|
||||
BUTTON_TYPE_COLOR_ICON = 2,
|
||||
BUTTON_TYPE_CHECK_ICON = 3,
|
||||
BUTTON_TYPE_STATIC = 4,
|
||||
BUTTON_TYPE_PROPERTY_ICON = 5,
|
||||
};
|
||||
FMBUTTON_TYPE type;
|
||||
FM_COLOR_SET colorset[FM_COLOR_SET_COUNT]; // COLOR 저장
|
||||
void setIcon(QString iconName) {
|
||||
if(type == BUTTON_TYPE_COLOR_ICON) {
|
||||
_setColorStyleSheet(iconName.toLocal8Bit().data(),colorset);
|
||||
}
|
||||
else if (type == BUTTON_TYPE_ICON) {
|
||||
_setStyleSheet(iconName.toLocal8Bit().data());
|
||||
}
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
int valueTag; // value tag
|
||||
FMButton(QWidget *parent = 0);
|
||||
~FMButton();
|
||||
|
||||
|
||||
void blockFor(int ms);
|
||||
|
||||
static FMButton* btnEmpty(QWidget* parent, QLayout* layout,QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
|
||||
static FMButton* btnType0(QWidget* parent, QLayout* layout,const char* iconName, QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
static FMButton* btnTypeChecked(QWidget* parent, QLayout* layout,const char* iconName, const char* iconName2, QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
static FMButton* btnTypeText(QWidget* parent, QLayout* layout,QString title, QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
static FMButton* btnTypeTextColor(QWidget* parent, QLayout* layout,QString title, QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
static FMButton* btnColor2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size, FM_COLOR_SET* color);
|
||||
static FMButton* btnStatic2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size);
|
||||
static FMButton* btn2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size, int index = -1);
|
||||
|
||||
static FMButton* btnCheck2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, QSize size);
|
||||
|
||||
/**
|
||||
* @brief Property 지정 버튼
|
||||
*/
|
||||
static FMButton* btnProperty(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip, const char* property, QSize size);
|
||||
|
||||
//! CHECKED 설정 이미지를 PRESSED 로 사용
|
||||
static FMButton* btnPressCheck2(QWidget* parent, QLayout* layout, const char* iconName, const char* toolTip);
|
||||
#else // LIVE_LANGUAGE2
|
||||
static FMButton* btnColor(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size, FM_COLOR_SET* color);
|
||||
static FMButton* btnStatic(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size);
|
||||
static FMButton* btn(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size, int index = -1);
|
||||
static FMButton* btnCheck(QWidget* parent, QLayout* layout, const char* iconName, QString toolTip, QSize size);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
};
|
||||
|
||||
#endif // FM_BUTTON_H
|
||||
401
project/fm_viewer/ui/fm_calendar.cpp
Normal file
401
project/fm_viewer/ui/fm_calendar.cpp
Normal file
@@ -0,0 +1,401 @@
|
||||
|
||||
#include "fm_calendar.h"
|
||||
#if (USE_DATE_TIME_LIST)
|
||||
#include <QDate>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include "rm_include.h"
|
||||
#include "../ui/fm_button.h"
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "fm_colors.h"
|
||||
#include "../core/rm_player.h"
|
||||
|
||||
FMCalendarFrame::FMCalendarFrame(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
bLoadStarted = true;
|
||||
setFixedHeight(250);
|
||||
mLayout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(mLayout);
|
||||
|
||||
QWidget* toolbar = new QWidget(this);
|
||||
toolbar->setFixedHeight(30);
|
||||
mLayout->addWidget(toolbar);
|
||||
QHBoxLayout* toolLayout = new QHBoxLayout(toolbar);
|
||||
ZERO_LAYOUT(toolLayout);
|
||||
|
||||
before = FMButton::btnTypeTextColor(toolbar,toolLayout," < ","",QSize(20,20),g_default_text_button_color_set);
|
||||
connect(before,SIGNAL(clicked()),SLOT(onChangeMonth()));
|
||||
|
||||
mYearLabel = new QLabel(toolbar);
|
||||
mYearLabel->setAlignment(Qt::AlignCenter);
|
||||
mYearLabel->setStyleSheet("font-family: Fixedsys;color : #DDDDDD;");
|
||||
|
||||
toolLayout->addWidget(mYearLabel);
|
||||
|
||||
next = FMButton::btnTypeTextColor(toolbar,toolLayout," > ","",QSize(20,20),g_default_text_button_color_set);
|
||||
connect(next,SIGNAL(clicked()),SLOT(onChangeMonth()));
|
||||
|
||||
|
||||
mCalendar = new FMCalendar(this);
|
||||
mLayout->addWidget(mCalendar);
|
||||
|
||||
RMVideoFileList* fileList = RMVideoFileList::instance();
|
||||
//connect(fileList,SIGNAL(listUpdateEnd(bool,RMVideoItem*)),this,SLOT(onListUpdateEnd(bool,RMVideoItem*)));
|
||||
connect(fileList,SIGNAL(listUpdateStarted(bool)),this,SLOT(onListUpdateStarted(bool)));
|
||||
|
||||
|
||||
refreshMonth();
|
||||
|
||||
//connect(fileList,SIGNAL(playItemFound(RMVideoItem*,int)),SLOT(onPlayItemFound(RMVideoItem*,int)));
|
||||
//connect(fileList,SIGNAL(playNoMoreItem()),SLOT(onPlayNoMoreItem()));
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
}
|
||||
void FMCalendarFrame::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
// PLAY_WILL_LOADED
|
||||
if(event == PLAY_ITEM_SELECTED && item != NULL) {
|
||||
playTime = item->startTime();
|
||||
QDate pdate = item->startTime().date();
|
||||
// 리스트 또는 다음파일 이동에서 재생되었는지
|
||||
// '분' 항목에서 재생되었는지 확인 필요
|
||||
|
||||
QDate cdate = QDate(mCalendar->date.year(),mCalendar->date.month(),mCalendar->mSelectedDay);
|
||||
|
||||
if(cdate != pdate || bLoadStarted) {
|
||||
|
||||
// 년/월이 변경되었을 경우 달력을 다시 로딩
|
||||
// 2023/06/30 -> 2023/07/01 로 변경시 적용안됨?
|
||||
if(bLoadStarted || mCalendar->date.year() != pdate.year() || mCalendar->date.month() != pdate.month())
|
||||
{
|
||||
mCalendar->date.setDate(pdate.year(),pdate.month(),pdate.day());
|
||||
mCalendar->mSelectedDay = pdate.day();
|
||||
onChangeMonth(); // 달력 업데이트
|
||||
}
|
||||
|
||||
mCalendar->date.setDate(pdate.year(),pdate.month(),pdate.day());
|
||||
mCalendar->mSelectedDay = pdate.day();
|
||||
mCalendar->update(); // 다시 그리기
|
||||
|
||||
mCalendar->updateDayItems(); // 날짜리스트 다시 로딩
|
||||
// 리스트에서 전달되었으므로 리스트 없데이트 X
|
||||
emit mCalendar->dateSelected(&mCalendar->mDayItems,&playTime,false);
|
||||
//qInfo() << "DATE CHANGED:" << mCalendar->date << pdate << __FUNCTION__;
|
||||
} else {
|
||||
// 시간만 변경된 경우
|
||||
//qInfo() << playTime << __FUNCTION__;
|
||||
// 리스트에서 전달되었으므로 리스트 없데이트 X
|
||||
emit mCalendar->playTime(&playTime,false);
|
||||
}
|
||||
|
||||
if(bLoadStarted) {
|
||||
bLoadStarted = false;
|
||||
}
|
||||
|
||||
|
||||
} else if (event == PLAY_DID_CLEARED) {
|
||||
/*
|
||||
mCalendar->mSelectedDay = -1;
|
||||
mCalendar->update();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void FMCalendarFrame::onListUpdateStarted(bool bLoading)
|
||||
{
|
||||
// 2회 발생하는 경우도 있으며 bLoading false 로 ..
|
||||
if(bLoading) {
|
||||
bLoadStarted = true;
|
||||
}
|
||||
//qInfo() << bLoadStarted << __FUNCTION__;
|
||||
}
|
||||
/*
|
||||
// 파일 선택되면서 자동으로 처리되어 필요없음 ... ->
|
||||
// 현재 표시되는 '월'일 경우 파일이 선택되더라도 자동으로 업데이트가 안되니
|
||||
// 강제 업데이트가 필요함 onPlayEvent 의 PLAY_ITEM_SELECTED 는
|
||||
// onListUpdateEnd 이전에 발생함
|
||||
void FMCalendarFrame::onListUpdateEnd(bool bLoading, RMVideoItem* selected)
|
||||
{
|
||||
Q_UNUSED(bLoading)
|
||||
Q_UNUSED(selected)
|
||||
if(bLoading) {
|
||||
qInfo() << selected << __FUNCTION__;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void FMCalendarFrame::onChangeMonth()
|
||||
{
|
||||
FMButton* btn = qobject_cast<FMButton*>(sender());
|
||||
if(btn == next) {
|
||||
mCalendar->date = mCalendar->date.addMonths(1);
|
||||
} else if (btn == before) {
|
||||
mCalendar->date = mCalendar->date.addMonths(-1);
|
||||
}
|
||||
RMVideoFileList::instance()->getMonthList(mCalendar->date.year(),mCalendar->date.month(),mCalendar->mExists,mCalendar->mMonthItems);
|
||||
|
||||
// 월의 첫날짜로 구분
|
||||
if(mCalendar->mMonthItems.isEmpty()) { // 없을경우...
|
||||
mCalendar->mSelectedDay = -1;
|
||||
} else {
|
||||
mCalendar->mSelectedDay = mCalendar->mMonthItems.first()->startTime().date().day();
|
||||
}
|
||||
|
||||
// 월 텍스트 변경
|
||||
refreshMonth();
|
||||
|
||||
|
||||
// 재생시 리스트 변경의 경우
|
||||
if(btn == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCalendar->updateDayItems();
|
||||
mCalendar->update();
|
||||
|
||||
// 선택된 달에 영상이 존재할 경우
|
||||
if(!mCalendar->mMonthItems.isEmpty()) {
|
||||
static QDateTime tt;
|
||||
tt = mCalendar->mDayItems.first()->startTime();
|
||||
|
||||
// 달력업데이트로 처리 하였으니 리스트 업데이트 = true
|
||||
emit mCalendar->dateSelected(&mCalendar->mDayItems,&tt,true);
|
||||
} else {
|
||||
emit mCalendar->clearDate(); // 해당월에 날짜 없음
|
||||
}
|
||||
|
||||
}
|
||||
void FMCalendarFrame::refreshMonth()
|
||||
{
|
||||
mYearLabel->setText(QString::number(mCalendar->date.year()) + FM_WSTR(L"年 / ") + QString::number(mCalendar->date.month()) + FM_WSTR(L"月"));
|
||||
}
|
||||
|
||||
|
||||
FMCalendar::FMCalendar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
date = QDateTime::currentDateTime().date();// .setDate(2023,11,1);
|
||||
mPressed = false;
|
||||
mHoverDay = -1;
|
||||
mSelectedDay = -1;
|
||||
// 이벤트 등록해야 포커스 아닌 상태에서도 동작 가능
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
}
|
||||
/*
|
||||
void FMCalendar::selectDay(int day)
|
||||
{
|
||||
if(mExists.contains(day)) {
|
||||
mSelectedDay = day;
|
||||
updateDayItems();
|
||||
qInfo() << __FUNCTION__;
|
||||
emit dateSelected(&mDayItems,NULL);
|
||||
}
|
||||
}
|
||||
*/
|
||||
void FMCalendar::reset()
|
||||
{
|
||||
mPressed = false;
|
||||
mHoverDay = -1;
|
||||
mSelectedDay = -1;
|
||||
mMonthItems.clear();
|
||||
mDayItems.clear();
|
||||
mExists.clear();
|
||||
}
|
||||
int FMCalendar::getDay(QPoint xy)
|
||||
{
|
||||
QDate d = QDate(date.year(),date.month(),1);
|
||||
|
||||
// 월별 일수
|
||||
int days = d.daysInMonth();
|
||||
|
||||
// 요일 일=0,월=1, 화=2, 수=3
|
||||
int dayOfWeek = d.dayOfWeek() % 7;
|
||||
|
||||
const int colCount = 7;
|
||||
|
||||
int rowCount = ceil(((double)(days + dayOfWeek) / (double)colCount)) + 1; // week of days
|
||||
//int rowCount = ceil(((double)(days + dw) / (double)colCount)) + 1; // week of days
|
||||
|
||||
//QRect r = rect();
|
||||
|
||||
const int cw = size().width() / colCount;
|
||||
const int rh = size().height() / rowCount;
|
||||
|
||||
int currentDay = 1;
|
||||
for(int r=1;r<rowCount;r++) {
|
||||
for(int c=0;c<colCount;c++) {
|
||||
// 매월 1일의 시작 요일이 현재 요일보다 작을 경우(=이전달) 또는 다음달일 경우
|
||||
if((r==1 && c < dayOfWeek) || currentDay > days) {
|
||||
//qInfo() << "c < dayOfWeek:" << (c < dayOfWeek) << "c:" << c << "dayOfWeek:" << dayOfWeek << __FUNCTION__;
|
||||
continue;
|
||||
}
|
||||
// int left, int top, int width, int height
|
||||
QRect cr = QRect(c*cw,r*rh,cw,rh);
|
||||
if(cr.contains(xy)) {
|
||||
return currentDay;
|
||||
}
|
||||
|
||||
currentDay++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
bool FMCalendar::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == this && event->type() == QEvent::MouseMove && !mPressed)
|
||||
{
|
||||
QMouseEvent* me = static_cast<QMouseEvent *>(event);
|
||||
// 날짜가 변경된 경우에만 업데이트
|
||||
int d = getDay(me->pos());
|
||||
if(d != mHoverDay) {
|
||||
mHoverDay = d;
|
||||
update();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void FMCalendar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mExists.contains(mHoverDay) && event->button() == Qt::LeftButton) {
|
||||
mPressed = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
void FMCalendar::updateDayItems()
|
||||
{
|
||||
mDayItems.clear();
|
||||
for(int i=0;i<mMonthItems.size();i++) {
|
||||
QDate d = mMonthItems.at(i)->startTime().date();
|
||||
if(d.day() == mSelectedDay) {
|
||||
mDayItems.append(mMonthItems.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMCalendar::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mPressed && event->button() == Qt::LeftButton) {
|
||||
mPressed = false;
|
||||
if(mHoverDay > 0) {
|
||||
|
||||
mSelectedDay = mHoverDay;
|
||||
updateDayItems();
|
||||
static QDateTime tt = mDayItems.first()->startTime();
|
||||
// 달력에서 업데이트 되었으니 리스트 업데이트
|
||||
emit dateSelected(&mDayItems,&tt,true);
|
||||
|
||||
// 선택된 날짜의 파일로 이동
|
||||
// X
|
||||
// if(!mDayItems.isEmpty()) {
|
||||
// emit listMove(mDayItems.first());
|
||||
// }
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
void FMCalendar::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
//QDate d = QDate(mYear,mMonth,1);
|
||||
|
||||
// 월별 일수 (지정된 날짜의 1일로 확인)
|
||||
QDate d = QDate(date.year(),date.month(),1);
|
||||
int days = d.daysInMonth();
|
||||
|
||||
// 요일 일=0,월=1, 화=2, 수=3, 일=7??
|
||||
int dw = d.dayOfWeek() % 7;
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
const int colCount = 7;
|
||||
// 1일의 시작요일을 더해서 ROW 계산 필요
|
||||
int rowCount = ceil(((double)(days + dw) / (double)colCount)) + 1; // week of days
|
||||
|
||||
//qInfo() << days << colCount << "rowCount" << rowCount << __FUNCTION__;
|
||||
|
||||
QRect r = this->rect();
|
||||
r.adjust(0,0,-1,-1);
|
||||
painter.fillRect(r,QColor(0x33,0x33,0x33));
|
||||
|
||||
int cw = size().width() / colCount;
|
||||
int rh = size().height() / rowCount;
|
||||
|
||||
QString wd = FM_WSTR(L"日月火水木金土");
|
||||
|
||||
// 일~토 레이블 출력
|
||||
painter.setPen(QPen(QColor(0xFF,0xFF,0xFF),1, Qt::SolidLine));
|
||||
for(int c=0;c<colCount;c++) {
|
||||
QRect cr = QRect(c*cw,0,cw,rh);
|
||||
//painter.drawRect(cr);
|
||||
painter.drawText(cr,wd.at(c),QTextOption(Qt::AlignCenter));
|
||||
wd.at(c);
|
||||
}
|
||||
|
||||
QFont font = QFont("Fixedsys");
|
||||
font.setPixelSize(12);
|
||||
painter.setFont(font);
|
||||
|
||||
int currentDay = 1;
|
||||
for(int r=1;r<rowCount;r++) {
|
||||
for(int c=0;c<colCount;c++) {
|
||||
|
||||
// DAY OF WEEK 2023/12/31 일 DW:7(일)
|
||||
if((r==1 && c < dw) || currentDay > days) {
|
||||
//qInfo() << "SKIP r:" << r << "rowCount:" << rowCount << "dw:" << dw << "c:" << c << __FUNCTION__;
|
||||
continue;
|
||||
}
|
||||
|
||||
// int left, int top, int width, int height
|
||||
QRect cr = QRect(c*cw,r*rh,cw,rh);
|
||||
cr.adjust(1,1,-1,-1);
|
||||
|
||||
// 영상이 존재하는 날자일 경우
|
||||
if(mExists.contains(currentDay))
|
||||
{
|
||||
painter.fillRect(cr,QColor(FM_SILDER_COLOR));
|
||||
if (currentDay == mSelectedDay) {
|
||||
QRect cc = cr;
|
||||
cc.adjust(4,4,-4,-4);
|
||||
QPen p = QPen(QColor(FM_SELECTED_COLOR),5, Qt::SolidLine);
|
||||
p.setJoinStyle(Qt::MiterJoin);
|
||||
painter.setPen(p);
|
||||
painter.drawRect(cc);
|
||||
}
|
||||
else if(currentDay == mHoverDay) {
|
||||
QRect cc = cr;
|
||||
cc.adjust(4,4,-4,-4);
|
||||
QPen p = QPen(QColor(FM_HOVER_COLOR),5, Qt::SolidLine);
|
||||
p.setJoinStyle(Qt::MiterJoin);
|
||||
painter.setPen(p);
|
||||
painter.drawRect(cc);
|
||||
}
|
||||
}
|
||||
painter.setPen(QPen(QColor(0x44,0x44,0x44),1, Qt::SolidLine));
|
||||
// setJoinStyle(Qt::MiterJoin);
|
||||
painter.drawRect(cr);
|
||||
|
||||
// 일요일은 붉은색
|
||||
painter.setPen(QPen(c == 0 ? QColor(0xDD,0x00,0x00) : QColor(0xDD,0xDD,0xDD),1, Qt::SolidLine));
|
||||
|
||||
painter.drawText(cr,QString::number(currentDay),QTextOption(Qt::AlignCenter));
|
||||
currentDay++;
|
||||
}
|
||||
}
|
||||
|
||||
painter.setPen(QPen(QColor(0x88,0x88,0x88),1, Qt::SolidLine));
|
||||
painter.drawRect(r);
|
||||
}
|
||||
#endif // #if (USE_DATE_TIME_LIST)
|
||||
101
project/fm_viewer/ui/fm_calendar.h
Normal file
101
project/fm_viewer/ui/fm_calendar.h
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
#ifndef FM_CALENDAR_H
|
||||
#define FM_CALENDAR_H
|
||||
#if (USE_DATE_TIME_LIST)
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDate>
|
||||
#include <QSet>
|
||||
#include "../fm_event_types.h"
|
||||
class FMCalendar;
|
||||
class QVBoxLayout;
|
||||
class QLabel;
|
||||
class FMButton;
|
||||
class RMVideoItem;
|
||||
class FMCalendarFrame : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMCalendarFrame(QWidget *parent = nullptr);
|
||||
FMCalendar* mCalendar;
|
||||
QVBoxLayout* mLayout;
|
||||
QLabel* mYearLabel;
|
||||
|
||||
//! \brief 년/월 변경
|
||||
void refreshMonth();
|
||||
private:
|
||||
FMButton* next;
|
||||
FMButton* before;
|
||||
QDateTime playTime;
|
||||
bool bLoadStarted; //!< 업데이트 강제 달력 갱신하기 위해 사용
|
||||
|
||||
public slots:
|
||||
void onChangeMonth();
|
||||
//! \brief 로딩시 강제로 달력을 업데이트 하기위해 사용
|
||||
void onListUpdateStarted(bool bLoading);
|
||||
//void onListUpdateEnd(bool bLoading,RMVideoItem* selected);
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
};
|
||||
|
||||
|
||||
class FMCalendar : public QWidget
|
||||
{
|
||||
friend class FMCalendarFrame;
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMCalendar(QWidget *parent = nullptr);
|
||||
|
||||
QDate date;
|
||||
|
||||
QList<RMVideoItem*> mMonthItems; ///!< 월별 아이템 리스트
|
||||
QList<RMVideoItem*> mDayItems; ///!< 일별 아이템 리스트
|
||||
|
||||
bool mPressed; ///!< 마우스 눌린 상태
|
||||
int mHoverDay; ///!< 마우스 위 날짜
|
||||
int mSelectedDay; ///!< 선택된 날짜 (리스트에 표시되는)
|
||||
QSet<int> mExists; ///!< 영상 존재하는 날짜
|
||||
|
||||
//! \brief 초기화
|
||||
void reset();
|
||||
private:
|
||||
//! \brief 영역 지점에서 날짜 확인
|
||||
//! \param xy: 좌표
|
||||
//! \return 날짜, 없을 경우 -1
|
||||
int getDay(QPoint xy);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//! \brief 날짜선택
|
||||
//! \param day: 선택할 날짜(데이터가 존재하는 날짜만 지정가능)
|
||||
//void selectDay(int day);
|
||||
|
||||
//! \brief 현재 선택된 날짜 리스트 업데이트
|
||||
void updateDayItems();
|
||||
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
//void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
signals:
|
||||
//! \brief 날짜 변경됨
|
||||
//! \param dayItems: 변경된 날짜 데이터
|
||||
//! \param playTime: 달력에서 변경 또는 loop 방지를 위해 사용
|
||||
// //! \param bSelectFirst: 강제로 최초 시/분을 선택하도록 지정
|
||||
void dateSelected(QList<RMVideoItem*>* dayItems, QDateTime* playTime,bool moveList);
|
||||
|
||||
//! \brief 해당 월에 날짜가 없을 경우 시간,분 그래프 초기화
|
||||
void clearDate();
|
||||
|
||||
// //! \brief 날짜 선택시 리스트 이동
|
||||
// //! \param selected
|
||||
// void listMove(RMVideoItem* selected);
|
||||
|
||||
void playTime(QDateTime*,bool listMove);
|
||||
};
|
||||
|
||||
#endif // #if (USE_DATE_TIME_LIST)
|
||||
|
||||
#endif // FM_CALENDAR_H
|
||||
101
project/fm_viewer/ui/fm_colors.h
Normal file
101
project/fm_viewer/ui/fm_colors.h
Normal file
@@ -0,0 +1,101 @@
|
||||
#ifndef FM_COLORS_H
|
||||
#define FM_COLORS_H
|
||||
|
||||
#if (RM_MODEL == 1 || RM_MODEL == 3)
|
||||
#define FM_SILDER_COLOR 0xcc9933
|
||||
#define FM_SELECTED_TEXT_COLOR 0xc59433
|
||||
#define FM_SENSOR_COLOR_X 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Y 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
|
||||
#elif (RM_MODEL == 8)
|
||||
#define FM_SILDER_COLOR 0x3366CC
|
||||
#define FM_SELECTED_TEXT_COLOR 0x6699FF
|
||||
#define FM_SENSOR_COLOR_X 0x00FF00 // GREEN (DEVICE Y)
|
||||
#define FM_SENSOR_COLOR_Y 0xFFFF00 // YELLOW (DEVICE Z)
|
||||
#define FM_SENSOR_COLOR_Z 0xFF0000 // RED (DEVICE X)
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
|
||||
#elif (RM_MODEL == 4 || RM_MODEL == 6 || RM_MODEL == 7 || RM_MODEL == 14 || RM_MODEL == 16)
|
||||
|
||||
#define FM_SILDER_COLOR 0xcc9933
|
||||
#define FM_SELECTED_TEXT_COLOR 0xc59433
|
||||
#if (RM_MODEL == 16)
|
||||
#define FM_SENSOR_COLOR_X 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Y 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
|
||||
#else // RM_MODEL
|
||||
#define FM_SENSOR_COLOR_X 0x00FF00 // GREEN (DEVICE Y)
|
||||
#define FM_SENSOR_COLOR_Y 0xFFFF00 // YELLOW (DEVICE Z)
|
||||
#define FM_SENSOR_COLOR_Z 0xFF0000 // RED (DEVICE X)
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
|
||||
#endif // RM_MODEL
|
||||
#elif (RM_MODEL == 2 || RM_MODEL == 5) // WATEX, TBD360, AN6000
|
||||
#define FM_SILDER_COLOR 0x3366CC
|
||||
#define FM_SELECTED_TEXT_COLOR 0x6699FF
|
||||
|
||||
#if (RM_MODEL == 2 || RM_MODEL == 15)
|
||||
#define FM_SENSOR_COLOR_X 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Y 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#else
|
||||
#define FM_SENSOR_COLOR_X 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Y 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
|
||||
#endif
|
||||
#elif (RM_MODEL == 15)
|
||||
#define FM_SILDER_COLOR 0x049B64
|
||||
#define FM_SELECTED_TEXT_COLOR 0x81CDB1
|
||||
#define FM_SELECTED_COLOR 0x06E694
|
||||
#define FM_HOVER_COLOR 0x05b474
|
||||
#define FM_DISABLED_COLOR 0x5A5A5A
|
||||
#define FM_DISABLED_COLOR2 0x8A8A8A
|
||||
|
||||
#define FM_SENSOR_COLOR_X 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Y 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#define FM_GRAPH_BACK_COLOR 0x595959
|
||||
#define FM_GRAPH_LINE_COLOR 0x737373
|
||||
#elif (RM_MODEL_EMT_KR)
|
||||
|
||||
#define FM_THEME_COLOR_M1 0x3D3D3D
|
||||
#define FM_THEME_COLOR_M2 0x323232
|
||||
#define FM_THEME_COLOR_M3 0x212121
|
||||
#define FM_THEME_COLOR_T1 0xB1B1B1
|
||||
#define FM_TEHEM_COLOR_P1 0x4085FF
|
||||
|
||||
#define FM_SILDER_COLOR 0xCCCCCC
|
||||
#define FM_SELECTED_TEXT_COLOR 0x76A5F5
|
||||
#define FM_SELECTED_COLOR 0x06E694
|
||||
#define FM_HOVER_COLOR 0x05b474
|
||||
#define FM_DISABLED_COLOR 0x5A5A5A
|
||||
#define FM_DISABLED_COLOR2 0x8A8A8A
|
||||
#define FM_GRAPH_BACK_COLOR 0x282828
|
||||
#define FM_GRAPH_LINE_COLOR 0x333333
|
||||
|
||||
#define FM_SENSOR_COLOR_X 0xc6f607
|
||||
#define FM_SENSOR_COLOR_Y 0x33c6f4
|
||||
#define FM_SENSOR_COLOR_Z 0xff3333
|
||||
#endif // MODELS
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
#define FM_SPEED_LABEL_BACK_COLOR 0x666666
|
||||
#else // RM_MODEL_EMT_KR
|
||||
#define FM_SPEED_LABEL_BACK_COLOR 0x262626
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
#define FM_QCOLOR(__COLOR__) QColor(QString().sprintf("#%06X",__COLOR__))
|
||||
|
||||
|
||||
#endif // FM_COLORS_H
|
||||
303
project/fm_viewer/ui/fm_datepicker.cpp
Normal file
303
project/fm_viewer/ui/fm_datepicker.cpp
Normal file
@@ -0,0 +1,303 @@
|
||||
#include "fm_datepicker.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../data/rm_video_list_loader.h"
|
||||
#include <QDir>
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
FMDatePicker::FMDatePicker(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
//FMWidgetBorder(this,"border_frame",0x666666);
|
||||
|
||||
setFixedHeight(40);
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
#if (MODEL_WATEX)
|
||||
layout->setMargin(0);
|
||||
#else
|
||||
layout->setMargin(1);
|
||||
#endif
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
|
||||
//FMWidgetBorder(this,"main_video_frame",0x666666);
|
||||
QFont font("Monospace");
|
||||
font.setPixelSize(12);
|
||||
|
||||
QWidget* p = new QWidget(this);
|
||||
p->setStyleSheet("background-color: #616161;");
|
||||
p->setFixedHeight(30);
|
||||
p->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
layout->addWidget(p);
|
||||
|
||||
QHBoxLayout* yml = new QHBoxLayout(p);
|
||||
yml->setMargin(2);
|
||||
yml->setSpacing(2);
|
||||
|
||||
QLabel* label = new QLabel(p);
|
||||
label->setText(FM_WSTR(L"년"));
|
||||
label->setFont(font);
|
||||
label->setStyleSheet("color : #F0F0F0;");
|
||||
label->setFixedWidth(20);
|
||||
|
||||
_yearListCombo = new QComboBox(p);
|
||||
_yearListCombo->setStyleSheet("font-family: Fixedsys;color : #DDDDDD;");
|
||||
_yearListCombo->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_yearListCombo->setMaxVisibleItems(100);
|
||||
connect(_yearListCombo,SIGNAL(currentIndexChanged(int)),SLOT(onYearSelected(int)));
|
||||
yml->addWidget(_yearListCombo);
|
||||
yml->addWidget(label);
|
||||
_yearListCombo->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
|
||||
label = new QLabel(p);
|
||||
label->setFont(font);
|
||||
label->setText(FM_WSTR(L"월"));
|
||||
label->setStyleSheet("color : #F0F0F0;");
|
||||
label->setFixedWidth(20);
|
||||
|
||||
_monthListCombo = new QComboBox(p);
|
||||
_monthListCombo->setStyleSheet("font-family: Fixedsys;color : #DDDDDD;");
|
||||
_monthListCombo->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_monthListCombo->setMaxVisibleItems(100);
|
||||
_monthListCombo->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
connect(_monthListCombo,SIGNAL(currentIndexChanged(int)),SLOT(onMonthSelected(int)));
|
||||
yml->addWidget(_monthListCombo);
|
||||
yml->addWidget(label);
|
||||
|
||||
//#
|
||||
label = new QLabel(p);
|
||||
label->setText(FM_WSTR(L"일"));
|
||||
label->setFont(font);
|
||||
label->setStyleSheet("color : #F0F0F0;");
|
||||
label->setFixedWidth(20);
|
||||
|
||||
_dayListCombo = new QComboBox(p);
|
||||
_dayListCombo->setStyleSheet("font-family: Fixedsys;color : #DDDDDD;");
|
||||
_dayListCombo->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_dayListCombo->setMaxVisibleItems(100);
|
||||
_dayListCombo->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
connect(_dayListCombo,SIGNAL(currentIndexChanged(int)),SLOT(onDaySelected(int)));
|
||||
yml->addWidget(_dayListCombo);
|
||||
yml->addWidget(label);
|
||||
|
||||
}
|
||||
QString FMDatePicker::_videoFolder(bool bPhoto)
|
||||
{
|
||||
QString root = RMApp::currentRoot;
|
||||
if(root.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 영상폴더
|
||||
return root + QDir::separator() + (bPhoto ? "Photo" : "Video");
|
||||
}
|
||||
|
||||
void FMDatePicker::refreshYears()
|
||||
{
|
||||
// C:\stroage\testing\TELEBIT\TB4000_S01\20230904_TB4000_SAMPLE_SD\20230904_TB4000_SAMPLE_SD
|
||||
QString folder = _videoFolder();
|
||||
if(folder.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QString selected = _yearListCombo->currentText();
|
||||
_yearListCombo->clear();
|
||||
QDir directory(folder);
|
||||
// 2023_07, 2023_08
|
||||
|
||||
QStringList years = directory.entryList(QStringList() << "*",QDir::Dirs|QDir::NoDotAndDotDot|QDir::System|QDir::Hidden,QDir::Name);
|
||||
_yearListCombo->blockSignals(true);
|
||||
QSet<QString> yms;
|
||||
|
||||
foreach(QString year_month, years) {
|
||||
|
||||
QStringList ym = year_month.split("_");
|
||||
if (ym.size() != 2) {
|
||||
continue;
|
||||
}
|
||||
if (!yms.contains(ym.at(0))) {
|
||||
yms.insert(ym.at(0));
|
||||
_yearListCombo->addItem(ym.at(0));
|
||||
}
|
||||
}
|
||||
_yearListCombo->blockSignals(false);
|
||||
|
||||
//QString last = selected;
|
||||
if(!selected.isEmpty()) {
|
||||
_yearListCombo->setCurrentText(selected);
|
||||
} else if(_yearListCombo->count() > 0) {
|
||||
|
||||
// 가장 최근의 날짜로 변경
|
||||
// 1개월만 존재할 경우 이벤트 발생하지 않음
|
||||
_yearListCombo->setCurrentIndex(_yearListCombo->count()-1);
|
||||
if(_yearListCombo->count() == 1) {
|
||||
onYearSelected(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMDatePicker::refreshMonths()
|
||||
{
|
||||
QString folder = _videoFolder();
|
||||
if(folder.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString year = _yearListCombo->currentText();
|
||||
if(year.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString selected = _monthListCombo->currentText();
|
||||
_monthListCombo->clear();
|
||||
|
||||
QDir directory(folder);
|
||||
QStringList months = directory.entryList(QStringList() << "*",QDir::Dirs|QDir::NoDotAndDotDot|QDir::System|QDir::Hidden,QDir::Name);
|
||||
|
||||
_monthListCombo->blockSignals(true);
|
||||
QSet<QString> yms;
|
||||
foreach(QString year_month, months) {
|
||||
|
||||
if(!year_month.startsWith(year)) {
|
||||
continue;
|
||||
}
|
||||
QStringList ym = year_month.split("_");
|
||||
if (ym.size() != 2) {
|
||||
continue;
|
||||
}
|
||||
if (!yms.contains(ym.at(1))) {
|
||||
yms.insert(ym.at(1));
|
||||
_monthListCombo->addItem(ym.at(1));
|
||||
}
|
||||
}
|
||||
_monthListCombo->blockSignals(false);
|
||||
|
||||
QString last = selected;
|
||||
if(!selected.isEmpty()) {
|
||||
_monthListCombo->setCurrentText(selected);
|
||||
} else if (_monthListCombo->count() > 0) {
|
||||
_monthListCombo->setCurrentIndex(_monthListCombo->count()-1);
|
||||
|
||||
// 1개 개월만 존재할 경우 이벤트 발생하지 않아 강제 실행
|
||||
if(_monthListCombo->count() == 1) {
|
||||
onMonthSelected(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMDatePicker::refreshDays()
|
||||
{
|
||||
QString base = _videoFolder();
|
||||
if(base.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString year = _yearListCombo->currentText();
|
||||
if(year.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString month = _monthListCombo->currentText();
|
||||
if(month.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_dayListCombo->clear();
|
||||
|
||||
QString folder = base + QDir::separator() + year + "_" + month;
|
||||
if(!QDir(folder).exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDir directory(folder);
|
||||
QStringList days = directory.entryList(QStringList() << "*",QDir::Dirs|QDir::NoDotAndDotDot|QDir::System|QDir::Hidden,QDir::Name);
|
||||
_dayListCombo->blockSignals(true);
|
||||
foreach(QString day, days) {
|
||||
_dayListCombo->addItem(day);
|
||||
}
|
||||
_dayListCombo->blockSignals(false);
|
||||
if(days.size() > 0) {
|
||||
onDaySelected(0);
|
||||
}
|
||||
}
|
||||
QString FMDatePicker::_videoDayFolder(bool bPhoto)
|
||||
{
|
||||
QString base = _videoFolder(bPhoto);
|
||||
if(base.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
QString year = _yearListCombo->currentText();
|
||||
QString month = _monthListCombo->currentText();
|
||||
QString day = _dayListCombo->currentText();
|
||||
if(year.isEmpty() || month.isEmpty() || day.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return QDir::cleanPath(base + QDir::separator() + year + "_" + month + QDir::separator() + day);
|
||||
}
|
||||
|
||||
void FMDatePicker::onDaySelected(int index)
|
||||
{
|
||||
QString folder = _videoDayFolder();
|
||||
if(folder.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 기타 폴더 가능, 전후방 동일 폴더 가능
|
||||
QList<QUrl> list;
|
||||
RMVideoFileList::appendFolderToList(folder,list);
|
||||
|
||||
RMVideoFileListLoader* loader = NULL;
|
||||
loader = new RMVideoFileListLoader(list);
|
||||
QThreadPool::globalInstance()->start(loader,5);
|
||||
}
|
||||
void FMDatePicker::onMonthSelected(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
|
||||
QString base = _videoFolder();
|
||||
if(base.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString year = _yearListCombo->currentText();
|
||||
if(year.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString month = _monthListCombo->currentText();
|
||||
if(month.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString folder = base + QDir::separator() + year + "_" + month;
|
||||
if(!QDir(folder).exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//qInfo() << _monthListCombo->currentText() << __FUNCTION__;
|
||||
|
||||
// 월 선택시 파일 항목 읽어서 '일'항목 생성해야함
|
||||
refreshDays();
|
||||
}
|
||||
void FMDatePicker::onYearSelected(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
_monthListCombo->clear();
|
||||
refreshMonths();
|
||||
}
|
||||
void FMDatePicker::onAppEvent(RMApp::Event event, int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(event == RMApp::ROOT_FOLDER_OPEN) {
|
||||
qInfo() << event << RMApp::currentRoot << __FUNCTION__;
|
||||
refreshYears();
|
||||
} else if(event == RMApp::NO_ROOT_FOLDER_OPEN) {
|
||||
_yearListCombo->clear();
|
||||
_monthListCombo->clear();
|
||||
_dayListCombo->clear();
|
||||
}
|
||||
//Q_UNUSED(param);
|
||||
//Q_UNUSED(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
40
project/fm_viewer/ui/fm_datepicker.h
Normal file
40
project/fm_viewer/ui/fm_datepicker.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef FM_DATEPICKER_H
|
||||
#define FM_DATEPICKER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QComboBox>
|
||||
#include "../rm_include.h"
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
#include "rm_widget_base.h"
|
||||
|
||||
class FMDatePicker : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
|
||||
explicit FMDatePicker(QWidget *parent = nullptr);
|
||||
|
||||
QString _videoFolder(bool bPhoto = false);
|
||||
QString _videoDayFolder(bool bPhoto = false);
|
||||
|
||||
QVBoxLayout* layout;
|
||||
QComboBox* _yearListCombo;
|
||||
QComboBox* _monthListCombo;
|
||||
QComboBox* _dayListCombo;
|
||||
void refreshYears();
|
||||
void refreshMonths();
|
||||
void refreshDays();
|
||||
|
||||
|
||||
public slots:
|
||||
void onDaySelected(int index);
|
||||
void onMonthSelected(int index);
|
||||
void onYearSelected(int index);
|
||||
void onAppEvent(RMApp::Event event, int param) override;
|
||||
signals:
|
||||
//void folderSelected(QString folder);
|
||||
};
|
||||
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
#endif // FM_DATEPICKER_H
|
||||
643
project/fm_viewer/ui/fm_daytime.cpp
Normal file
643
project/fm_viewer/ui/fm_daytime.cpp
Normal file
@@ -0,0 +1,643 @@
|
||||
|
||||
#include "fm_daytime.h"
|
||||
#if (USE_DATE_TIME_LIST)
|
||||
#include <QVBoxLayout>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
#include "../rm_include.h"
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../core/rm_math.h"
|
||||
#include "fm_colors.h"
|
||||
#include "../data/an6000_decode.h"
|
||||
#include "../core/rm_player.h"
|
||||
|
||||
FMTimeBarMinute::FMTimeBarMinute(QWidget *parent) : FMTimeBar(0,60,1,5,parent)
|
||||
{
|
||||
}
|
||||
void FMTimeBarMinute::reset()
|
||||
{
|
||||
FMTimeBar::reset();
|
||||
mFiles.clear();
|
||||
mAreas.clear();
|
||||
|
||||
mStartBackup = -1;
|
||||
mEndBackup = -1;
|
||||
backups.clear();
|
||||
}
|
||||
|
||||
int FMTimeBarMinute::findAreaFromTime(QDateTime* time)
|
||||
{
|
||||
for(int i=0;i<mAreas.size();i++) {
|
||||
if(mAreas.at(i).second->startTime() == *time) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FMTimeBarMinute::getTime(QPoint xy)
|
||||
{
|
||||
for(int i=0;i<mAreas.size();i++) {
|
||||
if(mAreas.at(i).first.contains(xy)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void FMTimeBarMinute::createAreaBox()
|
||||
{
|
||||
mAreas.clear();
|
||||
const int w = size().width();
|
||||
const int h = size().height();
|
||||
const int barHeight = h / 2;
|
||||
const int yo = ((h - barHeight) / 2) -4; // const int ymargin = -4;
|
||||
const double aw = w - (mMarginLR * 2);
|
||||
|
||||
int lastX = -1;
|
||||
for(int i=0;i<mFiles.size();i++) {
|
||||
//qInfo() << mFiles.at(i).second->title() << mFiles.at(i).second->durationInMSecs() / 1000 << __FUNCTION__;
|
||||
QSize s = mFiles.at(i).first;
|
||||
int sx = (int)((((double)s.width()) / 3600.0) * aw);
|
||||
sx = qMax(lastX,sx); // 이전 영역과 겹치지 않도록..
|
||||
|
||||
int ex = (int)((((double)s.height()) / 3600.0) * aw);
|
||||
|
||||
// 영역 초과하지 않도록 수정
|
||||
ex = qMax(qMin(ex,w-(mMarginLR*2)),sx+5);
|
||||
|
||||
lastX = ex;
|
||||
//qInfo() << ex << w-mMarginLR << __FUNCTION__;
|
||||
|
||||
QRect r = QRect(mMarginLR+sx,yo,ex-sx,barHeight);
|
||||
//r.adjust(1,1,-1,-1);
|
||||
mAreas.append(QPair<QRect,RMVideoItem*>(r,mFiles.at(i).second));
|
||||
}
|
||||
mFiles.clear(); // 필요없으니 제거
|
||||
}
|
||||
void FMTimeBarMinute::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mHoverTime >= 0) {
|
||||
if(event->button() == Qt::LeftButton) {
|
||||
mPressed = true;
|
||||
mMenu = false;
|
||||
update();
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
mMenu = true;
|
||||
mPressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMTimeBarMinute::showMenu(QPoint pos)
|
||||
{
|
||||
QMenu contextMenu("", this);
|
||||
|
||||
QAction* aStart = new QAction(FM_WSTR(L"バックアップ開始時間"), this);
|
||||
QPair<bool,int>ds = QPair<bool,int>(true,mHoverTime);
|
||||
aStart->setData(QVariant::fromValue(ds));
|
||||
connect(aStart, SIGNAL(triggered()), this, SLOT(onSetBackup()));
|
||||
contextMenu.addAction(aStart);
|
||||
if(mStartBackup > -1) {
|
||||
aStart->setEnabled(false);
|
||||
}
|
||||
|
||||
QAction* aEnd = new QAction(FM_WSTR(L"バックアップ終了時間"), this);
|
||||
QPair<bool,int>de = QPair<bool,int>(false,mHoverTime);
|
||||
aEnd->setData(QVariant::fromValue(de));
|
||||
connect(aEnd, SIGNAL(triggered()), this, SLOT(onSetBackup()));
|
||||
contextMenu.addAction(aEnd);
|
||||
if(mEndBackup > -1) {
|
||||
aEnd->setEnabled(false);
|
||||
}
|
||||
|
||||
if(mStartBackup > -1 || mEndBackup > -1) {
|
||||
// リセット)の方法を教えてください。
|
||||
QAction* aCancel = new QAction(FM_WSTR(L"リセット"), this);
|
||||
//QPair<bool,int>de = QPair<bool,int>(false,mHoverTime);
|
||||
//aCancel->setData(QVariant::fromValue(de));
|
||||
connect(aCancel, SIGNAL(triggered()), this, SLOT(onSetBackup()));
|
||||
contextMenu.addAction(aCancel);
|
||||
}
|
||||
|
||||
contextMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
void FMTimeBarMinute::onSetBackup()
|
||||
{
|
||||
QAction* a = qobject_cast<QAction*>(sender());
|
||||
if(a != NULL) {
|
||||
QString typeName = QString(a->data().typeName());
|
||||
if( typeName == "QPair<bool,int>") {
|
||||
QPair<bool,int> param = a->data().value<QPair<bool,int>>();
|
||||
|
||||
if (param.first) { // start
|
||||
mStartBackup = param.second;
|
||||
} else { // end
|
||||
mEndBackup = param.second;
|
||||
}
|
||||
|
||||
// 추가
|
||||
if(mStartBackup > -1 && mStartBackup < mAreas.size() && mEndBackup > -1 && mEndBackup < mAreas.size()) {
|
||||
backups.clear();
|
||||
for(int i=mStartBackup;i<=mEndBackup;i++) {
|
||||
backups.append(mAreas.at(i).second);
|
||||
}
|
||||
emit backupSelected(backups);
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
} else {
|
||||
mStartBackup = -1;
|
||||
mEndBackup = -1;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FMTimeBarMinute::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mMenu && event->button() == Qt::RightButton) {
|
||||
mPressed = false;
|
||||
if(mHoverTime >= 0) {
|
||||
showMenu(event->pos());
|
||||
}
|
||||
return;
|
||||
}
|
||||
FMTimeBar::mouseReleaseEvent(event);
|
||||
}
|
||||
void FMTimeBarMinute::paintEvent(QPaintEvent * pe)
|
||||
{
|
||||
Q_UNUSED(pe)
|
||||
|
||||
static QPixmap dc = QPixmap(":/image/down_check.png");
|
||||
|
||||
QPainter painter(this);
|
||||
drawGrid(painter);
|
||||
for(int i=0;i<mAreas.size();i++) {
|
||||
QRect r = mAreas.at(i).first;
|
||||
if(i == mSelectedTime) {
|
||||
painter.fillRect(r,QColor(bDisabled ? FM_DISABLED_COLOR2 : FM_SELECTED_COLOR));
|
||||
}
|
||||
else if (i == mHoverTime) {
|
||||
painter.fillRect(r,QColor(bDisabled ? FM_DISABLED_COLOR2 : FM_HOVER_COLOR));
|
||||
} else {
|
||||
painter.fillRect(r,QColor(bDisabled ? FM_DISABLED_COLOR : FM_SILDER_COLOR));
|
||||
}
|
||||
|
||||
painter.setPen(QPen(QColor(0xAA,0xAA,0xAA),1, Qt::SolidLine));
|
||||
painter.drawRect(r);
|
||||
|
||||
if(mStartBackup == i || mEndBackup == i) {
|
||||
QRect ar = QRectCenter(QSize(16,16),r);
|
||||
ar.moveTop(0);
|
||||
painter.drawPixmap(ar, dc); // this works
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
QRect out = rect();
|
||||
out.adjust(0,0,-1,mMax > 30 ? -1 : 0);
|
||||
painter.setPen(QPen(QColor(0x88,0x88,0x88),1, Qt::SolidLine));
|
||||
painter.drawRect(out);
|
||||
}
|
||||
|
||||
|
||||
FMTimeBar::FMTimeBar(int min, int max, int unit, int labelUnit, QWidget *parent)
|
||||
: mMin(min), mMax(max), mUnit(unit),mLabelUnit(labelUnit), QWidget(parent)
|
||||
{
|
||||
bDisabled = false;
|
||||
|
||||
mMarginLR = 12;
|
||||
|
||||
mPressed = false;
|
||||
mHoverTime = -1;
|
||||
mSelectedTime = -1;
|
||||
// 이벤트 등록해야 포커스 아닌 상태에서도 동작 가능
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
}
|
||||
|
||||
void FMTimeBar::reset()
|
||||
{
|
||||
mPressed = false;
|
||||
mHoverTime = -1;
|
||||
mSelectedTime = -1;
|
||||
mExists.clear();
|
||||
}
|
||||
|
||||
void FMTimeBar::showEvent(QShowEvent* e)
|
||||
{
|
||||
// margin 최적화
|
||||
int cw = (size().width() - (mMarginLR * 2)) / mMax;
|
||||
mMarginLR = (size().width() - cw * mMax) / 2;
|
||||
QWidget::showEvent(e);
|
||||
}
|
||||
bool FMTimeBar::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == this && event->type() == QEvent::MouseMove && !mPressed)
|
||||
{
|
||||
QMouseEvent* me = static_cast<QMouseEvent *>(event);
|
||||
// 날짜가 변경된 경우에만 업데이트
|
||||
int d = getTime(me->pos());
|
||||
if(d != mHoverTime) {
|
||||
mHoverTime = d;
|
||||
update();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
int FMTimeBar::getTime(QPoint xy)
|
||||
{
|
||||
QRect r = rect();
|
||||
if(xy.x() < mMarginLR || xy.x() > r.size().width() - mMarginLR)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const int barHeight = size().height() / 2;
|
||||
const int barWidth = (size().width() - (mMarginLR * 2)) / mMax;
|
||||
const int yo = (r.size().height() - barHeight) / 2;
|
||||
if (xy.y() < yo || xy.y() > size().height() - yo) {
|
||||
return -1;
|
||||
}
|
||||
return (xy.x() - mMarginLR) / barWidth;
|
||||
}
|
||||
void FMTimeBar::drawGrid(QPainter& p)
|
||||
{
|
||||
const int offset_x = mMarginLR;
|
||||
const int w = (size().width() - (offset_x * 2)) / mMax;
|
||||
const int h = size().height();
|
||||
const int barHeight = h / 2;
|
||||
const int y1 = (h - barHeight) / 2 - 4; // -4 = ymargin
|
||||
|
||||
p.setPen(QPen(QColor(0x66,0x66,0x66),1, Qt::SolidLine));
|
||||
|
||||
// 눈금만 그리기
|
||||
for(int c=0;c<mMax+1;c++) {
|
||||
const int x = c*w+mMarginLR;
|
||||
p.drawLine(x, y1, x, y1+barHeight);
|
||||
|
||||
}
|
||||
|
||||
// 레이블 유닛 단위로 레이블 표시
|
||||
QFont font = QFont("Arial");
|
||||
font.setPixelSize(10);
|
||||
p.setFont(font);
|
||||
p.setPen(QPen(QColor(0xAA,0xAA,0xAA),1, Qt::SolidLine));
|
||||
for(int c=0;c<mMax+1;c++) {
|
||||
if(c % mLabelUnit == 0) {
|
||||
QRect cr = QRect(c*w+mMarginLR,y1,w,barHeight);
|
||||
|
||||
const int tw = 50;
|
||||
QRect tr = QRect(cr.left()-tw/2,y1+barHeight,tw,12);
|
||||
p.drawText(tr,QString::number(c),QTextOption(Qt::AlignCenter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FMTimeBar::paintEvent(QPaintEvent *)
|
||||
{
|
||||
// 중간에 바가 존재하며 아래쪽에 3시간 단위로 레이블 추가
|
||||
QPainter painter(this);
|
||||
drawGrid(painter);
|
||||
|
||||
const int barHeight = size().height() / 2;
|
||||
const int offset_x = mMarginLR;
|
||||
const int cw = (size().width() - (offset_x * 2)) / mMax;
|
||||
const int ch = size().height();
|
||||
const int yo = (ch - barHeight) / 2;
|
||||
|
||||
const int ymargin = -4;
|
||||
// 0~24 마지막 레이블 표시를 위해
|
||||
for(int c=0;c<mMax+1;c++) {
|
||||
QRect cr = QRect(c*cw+offset_x,yo+ymargin,cw,barHeight);
|
||||
if(c < mMax) {
|
||||
|
||||
// 영상이 존재하는 시간 일 경우
|
||||
if(mExists.contains(c))
|
||||
{
|
||||
cr.adjust(1,1,0,0);
|
||||
if (c == mSelectedTime) {
|
||||
painter.fillRect(cr, QColor(bDisabled ? FM_DISABLED_COLOR : FM_SELECTED_COLOR));
|
||||
}
|
||||
else if(c == mHoverTime) {
|
||||
painter.fillRect(cr,QColor(bDisabled ? FM_DISABLED_COLOR : FM_HOVER_COLOR));
|
||||
} else {
|
||||
painter.fillRect(cr,QColor(FM_SILDER_COLOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QRect out = rect();
|
||||
out.adjust(0,0,-1,mMax > 30 ? -1 : 0);
|
||||
painter.setPen(QPen(QColor(0x88,0x88,0x88),1, Qt::SolidLine));
|
||||
painter.drawRect(out);
|
||||
}
|
||||
|
||||
void FMTimeBar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mExists.contains(mHoverTime) && event->button() == Qt::LeftButton) {
|
||||
mPressed = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
void FMTimeBar::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if(mPressed && event->button() == Qt::LeftButton) {
|
||||
mPressed = false;
|
||||
if(mHoverTime >= 0) {
|
||||
|
||||
mSelectedTime = mHoverTime;
|
||||
// 선택상태
|
||||
emit timeSelected(mSelectedTime,NULL,true);
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FMDayTime::FMDayTime(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
mHours = new FMTimeBar(0,24,1,3,this);
|
||||
mHours->setFixedHeight(55);
|
||||
layout->addWidget(mHours);
|
||||
mMinutes = new FMTimeBarMinute(this);
|
||||
mMinutes->setFixedHeight(55);
|
||||
layout->addWidget(mMinutes);
|
||||
setFixedHeight(110);
|
||||
|
||||
connect(mHours,SIGNAL(timeSelected(int,QDateTime*,bool)),this,SLOT(onHourSelected(int,QDateTime*,bool)));
|
||||
connect(mMinutes,SIGNAL(timeSelected(int,QDateTime*,bool)),this,SLOT(onMinuteSelected(int,QDateTime*,bool)));
|
||||
|
||||
connect(mMinutes,SIGNAL(backupSelected(QList<RMVideoItem*>&)),this,SLOT(onBackupSelected(QList<RMVideoItem*>&)));
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
}
|
||||
void FMDayTime::getHour(QSet<int>& hours)
|
||||
{
|
||||
hours.clear();
|
||||
for(int i=0;i<mDayList.size();i++) {
|
||||
hours.insert(mDayList.at(i)->startTime().time().hour());
|
||||
}
|
||||
}
|
||||
void FMDayTime::loadMinutes(QList<QPair<QSize,RMVideoItem*>>& files)
|
||||
{
|
||||
files.clear();
|
||||
// 2024/09/24 ...(1) 파일등을 처리하기 위해 동일한 '초' 의 가장 최초 파일만 추가
|
||||
QTime lastTime;
|
||||
for(int i=0;i<mDayList.size();i++) {
|
||||
RMVideoItem* item = mDayList.at(i);
|
||||
QTime t = item->startTime().time();
|
||||
t = QTime(t.hour(),t.minute(),t.second()); // msec 제거하고 비교하여 제거
|
||||
if(lastTime.isValid() && t == lastTime) {
|
||||
continue;
|
||||
}
|
||||
lastTime = t;
|
||||
if(t.hour() == mHours->mSelectedTime) {
|
||||
int s = t.minute() * 60 + t.second();
|
||||
int e = s + mDayList.at(i)->durationInMSecs() / 1000;
|
||||
files.append(QPair<QSize,RMVideoItem*>(QSize(s,e),item));
|
||||
}
|
||||
}
|
||||
mMinutes->createAreaBox();
|
||||
}
|
||||
//void FMDayTime::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
//{
|
||||
// if(event == PLAY_WILL_LOADED && item != NULL)
|
||||
// {
|
||||
// QDate pdate = item->startTime().date();
|
||||
// // 리스트 또는 다음파일 이동에서 재생되었는지
|
||||
// // '분' 항목에서 재생되었는지 확인 필요
|
||||
// QDate cdate = QDate(mCalendar->date.year(),mCalendar->date.month(),mCalendar->mSelectedDay);
|
||||
// if(cdate != pdate) {
|
||||
|
||||
// mCalendar->date.setDate(pdate.year(),pdate.month(),pdate.day());
|
||||
// mCalendar->mSelectedDay = pdate.day();
|
||||
// mCalendar->update(); // 다시 그리기
|
||||
|
||||
// // 년/월이 변경되었을 경우 달력을 다시 로딩
|
||||
// if(mCalendar->date.year() != pdate.year() || mCalendar->date.month() != pdate.month())
|
||||
// {
|
||||
// onChangeMonth(); // 달력 업데이트
|
||||
// }
|
||||
// mCalendar->updateDayItems(); // 날짜리스트 다시 로딩
|
||||
// emit mCalendar->dateSelected(&mCalendar->mDayItems,false);
|
||||
// //qInfo() << "DATE CHANGED:" << mCalendar->date << pdate << __FUNCTION__;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void FMDayTime::onPlayTime(QDateTime* playTime, bool moveList)
|
||||
{
|
||||
// 날짜는 변경되지 않고 시간만 변경되었을 경우 발생
|
||||
if(playTime != NULL && *playTime == mLastPlayTime) {
|
||||
//qInfo() << "LOOP SKIP!!!" << __FUNCTION__;
|
||||
return;
|
||||
}
|
||||
selectHour(playTime->time().hour(),playTime,moveList);
|
||||
mHours->update(); // 화면갱신해야함
|
||||
}
|
||||
void FMDayTime::onClearDate()
|
||||
{
|
||||
mDayList.clear();
|
||||
mMinutes->reset(); // 일단 초기화
|
||||
mHours->reset(); // "
|
||||
mHours->update();
|
||||
mMinutes->update();
|
||||
}
|
||||
void FMDayTime::onDateSelected(QList<RMVideoItem*>* dayItems,QDateTime* playTime, bool moveList)
|
||||
{
|
||||
// 현재시간과 동일할 경우 SKIP
|
||||
if(playTime != NULL && *playTime == mLastPlayTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 복사, 보관
|
||||
mDayList.clear();
|
||||
mDayList = *dayItems;
|
||||
mDayList.detach();
|
||||
|
||||
mMinutes->reset(); // 일단 초기화
|
||||
mHours->reset(); // "
|
||||
|
||||
// 시간 확인
|
||||
getHour(mHours->mExists);
|
||||
|
||||
// 최초 시간 선택 -> 분데이터 로딩, 캘린더 UI 선택시에만 최초시간 선택
|
||||
// playTime 이 존재할 경우 최초 시간 무시
|
||||
if(!mDayList.isEmpty()) {
|
||||
|
||||
// 루프방지 확인을 위한 날짜를 지정
|
||||
selectHour(mDayList.first()->startTime().time().hour(),playTime,moveList);
|
||||
}
|
||||
|
||||
mHours->update();
|
||||
//mMinutes->update();
|
||||
}
|
||||
void FMDayTime::selectHour(int hour,QDateTime* playTime,bool moveList)
|
||||
{
|
||||
if(mHours->mExists.contains(hour)){
|
||||
if(playTime == NULL) {
|
||||
mHours->mSelectedTime = hour;
|
||||
} else {
|
||||
mHours->mSelectedTime = playTime->time().hour();
|
||||
}
|
||||
onHourSelected(mHours->mSelectedTime,playTime,moveList);
|
||||
}
|
||||
}
|
||||
void FMDayTime::onHourSelected(int hour,QDateTime* playTime,bool moveList)
|
||||
{
|
||||
Q_UNUSED(hour)
|
||||
|
||||
// 선택된 분 처리하고
|
||||
mMinutes->reset();
|
||||
loadMinutes(mMinutes->mFiles);
|
||||
|
||||
if(playTime!= NULL) {
|
||||
// 분 AREA 확인
|
||||
mMinutes->mSelectedTime = mMinutes->findAreaFromTime(playTime);
|
||||
}
|
||||
|
||||
// 리스트 업데이트 해야함
|
||||
// 달력에서 선택된 경우에만 최초 시간으로 업데이트 + 리스트로 이벤트 전송
|
||||
// 시간등이 선택되었을 경우 해당 분의 파일로 이동
|
||||
if(moveList){ // playTime == NULL) {
|
||||
RMVideoItem* first = findFirstSelectedHourItem();
|
||||
if(first != NULL) {
|
||||
emit listMove(first);
|
||||
}
|
||||
}
|
||||
mMinutes->update();
|
||||
}
|
||||
RMVideoItem* FMDayTime::findFirstSelectedHourItem()
|
||||
{
|
||||
for(int i=0;i<mDayList.size();i++) {
|
||||
QTime t = mDayList.at(i)->startTime().time();
|
||||
// 선택된 시간만 확인
|
||||
if(t.hour() == mHours->mSelectedTime) {
|
||||
return mDayList.at(i);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RMVideoItem* FMDayTime::findSelectedItem()
|
||||
{
|
||||
return mMinutes->mAreas.at(mMinutes->mSelectedTime).second;
|
||||
// for(int i=0;i<mDayList.size();i++) {
|
||||
// QTime t = mDayList.at(i)->startTime().time();
|
||||
// // 선택된 시간만 확인
|
||||
// if(t.hour() == mHours->mSelectedTime && t.minute() == mMinutes->mSelectedTime) {
|
||||
// return mDayList.at(i);
|
||||
// }
|
||||
// }
|
||||
// return NULL;
|
||||
}
|
||||
void FMDayTime::onEnable()
|
||||
{
|
||||
//qInfo() << mMinutes->bDisabled << __FUNCTION__;
|
||||
mMinutes->bDisabled = false;
|
||||
this->setEnabled(true);
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
void FMDayTime::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
QTimer::singleShot(200,Qt::PreciseTimer,this,SLOT(onEnable()));
|
||||
}
|
||||
}
|
||||
|
||||
void FMDayTime::onMinuteSelected(int minute, QDateTime* playTime,bool moveList)
|
||||
{
|
||||
Q_UNUSED(moveList)
|
||||
|
||||
// mMinutes->mSelectedTime
|
||||
Q_UNUSED(minute)
|
||||
|
||||
if(playTime == NULL) {
|
||||
RMVideoItem* selected = findSelectedItem();
|
||||
if(selected != NULL) {
|
||||
|
||||
// 스스로 재생한 시간을 기록하여 LOOP 방지
|
||||
mLastPlayTime = selected->startTime();
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
// qInfo() << mMinutes->bDisabled << __FUNCTION__;
|
||||
mMinutes->bDisabled = true;
|
||||
//mMinutes->update();
|
||||
setEnabled(false);
|
||||
//QTimer::singleShot(500,Qt::PreciseTimer,this,SLOT(onEnable()));
|
||||
int old = RMVideoFileList::instance()->getPlayIndex();
|
||||
emit RMVideoFileList::instance()->playItemFound(selected,old);
|
||||
}
|
||||
}
|
||||
//qInfo() << selected->filePath << __FUNCTION__;
|
||||
}
|
||||
void FMDayTime::onBackupSelected(QList<RMVideoItem*>& lst)
|
||||
{
|
||||
|
||||
QString start = lst.first()->startTime().toString("HH:mm:ss");
|
||||
QString end = lst.last()->startTime().toString("HH:mm:ss");
|
||||
|
||||
QMessageBox msgBox(QMessageBox::NoIcon,
|
||||
FM_WSTR(L"ファイルのコピー"),
|
||||
FM_WSTR(L"ファイルのコピーを開始します。\nコピー範囲 :") + start + QString(" ~ ") + end,
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
msgBox.setStyleSheet("QLabel{min-width: 260px;}");
|
||||
msgBox.setWindowFlags(Qt::WindowTitleHint | Qt::Dialog | Qt::CustomizeWindowHint);
|
||||
msgBox.setButtonText(QMessageBox::Yes, "OK");
|
||||
msgBox.setButtonText(QMessageBox::No, FM_WSTR(L"キャンセル"));
|
||||
|
||||
if (QMessageBox::Yes == msgBox.exec())
|
||||
{
|
||||
|
||||
QString folder = RMApp::openFolder(RMSettings::instance()->lastBackupPath(),false,FM_WSTR(L"ファイルのコピーのパスを選択"));
|
||||
if(QDir(folder).exists()) {
|
||||
RMSettings::instance()->setLastBackupPath(folder);
|
||||
|
||||
QString copyFolder = "Copy_" + lst.first()->startTime().toString("yyyyMMdd_HHmmss");
|
||||
folder = QDir::cleanPath(folder + QDir::separator() + copyFolder);
|
||||
|
||||
// 폴더 생성
|
||||
if(!QDir(folder).exists()) {
|
||||
QDir().mkdir(folder);
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
for(int i=0;i<lst.size();i++){
|
||||
RMVideoItem* item = lst.at(i);
|
||||
QFileInfo fi(item->filePath);
|
||||
QString dest = QDir::cleanPath(folder + QDir::separator() + fi.fileName());
|
||||
|
||||
if(QFile(dest).exists()) {
|
||||
QFile(dest).remove();
|
||||
}
|
||||
QFile::copy(lst.at(i)->filePath, dest);
|
||||
if(is_encrypted_an6000(dest.toStdWString().c_str())) {
|
||||
decrypt_an6000(dest.toStdWString().c_str());
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
QMessageBox::information(this,FM_WSTR(L"ファイルのコピー"),FM_WSTR(L"完了しました。"),"OK");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #if (USE_DATE_TIME_LIST)
|
||||
185
project/fm_viewer/ui/fm_daytime.h
Normal file
185
project/fm_viewer/ui/fm_daytime.h
Normal file
@@ -0,0 +1,185 @@
|
||||
|
||||
#ifndef FM_DAYTIME_H
|
||||
#define FM_DAYTIME_H
|
||||
#if (USE_DATE_TIME_LIST)
|
||||
#include <QWidget>
|
||||
#include <QDate>
|
||||
#include <QSet>
|
||||
#include "../fm_event_types.h"
|
||||
|
||||
class FMDayTime;
|
||||
class RMVideoItem;
|
||||
class FMTimeBar : public QWidget
|
||||
{
|
||||
friend class FMDayTime;
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMTimeBar(int min, int max, int unit, int labelUnit, QWidget *parent = nullptr);
|
||||
bool bDisabled; ///!< 파일 로딩시 잠김
|
||||
protected:
|
||||
|
||||
int mMin; ///!< 시간/분 모두 0,
|
||||
int mMax; ///!< 시간일 경우 24, 분일경우 60
|
||||
int mUnit; ///!< 시간:1 분:5
|
||||
int mLabelUnit; ///!< 시간:3(시간에 한번 표시), 분:5(분에 한번 표시)
|
||||
int mMarginLR; ///!< 좌우 최소 마진 (+ 소숫점 오차가 최종 마진이 됨)
|
||||
|
||||
void showEvent(QShowEvent*) override;
|
||||
|
||||
void drawGrid(QPainter& p);
|
||||
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
bool mPressed; ///!< 마우스 눌린 상태
|
||||
int mHoverTime; ///!< 마우스 HOVER 시간(분)
|
||||
int mSelectedTime; ///!< 선택 시간(분)
|
||||
|
||||
QSet<int> mExists; ///!< 영상이 존재하는 시작시간(분)
|
||||
|
||||
|
||||
|
||||
//! \brief 초기화
|
||||
virtual void reset();
|
||||
|
||||
//! \brief 마우스 좌표에서 선택된 시간(분) 확인
|
||||
//! \param xy: 마우스 좌표
|
||||
//! \return 선택된 시간
|
||||
virtual int getTime(QPoint xy);
|
||||
signals:
|
||||
//! \brief 시간 또는 분 선택됨
|
||||
//! \param nSelected: 선택된 시간, 분
|
||||
//! \param playTime: 리스트 또는 다음파일로 재생된 경우
|
||||
//! \parma moveList: 리스트 업데이트
|
||||
void timeSelected(int nSelected, QDateTime* playTime,bool moveList);
|
||||
};
|
||||
|
||||
class FMTimeBarMinute : public FMTimeBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMTimeBarMinute(QWidget *parent = nullptr);
|
||||
QList<QPair<QSize,RMVideoItem*>> mFiles; ///!< 0~3600 초로 구성된 재생시간 영역
|
||||
|
||||
QList<QPair<QRect,RMVideoItem*>> mAreas;
|
||||
void createAreaBox();
|
||||
void reset() override;
|
||||
|
||||
//! \brief 시간과 동일한 AREA INDEX 리턴
|
||||
//! \param time
|
||||
//! \return
|
||||
int findAreaFromTime(QDateTime* time);
|
||||
protected:
|
||||
bool mMenu; ///!< 메뉴 표시 여부
|
||||
|
||||
int mStartBackup;
|
||||
int mEndBackup;
|
||||
QList<RMVideoItem*> backups;
|
||||
|
||||
//! \brief XY 로 시간확인하는 방식이 다름
|
||||
//! \param xy: 좌표
|
||||
//! \return 선택된 mAreas 리스트
|
||||
int getTime(QPoint xy) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
//! \brief 우측 메뉴 클릭을 위해 처리
|
||||
//! \param event
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
//! \brief 백업 메뉴 표시
|
||||
//! \param pos: 좌표
|
||||
void showMenu(QPoint pos);
|
||||
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
signals:
|
||||
void backupSelected(QList<RMVideoItem*>&);
|
||||
|
||||
public slots:
|
||||
void onSetBackup();
|
||||
};
|
||||
|
||||
//! \brief 시간/분 통합 컨트롤
|
||||
class FMDayTime : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMDayTime(QWidget *parent = nullptr);
|
||||
protected:
|
||||
FMTimeBar* mHours;
|
||||
FMTimeBarMinute* mMinutes;
|
||||
|
||||
QDateTime mLastPlayTime; ///!< 재생시간을 확인하여 분으로 선택된 경우 LOOP 방지
|
||||
|
||||
//! \brief 파일 리스트 중 지정된 날짜에 포함된 시간리스트 리턴
|
||||
//! \param hours<out>: 영상이 존재하는 시간(0~23) 리스트
|
||||
void getHour(QSet<int>& hours);
|
||||
|
||||
//! \brief 파일 리스트 중 지정된 날짜, 시간에 포함된 분리스트 리턴
|
||||
//! \param hours<out>: 영상이 존재하는 분(0~59) 리스트
|
||||
//void getMinute(QSet<int>& minutes);
|
||||
|
||||
//! \brief 파일 리스트 확인하여 시작분(초), 끝분(초) 영역 생성
|
||||
void loadMinutes(QList<QPair<QSize,RMVideoItem*>>& files);
|
||||
|
||||
//QDate mDate; ///!< 선택된 날짜
|
||||
QList<RMVideoItem*> mDayList; ///!< 날짜에 포함된 아이템 리스트
|
||||
|
||||
RMVideoItem* findSelectedItem();
|
||||
|
||||
//! \brief 선택된 시간의 최초 아이템 리턴
|
||||
//! \return
|
||||
RMVideoItem* findFirstSelectedHourItem();
|
||||
|
||||
//! \brief 시간선택 (영상이 존재하는 시간만 선택됨)
|
||||
//! \param tihourme: 선택할 시간
|
||||
//! \param fromCalendar: 캘린더 UI 에서 선택됨
|
||||
//! \param moveList: 리스트 업데이트
|
||||
void selectHour(int hour, QDateTime* playTime, bool moveList);
|
||||
|
||||
signals:
|
||||
//! \brief 시간선택시 리스트 이동
|
||||
//! \param selected
|
||||
void listMove(RMVideoItem* selected);
|
||||
|
||||
public slots:
|
||||
|
||||
//! \brief 재생시작 완료까지 비활성화
|
||||
void onEnable();
|
||||
|
||||
//! \brief 날짜 변경되어 시간/분 그래프 업데이트 필요
|
||||
//! 리스트에서 파일 선택시에도 호출됨??
|
||||
//! \param playTime: 다음파일, 리스트 등에서 재생되어 지정된 시간이 존재할 경우
|
||||
//! \param bSelectFirst: 최초의 시간/분 강제 선택 (달력 컨트롤에서 요청)
|
||||
//! \param moveList: 리스트 이동
|
||||
void onDateSelected(QList<RMVideoItem*>*,QDateTime* playTime, bool moveList);
|
||||
|
||||
//! \brief 날짜 변경없이 다음파일, 리스트 등에서 재생되어 시간이 업데이트 된 경우
|
||||
//! \param playTime: 재생된 파일의 시간
|
||||
void onPlayTime(QDateTime* playTime, bool moveList);
|
||||
|
||||
//! \brief 시간 선택됨-> 분(BAR) 업데이트
|
||||
//! \param hour
|
||||
//! \param playTime: 다음파일, 리스트 등에서 재생되어 지정된 시간이 존재할 경우
|
||||
//! \param moveList: 리스트 위치 이동
|
||||
void onHourSelected(int hour,QDateTime* playTime,bool moveList);
|
||||
|
||||
//! \brief 분 선택됨-> 분(BAR) 업데이트
|
||||
//! \param minute
|
||||
//! \param playTime: 다음파일, 리스트 등에서 재생되어 지정된 시간이 존재할 경우
|
||||
//! \param moveList: 리스트 위치 이동
|
||||
void onMinuteSelected(int minute,QDateTime* playTime,bool moveList);
|
||||
|
||||
void onBackupSelected(QList<RMVideoItem*>& lst);
|
||||
|
||||
//! \brief 선택된 월에 영상이 존재하지 않아 초기화
|
||||
void onClearDate();
|
||||
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // #if (USE_DATE_TIME_LIST)
|
||||
#endif // FM_DAYTIME_H
|
||||
230
project/fm_viewer/ui/fm_drag_zoom_widget.cpp
Normal file
230
project/fm_viewer/ui/fm_drag_zoom_widget.cpp
Normal file
@@ -0,0 +1,230 @@
|
||||
|
||||
#include "fm_drag_zoom_widget.h"
|
||||
#if (USE_DRAG_ZOOM)
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include "../core/rm_math.h"
|
||||
#include "../rm_include.h"
|
||||
|
||||
//#include "rm_controlwidget.h"
|
||||
//#include "rm_constants.h"
|
||||
|
||||
FMDragZoomWidget::FMDragZoomWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
#if (DRAG_ZOOM_BY_RATIO)
|
||||
ratio = QSize(160000,90000);
|
||||
#endif //
|
||||
|
||||
_mousePressed = false;
|
||||
_drawStarted = false;
|
||||
_ROIEnabled = false;
|
||||
|
||||
#if (USE_DRAG_ZOOM)
|
||||
_disabled = false;
|
||||
_block = false;
|
||||
#endif
|
||||
|
||||
QPixmap pixmap;
|
||||
pixmap.load(":/image/cursor_magnify.png");
|
||||
_magnify = new QCursor(pixmap);
|
||||
}
|
||||
|
||||
QPoint FMDragZoomWidget::filterPoint(QPoint point)
|
||||
{
|
||||
#if (DRAG_ZOOM_BY_RATIO)
|
||||
QRectF bound = QRectAspectFitRect(ratio,QRect(0,0,this->size().width(),this->size().height()));
|
||||
#else // DRAG_ZOOM_BY_RATIO
|
||||
#if (TOP_DOWN_360)
|
||||
QRectF bound = QRectAspectFitRect(QSize(1,1),QRect(0,0,this->size().width(),this->size().height()));
|
||||
#else
|
||||
QRectF bound = QRectAspectFitRect(QSize(160000,90000),QRect(0,0,this->size().width(),this->size().height()));
|
||||
#endif
|
||||
#endif // DRAG_ZOOM_BY_RATIO
|
||||
|
||||
if(bound.contains(point) == false)
|
||||
{
|
||||
double xmin = qMin(bound.left(), bound.right());
|
||||
double xmax = qMax(bound.left(), bound.right());
|
||||
double ymax = qMax(bound.top(), bound.bottom());
|
||||
double ymin = qMin(bound.top(), bound.bottom());
|
||||
|
||||
return QPoint((int)qMax(qMin(point.x(),(int)xmax),(int)xmin),(int)qMax(qMin(point.y(),(int)ymax),(int)ymin));
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
void FMDragZoomWidget::sendSelectedSignal()
|
||||
{
|
||||
_rect = _rect.normalized();
|
||||
// 영역이 너무 작을 경우 취소
|
||||
if(_rect.width() < 5 || _rect.height() < 5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 후방도 16:9로 고정되어 있어 문제가 안됨. ???
|
||||
#if (DRAG_ZOOM_BY_RATIO)
|
||||
QRectF bound = QRectAspectFitRect(ratio,QRect(0,0,this->size().width(),this->size().height()));
|
||||
#else // DRAG_ZOOM_BY_RATIO
|
||||
#if (TOP_DOWN_360)
|
||||
QRectF bound = QRectAspectFitRect(QSize(1,1),QRect(0,0,this->size().width(),this->size().height()));
|
||||
#else // TOP_DOWN_360
|
||||
QRectF bound = QRectAspectFitRect(QSize(160000,90000),QRect(0,0,this->size().width(),this->size().height()));
|
||||
#endif // TOP_DOWN_360
|
||||
#endif // DRAG_ZOOM_BY_RATIO
|
||||
// 크기는 확인
|
||||
//qInfo() << "AREA" << this->size() << "BOUND" << bound << "RECT" << _rect << __FUNCTION__;
|
||||
|
||||
double xmin = qMin(_rect.left(), _rect.right());
|
||||
double ymin = qMin(_rect.top(), _rect.bottom());
|
||||
|
||||
double x = (xmin - bound.left()) / bound.width();
|
||||
double y = (ymin - bound.top()) / bound.height();
|
||||
|
||||
double width = ((double)_rect.width()) / bound.width();
|
||||
double height = ((double)_rect.height()) / bound.height();
|
||||
|
||||
//qInfo() << "RECT" << x << y << width << height << __FUNCTION__;
|
||||
#if (FISH_EYE_CLIP)
|
||||
// 실제 사용자가 화면에서 선택한 영역은 원본 데이터의 85% CLIP 영역
|
||||
qInfo() << "XYWH:" << x << y << width << height << __FUNCTION__;
|
||||
// (버릴 영역의 크기: 15% / 2 = 7.5%)
|
||||
x = (x * 0.85) + 0.075;
|
||||
y = (y * 0.85) + 0.075;
|
||||
width *= 0.85;
|
||||
height *= 0.85;
|
||||
//qInfo() << "XYWH2:" << x << y << width << height << __FUNCTION__;
|
||||
#endif
|
||||
emit ROISelected(x,y,width,height);
|
||||
}
|
||||
|
||||
void FMDragZoomWidget::ROIReset()
|
||||
{
|
||||
_mousePressed = false;
|
||||
_ROIEnabled = true;
|
||||
//update();
|
||||
}
|
||||
void FMDragZoomWidget::setROIEnabled(bool enabled)
|
||||
{
|
||||
_ROIEnabled = enabled;
|
||||
}
|
||||
|
||||
void FMDragZoomWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
//time.start(); // 확인
|
||||
#if (USE_DRAG_ZOOM)
|
||||
if(_disabled || _block) {
|
||||
QWidget::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(_ROIEnabled == true && event->button() == Qt::LeftButton)
|
||||
{
|
||||
_mousePressed = true;
|
||||
_rect.setTopLeft(filterPoint(event->pos()));
|
||||
_rect.setBottomRight(filterPoint(event->pos()));
|
||||
}
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
void FMDragZoomWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
//qInfo() << _ROIEnabled << __FUNCTION__;
|
||||
if(_ROIEnabled == true && _mousePressed == true)
|
||||
{
|
||||
_rect.setBottomRight(filterPoint(event->pos()));
|
||||
if(fabs((float)_rect.width()) > 5.0f && fabs((float)_rect.height()) > 5.0f)
|
||||
{
|
||||
setCursor(*_magnify); // 클릭시 커서를 변경하면 보기 싫다.
|
||||
}
|
||||
update();
|
||||
}
|
||||
QWidget::mouseMoveEvent(event);
|
||||
}
|
||||
void FMDragZoomWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
#if (USE_DRAG_ZOOM)
|
||||
if(_disabled || _block) {
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
//qInfo() << "CLICKED _ROIEnabled:" << _ROIEnabled << "_mousePressed:" << _mousePressed << "_drawStarted:" << _drawStarted << __FUNCTION__;
|
||||
|
||||
|
||||
bool ROI = false;
|
||||
if(_ROIEnabled == true && _mousePressed == true)
|
||||
{
|
||||
#if (CLICK_PAUSE_PLAY)
|
||||
if(_rect.width() < 5 && _rect.height() < 5) {
|
||||
emit clicked();
|
||||
}
|
||||
#endif // CLICK_PAUSE_PLAY
|
||||
|
||||
if(_drawStarted == true)
|
||||
{
|
||||
sendSelectedSignal();
|
||||
ROI = true;
|
||||
_rect.setRect(0,0,0,0); // 삭제
|
||||
update();
|
||||
}
|
||||
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
if(ROI == false)
|
||||
{
|
||||
emit ROICleared();
|
||||
}
|
||||
_mousePressed = false;
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
void FMDragZoomWidget::onReleaseDisabled()
|
||||
{
|
||||
_block = false;
|
||||
}
|
||||
void FMDragZoomWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
_block = true;
|
||||
QTimer::singleShot(100,Qt::PreciseTimer,this,SLOT(onReleaseDisabled()));
|
||||
QWidget::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void FMDragZoomWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_painter.begin(this);
|
||||
QPen pen(Qt::red);
|
||||
_painter.setPen(pen);
|
||||
_painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
QRect nrect = _rect;
|
||||
nrect = nrect.normalized();
|
||||
|
||||
if(_mousePressed)
|
||||
{
|
||||
_painter.drawPixmap(0,0,_pixmap);
|
||||
if(nrect.width() > 5 && nrect.height() > 5) {
|
||||
_painter.drawRect(nrect);
|
||||
}
|
||||
_drawStarted = true;
|
||||
}
|
||||
else if (_drawStarted && !_pixmap.isNull())
|
||||
{
|
||||
QPainter tempPainter(&_pixmap);
|
||||
tempPainter.setRenderHint(QPainter::Antialiasing, false);
|
||||
tempPainter.setPen(pen);
|
||||
if(nrect.width() > 5 && nrect.height() > 5) {
|
||||
tempPainter.drawRect(nrect);
|
||||
}
|
||||
_painter.drawPixmap(0,0,_pixmap);
|
||||
}
|
||||
_painter.end();
|
||||
}
|
||||
#endif // USE_DRAG_ZOOM
|
||||
63
project/fm_viewer/ui/fm_drag_zoom_widget.h
Normal file
63
project/fm_viewer/ui/fm_drag_zoom_widget.h
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
#ifndef FM_DRAG_ZOOM_WIDGET_H
|
||||
#define FM_DRAG_ZOOM_WIDGET_H
|
||||
#if (USE_DRAG_ZOOM)
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
class FMDragZoomWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#if (DRAG_ZOOM_BY_RATIO)
|
||||
QSize ratio;
|
||||
#endif //
|
||||
|
||||
private:
|
||||
|
||||
bool _mousePressed;
|
||||
bool _drawStarted;
|
||||
bool _ROIEnabled;
|
||||
|
||||
|
||||
QCursor* _magnify;
|
||||
QPixmap _pixmap;
|
||||
QRect _rect;
|
||||
QPainter _painter;
|
||||
|
||||
QPoint filterPoint(QPoint point);
|
||||
void sendSelectedSignal();
|
||||
public:
|
||||
|
||||
#if (USE_DRAG_ZOOM)
|
||||
bool _disabled;
|
||||
bool _block;
|
||||
#endif // USE_DRAG_ZOOM
|
||||
|
||||
explicit FMDragZoomWidget(QWidget *parent = 0);
|
||||
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
void setROIEnabled(bool enabled);
|
||||
void ROIReset(); // fullscreen
|
||||
|
||||
public slots:
|
||||
#if (USE_DRAG_ZOOM)
|
||||
void onReleaseDisabled();
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void ROISelected(double x, double y, double width, double height);
|
||||
void ROICleared();
|
||||
#if (CLICK_PAUSE_PLAY)
|
||||
void clicked(); ///! DRAG 없이 CLICK 발생?
|
||||
#endif // CLICK_PAUSE_PLAY
|
||||
public slots:
|
||||
};
|
||||
#endif // #if (USE_DRAG_ZOOM)
|
||||
#endif // FM_DRAG_ZOOM_WIDGET_H
|
||||
151
project/fm_viewer/ui/fm_frame_gps.cpp
Normal file
151
project/fm_viewer/ui/fm_frame_gps.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
#include "fm_frame_gps.h"
|
||||
#include "fm_layer.h"
|
||||
#if (USE_FRAME_GPS)
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../data/rm_sensordata.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "fm_colors.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
|
||||
#define NULL_GPS_COORDINATE "--.------"
|
||||
|
||||
FMFrameGPS::FMFrameGPS(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
FMWidgetBorder(this,"frame_gps",0x666666);
|
||||
layout = new QHBoxLayout(this);
|
||||
|
||||
layout->setAlignment(Qt::AlignVCenter);
|
||||
ZERO_LAYOUT(layout);
|
||||
|
||||
// QWidget* sw = new QWidget(this);
|
||||
// layout->addWidget(sw);
|
||||
|
||||
// QHBoxLayout* swl = new QHBoxLayout(sw);
|
||||
// ZERO_LAYOUT(swl);
|
||||
// swl->setAlignment(Qt::AlignVCenter | Qt::AlignLeading);
|
||||
// swl->setContentsMargins(10,0,0,0);
|
||||
// speed = new QLabel(sw);
|
||||
// swl->addWidget(speed);
|
||||
// speed->setStyleSheet("font-family: Arial;font-size: 13px; color : #BBBBBB");
|
||||
// speed->setText("---");
|
||||
|
||||
// QLabel* kmh = new QLabel(sw);
|
||||
// swl->addWidget(kmh);
|
||||
// kmh->setStyleSheet("font-family: Arial; font-size: 11px; color : #BBBBBB");
|
||||
// kmh->setText(" km/h");
|
||||
|
||||
// LAYOUT_SPACE(swl,8,0);
|
||||
// QLabel* speedWarning = new QLabel(sw);
|
||||
// speedWarning->setText(FMS::txt("speed_warning"));
|
||||
// speedWarning->setStyleSheet("font-family: Arial; font-size: 12px; color : #c59433");
|
||||
// swl->addWidget(speedWarning);
|
||||
|
||||
|
||||
//QWidget* locw = new QWidget(this);
|
||||
//layout->addWidget(locw);
|
||||
//QHBoxLayout* locwl = new QHBoxLayout(locw);
|
||||
//ZERO_LAYOUT(locwl);
|
||||
//locwl->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
//layout->setAlignment(Qt::AlignVCenter);
|
||||
//ZERO_LAYOUT(layout);
|
||||
layout->setContentsMargins(10,0,0,0);
|
||||
layout->setSpacing(10);
|
||||
|
||||
QSize bs = QSize(50,18);
|
||||
|
||||
QLabel* lb = new QLabel(this);
|
||||
lb->setAlignment(Qt::AlignCenter);
|
||||
FMLabelBackground(lb,"lonlat_title","MS PGothic",FM_SELECTED_TEXT_COLOR,12,false,0x3c3c3c);
|
||||
layout->addWidget(lb);
|
||||
lb->setFixedSize(bs);
|
||||
lb->setText(FMS::txt("lat"));
|
||||
|
||||
lat = new QLabel(this);
|
||||
FMLabel(lat,"lonlat_label","Arial",0xf5f5f5,13,false);
|
||||
lat->setText(NULL_GPS_COORDINATE);
|
||||
layout->addWidget(lat);
|
||||
|
||||
lb = new QLabel(this);
|
||||
lb->setText(FMS::txt("lon"));
|
||||
lb->setFixedSize(bs);
|
||||
lb->setAlignment(Qt::AlignCenter);
|
||||
FMLabelBackground(lb,"lonlat_title","MS PGothic",FM_SELECTED_TEXT_COLOR,12,false,0x3c3c3c);
|
||||
layout->addWidget(lb);
|
||||
|
||||
lon = new QLabel(this);
|
||||
FMLabel(lon,"lonlat_label","Arial",0xf5f5f5,13,false);
|
||||
lon->setText(NULL_GPS_COORDINATE);
|
||||
layout->addWidget(lon);
|
||||
_sensor = NULL;
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
}
|
||||
void FMFrameGPS::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
if(_sensor != NULL)
|
||||
{
|
||||
double ratio = ((double)position) / ((double)duration);
|
||||
double lonV,latV;
|
||||
if(_sensor->getGPSCoord(ratio,&latV,&lonV))
|
||||
{
|
||||
lon->setText(QString().sprintf("%.06f",latV));
|
||||
lat->setText(QString().sprintf("%.06f",lonV));
|
||||
}
|
||||
else {
|
||||
lon->setText(NULL_GPS_COORDINATE);
|
||||
lat->setText(NULL_GPS_COORDINATE);
|
||||
}
|
||||
|
||||
// int rspd = _sensor->getGPSSpeed(ratio);
|
||||
// if(rspd >= 0 && rspd < 500)
|
||||
// {
|
||||
// speed->setText(QString().sprintf("%03d",rspd));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// speed->setText("---");
|
||||
// }
|
||||
}
|
||||
}
|
||||
void FMFrameGPS::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
||||
// if(event == PLAY_DID_CLEARED || event == PLAY_DID_LOADED)
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
|
||||
if(item->getSensorData() != NULL && item->getSensorData()->getGPSCount() > 0)
|
||||
{
|
||||
_sensor = item->getSensorData();
|
||||
}
|
||||
else
|
||||
{
|
||||
_sensor = NULL;
|
||||
lon->setText(NULL_GPS_COORDINATE);
|
||||
lat->setText(NULL_GPS_COORDINATE);
|
||||
}
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_sensor = NULL;
|
||||
// speed->setText("---");
|
||||
}
|
||||
else if (event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
lon->setText(NULL_GPS_COORDINATE);
|
||||
lat->setText(NULL_GPS_COORDINATE);
|
||||
}
|
||||
}
|
||||
void FMFrameGPS::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
#endif // #if (USE_FRAME_GPS)
|
||||
28
project/fm_viewer/ui/fm_frame_gps.h
Normal file
28
project/fm_viewer/ui/fm_frame_gps.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef FM_FRAME_GPS_H
|
||||
#define FM_FRAME_GPS_H
|
||||
#if (USE_FRAME_GPS)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../core/rm_player_base.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
class RMSensorData;
|
||||
class FMFrameGPS : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMFrameGPS(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
//QLabel* speed;
|
||||
QLabel* lat;
|
||||
QLabel* lon;
|
||||
QHBoxLayout* layout;
|
||||
RMSensorData* _sensor;
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
public slots:
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // FM_FRAME_GPS_H
|
||||
109
project/fm_viewer/ui/fm_frame_speed.cpp
Normal file
109
project/fm_viewer/ui/fm_frame_speed.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include "fm_frame_speed.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../data/rm_sensordata.h"
|
||||
#include "fm_speed_widget.h"
|
||||
#include "fm_button.h"
|
||||
#include <QStyle>
|
||||
|
||||
FMSpeedFrame::FMSpeedFrame(QWidget *parent) : RMWidgetBase(parent,false)
|
||||
{
|
||||
//LAYOUT_DEBUG(this);
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setContentsMargins(1,0,0,0);
|
||||
|
||||
speed = new FMSpeedWidget(this);
|
||||
speed->setFixedSize(87,52);
|
||||
//LAYOUT_DEBUG(speed)
|
||||
layout->addWidget(speed);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
kmhButton = FMButton::btnStatic2(this,layout,"speed_kmh",NULL,QSize(87,23));
|
||||
#else // LIVE_LANGUAGE2
|
||||
kmhButton = FMButton::btnStatic(this,layout,"speed_kmh",MKU8(""),QSize(87,23));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
layout->addWidget(kmhButton);
|
||||
|
||||
_sensor = NULL;
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
RMApp::isMPH = false;
|
||||
|
||||
#if (REMOVE_OLD_C)
|
||||
RMApp::isMPH = (RMLanguage::instance()->language() == RMLanguage::LANGUAGE_EN);
|
||||
#else
|
||||
RMApp::isMPH = RMLanguage::isJP() == false;
|
||||
#endif
|
||||
//kmh->setText(RMApp::isMPH ? "mph" : "km/h");
|
||||
//connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
_spd = -1;
|
||||
}
|
||||
void FMSpeedFrame::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
if(_sensor != NULL)
|
||||
{
|
||||
double ratio = ((double)position) / ((double)duration);
|
||||
_spd = _sensor->getGPSSpeed(ratio);
|
||||
//qInfo() << _spd << ratio << __FUNCTION__;
|
||||
double rspd = _spd;
|
||||
if(RMApp::isMPH)
|
||||
{
|
||||
rspd = 0.621371 * _spd;
|
||||
}
|
||||
if(rspd >= 0 && rspd < 500)
|
||||
{
|
||||
speed->updateSpeed(rspd);
|
||||
// QString str;
|
||||
// str.sprintf("%d",(int)rspd);
|
||||
//speed->setText(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
speed->updateSpeed(-1);
|
||||
//speed->setText("--");
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMSpeedFrame::onSpeednUnit()
|
||||
{
|
||||
_isMPH = !_isMPH;
|
||||
RMApp::isMPH = _isMPH;
|
||||
//kmh->setText(RMApp::isMPH ? "mph" : "km/h");
|
||||
//qInfo() << "RMApp::isMPH" << RMApp::isMPH << "kmh:" << kmh->pixmap();
|
||||
|
||||
emit speedUnitChange();
|
||||
}
|
||||
void FMSpeedFrame::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
//qInfo() << __FUNCTION__ << event;
|
||||
|
||||
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
||||
// if(event == PLAY_DID_CLEARED || event == PLAY_DID_LOADED)
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
|
||||
_spd = -1;
|
||||
if(item->getSensorData() != NULL && item->getSensorData()->getGPSCount() > 0)
|
||||
{
|
||||
_sensor = item->getSensorData();
|
||||
}
|
||||
else
|
||||
{
|
||||
_sensor = NULL;
|
||||
speed->updateSpeed(-1);
|
||||
//speed->setText("--");
|
||||
}
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_spd = -1;
|
||||
_sensor = NULL;
|
||||
speed->updateSpeed(-1);
|
||||
}
|
||||
else if (event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
//speed->setText("");
|
||||
}
|
||||
}
|
||||
37
project/fm_viewer/ui/fm_frame_speed.h
Normal file
37
project/fm_viewer/ui/fm_frame_speed.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef FM_FRAME_SPEED_H
|
||||
#define FM_FRAME_SPEED_H
|
||||
|
||||
#include "rm_widget_base.h"
|
||||
#include "../fm_event_types.h"
|
||||
|
||||
class RMSensorData;
|
||||
class FMButton;
|
||||
class FMSpeedWidget;
|
||||
class FMSpeedFrame : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMSpeedFrame(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
FMButton* kmhButton;
|
||||
FMSpeedWidget* speed;
|
||||
QVBoxLayout* layout;
|
||||
RMSensorData* _sensor;
|
||||
double _spd;
|
||||
|
||||
bool _isMPH; // 지도와, 메인화면 동시에 사용되는 경우가 있어 global 처리하면 2회 반복되어 문제가 됨
|
||||
void refreshSpeed(); // MPH 변환
|
||||
|
||||
signals:
|
||||
void speedUnitChange();
|
||||
|
||||
public slots:
|
||||
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
|
||||
void onSpeednUnit();
|
||||
};
|
||||
|
||||
#endif // FM_FRAME_SPEED_H
|
||||
712
project/fm_viewer/ui/fm_frame_title.cpp
Normal file
712
project/fm_viewer/ui/fm_frame_title.cpp
Normal file
@@ -0,0 +1,712 @@
|
||||
#include "fm_frame_title.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "rm_app.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../core/rm_play_process.h"
|
||||
#include "rm_popup.h"
|
||||
#include "fm_button.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
#if (USER_LOGER || RM_MODEL_EMT_KR)
|
||||
#include "fm_label_click.h"
|
||||
#include <QTimer>
|
||||
#endif // #if (USER_LOGER)
|
||||
|
||||
|
||||
#if (USE_JP_ADDRESS_TOOL)
|
||||
#include "../data/fm_address.h"
|
||||
#endif // USE_JP_ADDRESS_TOOL
|
||||
|
||||
#include "rm_dialog_map.h"
|
||||
|
||||
|
||||
|
||||
|
||||
FMFrameTitle::FMFrameTitle(QWidget *parent, QString title, QString icon) : RMWidgetBase(parent,true)
|
||||
{
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
setStyleSheet("FMFrameTitle{border-image: url(:/image/title_bg.png) 0 0 0 0 repeat stretch;}");
|
||||
this->setFixedHeight(MAIN_TITLE_BAR_HEIGHT);
|
||||
this->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
_layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(_layout);
|
||||
_layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
LAYOUT_SPACE(_layout,8,0);
|
||||
|
||||
if(icon.isEmpty() == false || title.isEmpty() == false)
|
||||
{
|
||||
_titleLabel = new FMClickURLLabel("https://nexian.kr",this);
|
||||
if(icon.isEmpty() == false)
|
||||
{
|
||||
_titleLabel->setPixmap( QPixmap(":/image/" + icon) );
|
||||
_titleLabel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
_titleLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
_titleLabel->setOpenExternalLinks(true);
|
||||
}
|
||||
else if (title.isEmpty() == false)
|
||||
{
|
||||
_titleLabel->setText(title);
|
||||
_titleLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||
}
|
||||
_layout->addWidget(_titleLabel);
|
||||
}
|
||||
|
||||
// 모델 정보
|
||||
_modelInfo = new QLabel(this);
|
||||
_modelInfo->setAccessibleName("model_info_label"); // 자동화를 위해 사용
|
||||
_layout->addWidget(_modelInfo);
|
||||
// font-family: Fixedsys; border: 1px solid red;
|
||||
_modelInfo->setStyleSheet("font-family: Arial;font-weight:bold;font-size: 14px;color : #CCCCCC;");
|
||||
_modelInfo->setText("---"); // NP5000 v.0.0.2
|
||||
_modelInfo->setFixedHeight(22);
|
||||
_modelInfo->setAlignment(Qt::AlignBottom);
|
||||
|
||||
#if (REPORT_CRASH_LOG)
|
||||
_modelInfo->setText(QString().sprintf("[ver.%d.%d.%d.%d] CRASH REPORT VERSION",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2,RM_MODEL_SVN_VERSION));
|
||||
#endif //
|
||||
|
||||
// 툴바 우측부터 추가
|
||||
QWidget* toolBar = new QWidget(this);
|
||||
//LAYOUT_DEBUG(toolBar);
|
||||
//toolBar->setStyleSheet("border: 1px solid red;");
|
||||
toolBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_layout->addWidget(toolBar);
|
||||
|
||||
QHBoxLayout* toolBarLayout = new QHBoxLayout(toolBar);
|
||||
ZERO_LAYOUT(toolBarLayout);
|
||||
toolBarLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
QSize btnSize = QSize(36,36);
|
||||
toolBarLayout->setAlignment(Qt::AlignRight);
|
||||
|
||||
// 순서는 보고서, 분할, 캡쳐, 지도, 설정, 도움말, 최소화, 닫기
|
||||
const int tool_space = 1;
|
||||
|
||||
// 보고서
|
||||
_reportButton = FMButton::btn2(toolBar,toolBarLayout,"title_report","report",btnSize);
|
||||
_reportButton->setEnabled(false);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
_reportButton->setVisible(false);
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
// 분할
|
||||
#if (SUPPORT_AVI_SPLIT || SPLIT_MULTI_TRACK_VIDEO)
|
||||
_btnExport = FMButton::btn2(toolBar,toolBarLayout,"title_split","split_files",btnSize,0);
|
||||
_btnExport->setEnabled(false);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
#endif
|
||||
|
||||
// 캡쳐
|
||||
_captureButton = FMButton::btn2(toolBar,toolBarLayout,"title_capture","capture",btnSize);
|
||||
_captureButton->setEnabled(false);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
// 지도
|
||||
_mapButton = FMButton::btn2(toolBar,toolBarLayout,"title_map","map",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
// 설정
|
||||
_settingsButton = FMButton::btn2(toolBar,toolBarLayout,"title_setup","settings",btnSize);
|
||||
_settingsButton->setEnabled(false);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
// 도움말
|
||||
_infoButton = FMButton::btn2(toolBar,toolBarLayout,"title_info","viewer_info",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
QLabel* seperator = new QLabel(toolBar);
|
||||
seperator->setFixedSize(5,36);
|
||||
seperator->setPixmap(QPixmap(":/image/title_seperator.png") );
|
||||
toolBarLayout->addWidget(seperator);
|
||||
|
||||
_minimizeButton = FMButton::btn2(toolBar,toolBarLayout,"title_minimize","minimize",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,tool_space,0);
|
||||
|
||||
// 最大化
|
||||
#if (USE_MAXIMIZE)
|
||||
maximizeButton = FMButton::btnCheck2(toolBar,toolBarLayout,"title_maximize","maximize",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
#endif
|
||||
|
||||
_closeButton = FMButton::btn2(toolBar,toolBarLayout,"title_close","close",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,8,0);
|
||||
|
||||
#if !(SETUP_ONLY_BUILD)
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
#endif //
|
||||
|
||||
_reportShortcut = new QShortcut(QKeySequence(Qt::Key_F3), this);
|
||||
_reportShortcut->setContext(Qt::ApplicationShortcut);
|
||||
_settingsShortcut = new QShortcut(QKeySequence(Qt::Key_F6), this);
|
||||
_settingsShortcut->setContext(Qt::ApplicationShortcut);
|
||||
|
||||
_infoShortcut = new QShortcut(QKeySequence(Qt::Key_F7), this);
|
||||
_infoShortcut->setContext(Qt::ApplicationShortcut);
|
||||
|
||||
_captureShortcut = new QShortcut(QKeySequence(Qt::Key_F5), this);
|
||||
_captureShortcut->setContext(Qt::ApplicationShortcut);
|
||||
_captureShortcut->setEnabled(false);
|
||||
|
||||
#else // #if (RM_MODEL_EMT_KR)
|
||||
setStyleSheet("FMFrameTitle{border-image: url(:/image/title_bg.png) 0 0 0 0 repeat stretch;}");
|
||||
|
||||
#if (USER_LOGER)
|
||||
_clickCount = 0;
|
||||
_versionLabel = NULL;
|
||||
_clickReset = NULL;
|
||||
#endif
|
||||
|
||||
this->setFixedHeight(MAIN_TITLE_BAR_HEIGHT);
|
||||
this->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
_layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(_layout);
|
||||
_layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
LAYOUT_SPACE(_layout,8,0);
|
||||
#if (USE_TEXT_TITLE)
|
||||
_titleLabel = new QLabel(this);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
_titleLabel->setPixmap( QPixmap(":/image/title_logo_nx.png") );
|
||||
_titleLabel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
#else // RM_MODEL_TYPE_FC_DR232W
|
||||
#if (SUB_MODEL_KEIYO_KR)
|
||||
_titleLabel->setText(WINDOW_TITLE);
|
||||
#elif (SUB_MODEL_KEIYO_360)
|
||||
#if (ARCH_64_BIT)
|
||||
_titleLabel->setText("Golf Cart Eyes");
|
||||
#else
|
||||
_titleLabel->setText("Golf Cart Eyes");
|
||||
#endif // ARCH_64_BIT
|
||||
#else //SUB_MODEL_KEIYO_KR
|
||||
#if (ARCH_64_BIT)
|
||||
_titleLabel->setText("DVPlayer 2B");
|
||||
#else
|
||||
_titleLabel->setText("DVPlayer 2A");
|
||||
#endif // ARCH_64_BIT
|
||||
#endif // SUB_MODEL_KEIYO_KR
|
||||
|
||||
|
||||
#endif // FC_DR232W
|
||||
_titleLabel->setStyleSheet("font-family: Arial; font-size: 16px; font-weight: bold; color : #BBBBBB");
|
||||
_layout->addWidget(_titleLabel);
|
||||
LAYOUT_SPACE(_layout,10,0);
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_FC_DR232W)
|
||||
QLabel* versionLabel = new QLabel(this);
|
||||
versionLabel->setText(QString().sprintf("[ Ver.%d.%d.%d ]",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2));
|
||||
versionLabel->setStyleSheet("font-family: Arial; font-size: 13px; color : #BBBBBB");
|
||||
_layout->addWidget(versionLabel);
|
||||
#endif
|
||||
|
||||
#else
|
||||
if(icon.isEmpty() == false || title.isEmpty() == false)
|
||||
{
|
||||
_titleLabel = new QLabel(this);
|
||||
if(icon.isEmpty() == false)
|
||||
{
|
||||
_titleLabel->setPixmap( QPixmap(":/image/" + icon) );
|
||||
_titleLabel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
}
|
||||
else if (title.isEmpty() == false)
|
||||
{
|
||||
_titleLabel->setText(title);
|
||||
_titleLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||
}
|
||||
_layout->addWidget(_titleLabel);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && !PLAYER_ONLY_LIBRARY_MODE)
|
||||
FMClickLabel* versionLabel = new FMClickLabel(this);
|
||||
// DEFINES += RM_MODEL_VERSION_0=0
|
||||
#if (REPORT_CRASH_LOG)
|
||||
versionLabel->setText(QString().sprintf("[ver.%d.%d.%d.%d] CRASH REPORT VERSION",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2,RM_MODEL_SVN_VERSION));
|
||||
#else // REPORT_CRASH_LOG
|
||||
QString versionString = QString().sprintf("[ver.%d.%d.%d]",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
#if (TB5000_INSPECTION_VERSION)
|
||||
versionString += " [INSPECTION]";
|
||||
#endif //
|
||||
versionLabel->setText(versionString);
|
||||
|
||||
#endif // REPORT_CRASH_LOG
|
||||
versionLabel->setStyleSheet("font-family: Fixedsys;color : #FFFFFF");
|
||||
connect(versionLabel,SIGNAL(clicked()),SLOT(onVersion()));
|
||||
_layout->addWidget(versionLabel);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if (USER_LOGER)
|
||||
_versionLabel = versionLabel;
|
||||
#endif // USER_LOGER
|
||||
|
||||
#if (USE_FILE_NAME_TITLE)
|
||||
LAYOUT_SPACE(_layout,10,0);
|
||||
_fileNameTitle = new QLabel(this);
|
||||
//_fileNameTitle->setText("________________________________________");
|
||||
_fileNameTitle->setStyleSheet("font-family: Arial; font-size: 13px; color : #BBBBBB");
|
||||
_layout->addWidget(_fileNameTitle);
|
||||
#endif
|
||||
// 툴바 우측부터 추가
|
||||
QWidget* toolBar = new QWidget(this);
|
||||
//LAYOUT_DEBUG(toolBar);
|
||||
//toolBar->setStyleSheet("border: 1px solid red;");
|
||||
toolBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_layout->addWidget(toolBar);
|
||||
|
||||
QHBoxLayout* toolBarLayout = new QHBoxLayout(toolBar);
|
||||
ZERO_LAYOUT(toolBarLayout);
|
||||
toolBarLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
QSize btnSize = QSize(36,36);
|
||||
toolBarLayout->setAlignment(Qt::AlignRight);
|
||||
|
||||
#if (USE_JP_ADDRESS_TOOL)
|
||||
_toolButton = FMButton::btn(toolBar,toolBarLayout,"title_report","CONVERT",btnSize);
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
connect(_toolButton,SIGNAL(clicked()),SLOT(onAddressTool()));
|
||||
#endif
|
||||
|
||||
#if (SUPPORT_AVI_SPLIT)
|
||||
_btnExport = FMButton::btn(toolBar,toolBarLayout,"vt_split",FMS::txt("split_files"),btnSize,0);
|
||||
_btnExport->setEnabled(false);
|
||||
//LAYOUT_SPACE(titleToolLayout,6,0);
|
||||
#endif
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
// レポート
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_reportButton = FMButton::btn2(toolBar,toolBarLayout,"title_report","report",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_reportButton = FMButton::btn(toolBar,toolBarLayout,"title_report",FMS::txt("report"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
_reportButton->setEnabled(false);
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_XLDR_88 || RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
_reportButton->setHidden(true);
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
// JPG 保存
|
||||
_captureButton = FMButton::btn2(toolBar,
|
||||
toolBarLayout,
|
||||
"title_capture",
|
||||
"capture",
|
||||
btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
// JPG 保存
|
||||
_captureButton = FMButton::btn(toolBar,
|
||||
toolBarLayout,
|
||||
"title_capture",
|
||||
FMS::txt("capture"),
|
||||
btnSize);
|
||||
|
||||
#endif // LIVE_LANGUAGE2
|
||||
_captureButton->setEnabled(false);
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
// 設定
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_settingsButton = FMButton::btn2(toolBar,toolBarLayout,"title_setup","settings",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
_settingsButton = FMButton::btnTypeTextColor(toolBar, toolBarLayout,"PW", FMS::txt("password"),btnSize,g_default_text_button_color_set);
|
||||
#else // RM_MODEL_TYPE_TB4000
|
||||
_settingsButton = FMButton::btn(toolBar,toolBarLayout,"title_setup",MKU8("\xe8\xa8\xad\xe5\xae\x9a"),btnSize);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#endif // LIVE_LANGUAGE2
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_XLDR_88 || RM_MODEL == RM_MODEL_TYPE_TB4000 || RM_MODEL == RM_MODEL_TYPE_AN6000 || RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
_settingsButton->setHidden(true);
|
||||
#endif
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
// ビューアー情報
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_infoButton = FMButton::btn2(toolBar,
|
||||
toolBarLayout,
|
||||
"title_info",
|
||||
"viewer_info",
|
||||
btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_infoButton = FMButton::btn(toolBar,
|
||||
toolBarLayout,
|
||||
"title_info",
|
||||
FMS::txt("viewer_info"),
|
||||
btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
//_infoButton->setHidden(true);
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_languageButton = FMButton::btn2(toolBar,toolBarLayout,"title_language","language",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
// 言語選択
|
||||
_languageButton = FMButton::btn(toolBar,toolBarLayout,"title_language",FMS::txt("language"),btnSize);
|
||||
RMLanguage::instance()->appendENGToolTip(_languageButton,"Language");
|
||||
#endif // LIVE_LANGUAGE2
|
||||
connect(_languageButton,SIGNAL(clicked()),SLOT(onLanguage()));
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
_languageButton->setHidden(true);
|
||||
#endif // SUB_MODEL_BV5000
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
_languageButton->setHidden(true);
|
||||
#endif // RM_MODEL_TYPE_EMT_KR
|
||||
|
||||
#endif // LIVE_LANGUAGE_CHANGE
|
||||
|
||||
#if !(DO_NOT_USE_MAP)
|
||||
#if !(TOGGLE_PLAYER)
|
||||
// 지도 MKU8("\xe5\x9c\xb0\xe5\x9b\xb3")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_mapButton = FMButton::btn2(toolBar,toolBarLayout,"title_map","map",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
#if (USE_GOOGLE_MAP_AND_OSM)
|
||||
_mapButton = FMButton::btn(toolBar,toolBarLayout,"title_gmap",FMS::txt("map"),btnSize);
|
||||
#else // USE_GOOGLE_MAP_AND_OSM
|
||||
_mapButton = FMButton::btn(toolBar,toolBarLayout,"title_map",FMS::txt("map"),btnSize);
|
||||
#endif // USE_GOOGLE_MAP_AND_OSM
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (USE_GOOGLE_MAP_AND_OSM)
|
||||
_mapButton->setToolTip("Google " + FMS::txt("map"));
|
||||
_mapOSMButton = FMButton::btn(toolBar,toolBarLayout,"title_map","OpenStreet " + FMS::txt("map"),btnSize);
|
||||
#endif // USE_GOOGLE_MAP_AND_OSM
|
||||
|
||||
LAYOUT_SPACE(toolBarLayout,12,0);
|
||||
#endif // TOGGLE_PLAYER
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
_mapButton->setHidden(true);
|
||||
#endif
|
||||
#endif // #if !(DO_NOT_USE_MAP)
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_minimizeButton = FMButton::btn2(toolBar,
|
||||
toolBarLayout,
|
||||
"title_minimize",
|
||||
"minimize",
|
||||
btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_minimizeButton = FMButton::btn(toolBar,
|
||||
toolBarLayout,
|
||||
"title_minimize",
|
||||
FMS::txt("minimize"),
|
||||
btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
|
||||
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
|
||||
// 最大化
|
||||
#if (USE_MAXIMIZE)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
maximizeButton = FMButton::btnCheck2(toolBar,toolBarLayout,"title_maximize","maximize",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
maximizeButton = FMButton::btnCheck(toolBar,toolBarLayout,"title_maximize",FMS::txt("maximize"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif
|
||||
|
||||
LAYOUT_SPACE(toolBarLayout,2,0);
|
||||
|
||||
// 閉じる MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b"),
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_closeButton = FMButton::btn2(toolBar,
|
||||
toolBarLayout,
|
||||
"title_close",
|
||||
"close",
|
||||
btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_closeButton = FMButton::btn(toolBar,
|
||||
toolBarLayout,
|
||||
"title_close",
|
||||
FMS::txt("close"),
|
||||
btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
LAYOUT_SPACE(toolBarLayout,8,0);
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
|
||||
RMLanguage* lng = RMLanguage::instance();
|
||||
lng->appendENGToolTip(_minimizeButton,"Minimize");
|
||||
//#if !defined(MODEL_WATEX) // WATEX 는 전체화면 툴바에 있음
|
||||
// lng->appendENGToolTip(_fullScreenButton,"Full Screen");
|
||||
//#endif
|
||||
lng->appendENGToolTip(_closeButton,"Exit");
|
||||
#endif
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
#if !(SETUP_ONLY_BUILD)
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
#endif //
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
#if !(REMOVE_REPORT)
|
||||
_reportShortcut = new QShortcut(QKeySequence(Qt::Key_F3), this);
|
||||
_reportShortcut->setContext(Qt::ApplicationShortcut);
|
||||
#endif
|
||||
_settingsShortcut = new QShortcut(QKeySequence(Qt::Key_F6), this);
|
||||
_settingsShortcut->setContext(Qt::ApplicationShortcut);
|
||||
|
||||
_infoShortcut = new QShortcut(QKeySequence(Qt::Key_F7), this);
|
||||
_infoShortcut->setContext(Qt::ApplicationShortcut);
|
||||
|
||||
_captureShortcut = new QShortcut(QKeySequence(Qt::Key_F5), this);
|
||||
_captureShortcut->setContext(Qt::ApplicationShortcut);
|
||||
_captureShortcut->setEnabled(false);
|
||||
#endif
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
// WFF_800C
|
||||
#if !(REMOVE_REPORT)
|
||||
lng->appendENGToolTip(_reportButton,"Report");
|
||||
#endif
|
||||
lng->appendENGToolTip(_settingsButton,"Settings");
|
||||
lng->appendENGToolTip(_infoButton,"Info");
|
||||
lng->appendENGToolTip(_captureButton,"Capture");
|
||||
#endif
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#endif // #if (RM_MODEL_EMT_KR)
|
||||
|
||||
#if(PROFILE_BUILD)
|
||||
setStyleSheet("FMFrameTitle{ background-color: #007a0c;}");
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
#endif // PROFILE_BUILD
|
||||
}
|
||||
|
||||
#if (USER_LOGER)
|
||||
void FMFrameTitle::_clearClickTimer()
|
||||
{
|
||||
if(_clickReset != NULL)
|
||||
{
|
||||
_clickReset->stop();
|
||||
delete _clickReset;
|
||||
_clickReset = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void FMFrameTitle::onVersion()
|
||||
{
|
||||
if(_clickCount == 0) {
|
||||
_clearClickTimer();
|
||||
_clickReset = new QTimer(this);
|
||||
_clickReset->setSingleShot(true);
|
||||
_clickReset->setInterval(2000);
|
||||
connect(_clickReset,SIGNAL(timeout()),SLOT(onClickReset()));
|
||||
_clickReset->start();
|
||||
}
|
||||
_clickCount += 1;
|
||||
// 토글
|
||||
if(_clickCount == 5) {
|
||||
RMApp::userLog = !RMApp::userLog;
|
||||
_clickCount = 0;
|
||||
if(RMApp::userLog) {
|
||||
_versionLabel->setStyleSheet("font-family: Fixedsys;color : #FF0000");
|
||||
} else {
|
||||
_versionLabel->setStyleSheet("font-family: Fixedsys;color : #FFFFFF");
|
||||
}
|
||||
RMApp::instance()->userLogs.clear();
|
||||
_clearClickTimer();
|
||||
}
|
||||
}
|
||||
void FMFrameTitle::onClickReset() {
|
||||
_clickCount = 0;
|
||||
_clearClickTimer();
|
||||
}
|
||||
|
||||
#endif // #if (USER_LOGER)
|
||||
void FMFrameTitle::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
#if !(SETUP_ONLY_BUILD)
|
||||
void FMFrameTitle::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if (USE_FILE_NAME_TITLE)
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
_fileNameTitle->setText(item->anyFilePath());
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED) {
|
||||
_fileNameTitle->setText("");
|
||||
}
|
||||
#endif // USE_FILE_NAME_TITLE
|
||||
|
||||
#if (PLAY_CONTINUE_EVENT)
|
||||
// 로딩...등 다음파일 플레이시 변화 없도록 처리
|
||||
if(event == PLAY_DID_CLEARED && (item != NULL || RMPlayProcess::instance()->isLoadingNextFile()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
||||
if(event == PLAY_DID_LOADED || event == PLAY_DID_CLEARED || event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
#if (SUPPORT_AVI_SPLIT)
|
||||
_btnExport->setEnabled(event == PLAY_DID_LOADED && item !=NULL && (QFileInfo(item->anyFilePath()).suffix().toUpper() == "AVI"));
|
||||
#endif // SUPPORT_AVI_SPLIT
|
||||
#if (SPLIT_MULTI_TRACK_VIDEO)
|
||||
_btnExport->setEnabled(event == PLAY_DID_LOADED && item !=NULL);
|
||||
#endif // SPLIT_MULTI_TRACK_VIDEO
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
#if !(REMOVE_REPORT)
|
||||
_reportButton->setEnabled(event == PLAY_DID_LOADED);
|
||||
#endif
|
||||
_captureButton->setEnabled(event == PLAY_DID_LOADED);
|
||||
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
#if !(REMOVE_REPORT)
|
||||
_reportShortcut->setEnabled(event == PLAY_DID_LOADED);
|
||||
#endif
|
||||
_captureShortcut->setEnabled(event == PLAY_DID_LOADED);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
}
|
||||
#endif // #if !(SETUP_ONLY_BUILD)
|
||||
|
||||
#if (DUAL_VIEWER)
|
||||
void TitleWidget::onMap()
|
||||
{
|
||||
//qInfo() << "size:" << _videoWidget->size();
|
||||
if(RMDialogMap::instance()->isHiddenReal()) {
|
||||
RMDialogMap::instance()->show();
|
||||
RMDialogMap::instance()->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
RMDialogMap::instance()->onClose();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && (!FIXED_ENGLISH))
|
||||
void FMFrameTitle::onLanguage()
|
||||
{
|
||||
#if (FORCE_FM_STRING)
|
||||
#if (SUPPORT_LANGUAGE_INSERT)
|
||||
FMS::insert_if_not_exist(1,"select_language",FM_WSTR(L"언어선택"));
|
||||
FMS::insert_if_not_exist(2,"select_language",FM_WSTR(L"言語選択"));
|
||||
FMS::insert_if_not_exist(3,"select_language",FM_WSTR(L"Select a language"));
|
||||
#endif // SUPPORT_LANGUAGE_INSERT
|
||||
QString title = FMS::txt("select_language");
|
||||
#else
|
||||
QString title = RMLanguage::isJP() ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e") : "Select a language";
|
||||
#endif
|
||||
//qInfo() << title << __FUNCTION__;
|
||||
RMPopup* dialog = new RMPopup(this,title);
|
||||
dialog->createLanguageLayout();
|
||||
if(dialog->exec())
|
||||
{
|
||||
int index = RMPopup::languageIndex;
|
||||
RMLanguage::LANGUAGE_TYPE type = RMLanguage::LANGUAGE_JP;
|
||||
if(index == 0)
|
||||
{
|
||||
RMLanguage::isAuto = true;
|
||||
type = RMLanguage::systemLanguage();
|
||||
RMSettings::instance()->setAutoLanguage(true);
|
||||
}
|
||||
#if (RC_LANGUAGE == 0x0412)
|
||||
else if(index == 1) // KR
|
||||
{
|
||||
RMLanguage::isAuto = false;
|
||||
type = RMLanguage::LANGUAGE_KR;
|
||||
RMSettings::instance()->setAutoLanguage(false);
|
||||
}
|
||||
#endif // #if (RC_LANGUAGE == 0x0412)
|
||||
else if(index == 2) // JP
|
||||
{
|
||||
RMLanguage::isAuto = false;
|
||||
type = RMLanguage::LANGUAGE_JP;
|
||||
RMSettings::instance()->setAutoLanguage(false);
|
||||
}
|
||||
#if !(LANGUAGE_REMOVE_ENG)
|
||||
else if(index == 3) // EN
|
||||
{
|
||||
RMLanguage::isAuto = false;
|
||||
type = RMLanguage::LANGUAGE_EN;
|
||||
RMSettings::instance()->setAutoLanguage(false);
|
||||
}
|
||||
#endif // MODEL_WATEX
|
||||
//qInfo() << "onLanguageSelected:" << type << index;
|
||||
if(RMLanguage::instance()->language() != type)
|
||||
{
|
||||
RMLanguage::instance()->setLanguage(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void FMFrameTitle::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
if(event == RMApp::WillFullScreen) {
|
||||
#if (USE_MAXIMIZE)
|
||||
maximizeButton->setToolTip(FMS::txt("restore_window"));
|
||||
if(param == 1) {
|
||||
maximizeButton->setChecked(true);
|
||||
}
|
||||
else {
|
||||
setHidden(true);
|
||||
}
|
||||
#else // USE_MAXIMIZE
|
||||
Q_UNUSED(param)
|
||||
setHidden(true);
|
||||
#endif // USE_MAXIMIZE
|
||||
}
|
||||
else if (event == RMApp::WillNormalScreen) {
|
||||
#if (USE_MAXIMIZE)
|
||||
maximizeButton->setToolTip(FMS::txt("maximize"));
|
||||
maximizeButton->setChecked(false);
|
||||
#endif
|
||||
setHidden(false);
|
||||
}
|
||||
}
|
||||
#if (USE_JP_ADDRESS_TOOL)
|
||||
void FMFrameTitle::onAddressTool() {
|
||||
|
||||
if(FMAddress::instance()->open()) {
|
||||
QStringList res;
|
||||
FMAddress::instance()->search(136.033182,35.380830,res,100);
|
||||
qInfo() << res;
|
||||
}
|
||||
// ,
|
||||
// FMAddress add;
|
||||
// add.convert("C://home//roadmovie//script//jpaddr//type_1_from_db//ADDR_2TH.csv",
|
||||
// "C://home//roadmovie//script//jpaddr//20210120_jp_addr.bin");
|
||||
// add.open("C://home//roadmovie//script//jpaddr//20210120_jp_addr.bin");
|
||||
// add.verify("C://home//roadmovie//script//jpaddr//type_1_from_db//ADDR_2TH.csv"); // 검증
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
113
project/fm_viewer/ui/fm_frame_title.h
Normal file
113
project/fm_viewer/ui/fm_frame_title.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#ifndef FM_FRAME_TITLE_H
|
||||
#define FM_FRAME_TITLE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QShortcut>
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
//#include "rm_button.h"
|
||||
|
||||
#include "../fm_event_types.h"
|
||||
|
||||
class RMVideoItem;
|
||||
class FMButton;
|
||||
|
||||
#if (USER_LOGER)
|
||||
class FMClickLabel;
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
class FMClickURLLabel;
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
class FMFrameTitle: public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMFrameTitle(QWidget *parent = nullptr, QString title = "", QString icon = "");
|
||||
|
||||
#if (USE_JP_ADDRESS_TOOL)
|
||||
FMButton* _toolButton; // 테스트/변환툴
|
||||
#endif
|
||||
|
||||
#if (SUPPORT_AVI_SPLIT || SPLIT_MULTI_TRACK_VIDEO)
|
||||
FMButton* _btnExport; // 2CH 파일 분할
|
||||
#endif
|
||||
|
||||
FMButton* _settingsButton; // 설정 (단말기)
|
||||
|
||||
#if (USER_LOGER)
|
||||
int _clickCount;
|
||||
FMClickLabel* _versionLabel;
|
||||
QTimer* _clickReset;
|
||||
void _clearClickTimer();
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
QLabel* _modelInfo; // 제품 모델명
|
||||
#endif // #if (RM_MODEL_EMT_KR)
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
FMButton* _reportButton; // 보고서 생성
|
||||
FMButton* _captureButton; // 화면 캡춰
|
||||
FMButton* _infoButton; // S/W 정보 보기
|
||||
#if !(RM_MODEL_EMT_KR)
|
||||
FMButton* _languageButton; // 언어 변경
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
#if !(TOGGLE_PLAYER || DO_NOT_USE_MAP)
|
||||
FMButton* _mapButton; // 지도 표시
|
||||
#endif
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
#if (USE_GOOGLE_MAP_AND_OSM)
|
||||
FMButton* _mapOSMButton; // 지도 표시 (OSM)
|
||||
#endif // USE_GOOGLE_MAP_AND_OSM
|
||||
|
||||
FMButton* _minimizeButton; // 윈도우 축소
|
||||
FMButton* _closeButton; // 윈도우 닫기
|
||||
#if (USE_FILE_NAME_TITLE)
|
||||
QLabel* _fileNameTitle;
|
||||
#endif
|
||||
#if (USE_MAXIMIZE)
|
||||
FMButton* maximizeButton;
|
||||
#endif
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
QShortcut* _reportShortcut;
|
||||
QShortcut* _settingsShortcut;
|
||||
QShortcut* _infoShortcut;
|
||||
QShortcut* _captureShortcut;
|
||||
#endif // REMOVE_ALL_SHORT_CUTS
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
QHBoxLayout* _layout;
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
FMClickURLLabel* _titleLabel;
|
||||
#else // RM_MODEL_EMT_KR
|
||||
QLabel* _titleLabel;
|
||||
#endif //RM_MODEL_EMT_KR
|
||||
|
||||
// QWidget* _toolBar;
|
||||
// QHBoxLayout* _toolBarLayout;
|
||||
private:
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
static void _addSpacer(QHBoxLayout* layout, int width);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
#if (USE_JP_ADDRESS_TOOL)
|
||||
void onAddressTool();
|
||||
#endif
|
||||
void onLanguage();
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
#if (USER_LOGER)
|
||||
void onClickReset();
|
||||
void onVersion();
|
||||
#endif // #if (USER_LOGER)
|
||||
};
|
||||
#endif // FM_FRAME_TITLE_H
|
||||
30
project/fm_viewer/ui/fm_label_click.cpp
Normal file
30
project/fm_viewer/ui/fm_label_click.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
#include "fm_label_click.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
FMClickLabel::FMClickLabel(QWidget* parent, Qt::WindowFlags f)
|
||||
: QLabel(parent)
|
||||
{
|
||||
Q_UNUSED(f)
|
||||
|
||||
}
|
||||
FMClickLabel::~FMClickLabel() {}
|
||||
|
||||
void FMClickLabel::mouseReleaseEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event)
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
FMClickURLLabel::FMClickURLLabel(QString url, QWidget* parent, Qt::WindowFlags f)
|
||||
: FMClickLabel(parent,f){
|
||||
setMouseTracking(true);
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
_url = url;
|
||||
}
|
||||
FMClickURLLabel::~FMClickURLLabel() {}
|
||||
|
||||
void FMClickURLLabel::mouseReleaseEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event)
|
||||
QDesktopServices::openUrl(QUrl(_url));
|
||||
}
|
||||
34
project/fm_viewer/ui/fm_label_click.h
Normal file
34
project/fm_viewer/ui/fm_label_click.h
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef FM_LABEL_CLICK_H
|
||||
#define FM_LABEL_CLICK_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class FMClickLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMClickLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~FMClickLabel();
|
||||
signals:
|
||||
void clicked();
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
};
|
||||
|
||||
class FMClickURLLabel : public FMClickLabel
|
||||
{
|
||||
public:
|
||||
explicit FMClickURLLabel(QString url, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~FMClickURLLabel();
|
||||
protected:
|
||||
QString _url;
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
};
|
||||
|
||||
#endif // FM_LABEL_CLICK_H
|
||||
120
project/fm_viewer/ui/fm_layer.cpp
Normal file
120
project/fm_viewer/ui/fm_layer.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
#include "fm_layer.h"
|
||||
#include <QDebug>
|
||||
|
||||
void FMWidgetBorder(QWidget* w,const char* name, int c) {
|
||||
|
||||
w->setObjectName(name);
|
||||
QString color = QString().sprintf("#%06X",c);
|
||||
QString style = "QWidget#%name%{border: 1px solid %color%;}";
|
||||
w->setStyleSheet(style.replace("%name%",name).replace("%color%",color));
|
||||
}
|
||||
void FMWidgetBackground(QWidget* w,const char* name, int c)
|
||||
{
|
||||
// background-color: #818181;
|
||||
w->setObjectName(name);
|
||||
QString color = QString().sprintf("#%06X",c);
|
||||
QString style = "QWidget#%name%{background-color: %color%;}";
|
||||
w->setStyleSheet(style.replace("%name%",name).replace("%color%",color));
|
||||
}
|
||||
void FMWidgetBorderBackground(QWidget* w,const char* name, int clBack, int clBorder) {
|
||||
|
||||
w->setObjectName(name);
|
||||
QString bg = QString().sprintf("#%06X",clBack);
|
||||
QString border = QString().sprintf("#%06X",clBorder);
|
||||
QString style = "QWidget#%name%{border: 1px solid %border%;background-color: %bg%;}";
|
||||
w->setStyleSheet(style.replace("%name%",name).replace("%border%",border).replace("%bg%",bg));
|
||||
}
|
||||
void FMWidgetBottomBorderBackground(QWidget* w,const char* name, int clBack, int clBorder)
|
||||
{
|
||||
w->setObjectName(name);
|
||||
QString bg = QString().sprintf("#%06X",clBack);
|
||||
QString border = QString().sprintf("#%06X",clBorder);
|
||||
QString style = "QWidget#%name%{border: 1px solid %border%;border-left: none;border-right: none;border-top: none;background-color: %bg%;}";
|
||||
w->setStyleSheet(style.replace("%name%",name).replace("%border%",border).replace("%bg%",bg));
|
||||
}
|
||||
void FMLabel(QLabel* lb,const char* name, const char* font,int c, int size, bool bold)
|
||||
{
|
||||
lb->setObjectName(name);
|
||||
QString color = QString().sprintf("#%06X",c);
|
||||
QString style = "QLabel#%name%{font-family: %font%;color : %color%;font-size: %size%px;font-weight: %weight%;}";
|
||||
lb->setStyleSheet(style.replace("%name%",name).
|
||||
replace("%color%",color).
|
||||
replace("%font%",font).
|
||||
replace("%size%",QString::number(size)).
|
||||
replace("%weight%",bold ? "bold" : "normal"));
|
||||
}
|
||||
void FMLabelBackground(QLabel* lb,const char* name, const char* font,int c, int size, bool bold, int bg)
|
||||
{
|
||||
lb->setObjectName(name);
|
||||
QString color = QString().sprintf("#%06X",c);
|
||||
QString background = QString().sprintf("#%06X",bg);
|
||||
QString style = "QLabel#%name%{font-family: %font%;color : %color%;font-size: %size%px;font-weight: %weight%;background-color: %bg%;border-radius: 3px;}";
|
||||
lb->setStyleSheet(style.replace("%name%",name).
|
||||
replace("%bg%",background).
|
||||
replace("%color%",color).
|
||||
replace("%font%",font).
|
||||
replace("%size%",QString::number(size)).
|
||||
replace("%weight%",bold ? "bold" : "normal"));
|
||||
}
|
||||
void FMSlider(QSlider* sl,const char* name,int cp, int cb,bool small)
|
||||
{
|
||||
sl->setFixedHeight(small ? 14 : 18);
|
||||
sl->setObjectName(name);
|
||||
// LEFT BAR = sub-page:horizontal
|
||||
// RIGHT BAR = add-page:horizontal
|
||||
// border: 1px solid red;
|
||||
// margin: 7px 0px 7px 0px;
|
||||
// margin: 7px 0px 7px 0px;
|
||||
|
||||
const QString knobName = small ? "slider_knob_small" : "slider_knob";
|
||||
const QString border = small ? "6" : "7";
|
||||
const QString height = small ? "2" : "4";
|
||||
|
||||
// margin: top, left???
|
||||
QString style = "\
|
||||
QSlider#%name%\
|
||||
{\
|
||||
}\
|
||||
QSlider#%name%::groove:horizontal\
|
||||
{\
|
||||
border: %border%px;\
|
||||
height: %height%px;\
|
||||
}\
|
||||
QSlider#%name%::sub-page:horizontal\
|
||||
{\
|
||||
background: %color_cp%;\
|
||||
}\
|
||||
QSlider#%name%::add-page:horizontal\
|
||||
{\
|
||||
background: %color_cb%;\
|
||||
}\
|
||||
QSlider#%name%::handle:horizontal\
|
||||
{\
|
||||
image: url(:/image/%knob%.png);\
|
||||
margin: -%border%px -0px -%border%px -0px;\
|
||||
}\
|
||||
QSlider#%name%::handle:horizontal:hover:!pressed\
|
||||
{\
|
||||
image: url(:/image/%knob%_1.png);\
|
||||
margin: -%border%px -0px -%border%px -0px;\
|
||||
}\
|
||||
QSlider#%name%::handle:horizontal:pressed\
|
||||
{\
|
||||
image: url(:/image/%knob%_2.png);\
|
||||
margin: -%border%px -0px -%border%px -0px;\
|
||||
}\
|
||||
QSlider#%name%::handle:horizontal:disabled\
|
||||
{\
|
||||
image: url(:/image/%knob%_3.png);\
|
||||
margin: -%border%px -0px -%border%px -0px;\
|
||||
}";
|
||||
|
||||
sl->setStyleSheet(style.replace("%name%",name).
|
||||
replace("%knob%",knobName).
|
||||
replace("%border%",border).
|
||||
replace("%height%",height).
|
||||
replace("%color_cb%",QString().sprintf("#%06X",cb)).
|
||||
replace("%color_cp%",QString().sprintf("#%06X",cp)));
|
||||
}
|
||||
|
||||
//_paramTextEdit->setStyleSheet("font-family: Fixedsys;color : #00FF00;background-color: #111111;border:1px;border-style:solid;border-color:#313131;");
|
||||
37
project/fm_viewer/ui/fm_layer.h
Normal file
37
project/fm_viewer/ui/fm_layer.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef FM_LAYER_H
|
||||
#define FM_LAYER_H
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
|
||||
|
||||
|
||||
#define FM_COLOR_SET_NORMAL 0
|
||||
#define FM_COLOR_SET_PRESSED 1
|
||||
#define FM_COLOR_SET_HOVER 2
|
||||
#define FM_COLOR_SET_DISABLED 3
|
||||
#define FM_COLOR_SET_CHECKED 4
|
||||
#define FM_COLOR_SET_COUNT 5
|
||||
typedef int FM_COLOR_SET;
|
||||
//{
|
||||
// int normal;
|
||||
// int pressed;
|
||||
// int hover;
|
||||
// int disabled;
|
||||
// int checked;
|
||||
//} FM_COLOR_SET;
|
||||
|
||||
inline QString FMColor(int c) {
|
||||
return QString().sprintf("%06X",c);
|
||||
}
|
||||
|
||||
void FMWidgetBorder(QWidget* w,const char* name, int c);
|
||||
void FMLabel(QLabel* lb,const char* name, const char* font,int c, int size = 12, bool bold = false);
|
||||
void FMLabelBackground(QLabel* lb,const char* name, const char* font,int c, int size, bool bold, int bg);
|
||||
void FMWidgetBackground(QWidget* w,const char* name, int c);
|
||||
void FMWidgetBorderBackground(QWidget* w,const char* name, int clBack, int clBorder);
|
||||
void FMWidgetBottomBorderBackground(QWidget* w,const char* name, int clBack, int clBorder);
|
||||
|
||||
void FMSlider(QSlider* sl,const char* name,int cp, int cb, bool small = false);
|
||||
|
||||
#endif // FM_LAYER_H
|
||||
79
project/fm_viewer/ui/fm_logo_widget.cpp
Normal file
79
project/fm_viewer/ui/fm_logo_widget.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "fm_logo_widget.h"
|
||||
#include "../rm_include.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
FMLogoWidget::FMLogoWidget(bool bMain, QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
_bMain = bMain;
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
QString style = "FMLogoWidget {background-color: #101010;}";
|
||||
#else
|
||||
QString style = "FMLogoWidget {border-image: url(:/image/video_bg.png) 0 0 0 0 repeat repeat;}";
|
||||
#endif
|
||||
setStyleSheet(style);
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
_logo = new QLabel(this);
|
||||
#if !(NO_CAMERA_LOGO)
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
_logo->setPixmap( QPixmap(bMain ? ":/image/logo_front_big_nx.png" : ":/image/logo_rear_small_nx.png") );
|
||||
#else // FC_DR232W
|
||||
#if (NO_LOGO)
|
||||
#if (SUB_MODEL_KEIYO_360)
|
||||
_logo->setPixmap( QPixmap(bMain ? ":/image/logo_360_big.png" : ":/image/logo_wide_small.png") );
|
||||
#else // SUB_MODEL_KEIYO_360
|
||||
_logo->setPixmap( QPixmap(bMain ? ":/image/logo_front_big_wo_brand.png" : ":/image/logo_rear_small.png") );
|
||||
#endif // SUB_MODEL_KEIYO_360
|
||||
#else // NO_LOGO
|
||||
_logo->setPixmap( QPixmap(bMain ? ":/image/logo_front_big.png" : ":/image/logo_rear_small.png") );
|
||||
#endif
|
||||
#endif // FC_DR232W
|
||||
#endif // #if !(NO_CAMERA_LOGO)
|
||||
layout->addWidget(_logo);
|
||||
|
||||
}
|
||||
void FMLogoWidget::setStyle(bool front)
|
||||
{
|
||||
#if !(NO_CAMERA_LOGO)
|
||||
if(_bMain) {
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_front_big_nx.png" : ":/image/logo_rear_big_nx.png") );
|
||||
#else // FC_DR232W
|
||||
#if (NO_LOGO)
|
||||
#if (SUB_MODEL_KEIYO_360)
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_360_big.png" : ":/image/logo_wide_big.png") );
|
||||
#else // SUB_MODEL_KEIYO_360
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_front_big_wo_brand.png" : ":/image/logo_rear_big_wo_brand.png") );
|
||||
#endif // SUB_MODEL_KEIYO_360
|
||||
#else // NO_LOGO
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_front_big.png" : ":/image/logo_rear_big.png") );
|
||||
#endif // NO_LOGO
|
||||
#endif // FC_DR232W
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_front_small_nx.png" : ":/image/logo_rear_small_nx.png") );
|
||||
#else // RM_MODEL_TYPE_FC_DR232W
|
||||
#if (SUB_MODEL_KEIYO_360)
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_360_small.png" : ":/image/logo_wide_small.png") );
|
||||
#else // SUB_MODEL_KEIYO_360
|
||||
_logo->setPixmap( QPixmap(front ? ":/image/logo_front_small.png" : ":/image/logo_rear_small.png") );
|
||||
#endif // SUB_MODEL_KEIYO_360
|
||||
#endif // RM_MODEL_TYPE_FC_DR232W
|
||||
}
|
||||
#endif // #if !(NO_CAMERA_LOGO)
|
||||
}
|
||||
void FMLogoWidget::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
22
project/fm_viewer/ui/fm_logo_widget.h
Normal file
22
project/fm_viewer/ui/fm_logo_widget.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef FM_LOGO_WIDGET_H
|
||||
#define FM_LOGO_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
|
||||
class FMLogoWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMLogoWidget(bool bMain,QWidget *parent = nullptr);
|
||||
void setStyle(bool front);
|
||||
private:
|
||||
bool _bMain;
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
QLabel* _logo;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // FM_LOGO_WIDGET_H
|
||||
84
project/fm_viewer/ui/fm_speed_widget.cpp
Normal file
84
project/fm_viewer/ui/fm_speed_widget.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "fm_speed_widget.h"
|
||||
#include <QPainter.h>
|
||||
#include <QDebug>
|
||||
|
||||
FMSpeedWidget::FMSpeedWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
currentSpeed = -1;
|
||||
numberPixmap = QPixmap(":/image/num_15x25.png");
|
||||
barPixmapOn = QPixmap(":/image/speed_on.png");
|
||||
barPixmapOff = QPixmap(":/image/speed_off.png");
|
||||
}
|
||||
void FMSpeedWidget::updateSpeed(int speed)
|
||||
{
|
||||
currentSpeed = speed;
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void FMSpeedWidget::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QPainter painter(this);
|
||||
|
||||
int x = (rect().width()-barPixmapOn.size().width()) / 2;
|
||||
int y = (rect().height()-barPixmapOn.size().height()) / 2;
|
||||
painter.drawPixmap(x,y,currentSpeed >= 0 ? barPixmapOn : barPixmapOff);
|
||||
|
||||
|
||||
const int numWidth = 15;
|
||||
const int numHeight = 25;
|
||||
|
||||
int x0 = (rect().width()- (numWidth*3) ) / 2;
|
||||
int x1 = x0 + numWidth;
|
||||
int x2 = x1 + numWidth;
|
||||
y = 21;
|
||||
|
||||
int sx[4] = {0,};
|
||||
if(currentSpeed < 0)
|
||||
{
|
||||
sx[0] = sx[1] = sx[2] = numWidth * 10; // -
|
||||
}
|
||||
else {
|
||||
char cidx[4] = {0,};
|
||||
sprintf(cidx,"%03d",currentSpeed);
|
||||
sx[0] = (int)(cidx[0] - '0') * numWidth;
|
||||
sx[1] = (int)(cidx[1] - '0') * numWidth;
|
||||
sx[2] = (int)(cidx[2] - '0') * numWidth;
|
||||
}
|
||||
//inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
|
||||
// int sx, int sy, int sw, int sh)
|
||||
|
||||
painter.drawPixmap(x0,y,numberPixmap,sx[0],0,numWidth,numHeight);
|
||||
painter.drawPixmap(x1,y,numberPixmap,sx[1],0,numWidth,numHeight);
|
||||
painter.drawPixmap(x2,y,numberPixmap,sx[2],0,numWidth,numHeight);
|
||||
|
||||
|
||||
|
||||
//QPoint offset = QPoint(rect().width()-barPixmapOn.size().width())
|
||||
|
||||
//painter.drawPixmap(0,0,barPixmapOn.size().width(),barPixmapOn.size().height(), barPixmapOn);
|
||||
|
||||
// QStyleOption o;
|
||||
// o.initFrom(this);
|
||||
// QPainter p(this);
|
||||
// style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
|
||||
|
||||
// QPixmap indicatorPixmap;
|
||||
// painter->fillRect(option.rect,background);
|
||||
// QRect iconRect = option.rect;
|
||||
|
||||
// // 좌표 CONTROL 과 동일하게 처리 되어야 함
|
||||
// iconRect.setLeft(iconRect.left() + 7);
|
||||
// iconRect.setTop(iconRect.top() + 5);
|
||||
|
||||
// if (item->checked) {
|
||||
// indicatorPixmap = QPixmap(":/image/checkbox_checked.png");
|
||||
// }
|
||||
// else {
|
||||
// indicatorPixmap = QPixmap(":/image/checkbox_unchecked.png");
|
||||
// }
|
||||
//QApplication::style()->drawItemPixmap(painter, iconRect, 0, indicatorPixmap );
|
||||
|
||||
}
|
||||
24
project/fm_viewer/ui/fm_speed_widget.h
Normal file
24
project/fm_viewer/ui/fm_speed_widget.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef FM_SPEED_WIDGET_H
|
||||
#define FM_SPEED_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class FMSpeedWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMSpeedWidget(QWidget *parent = nullptr);
|
||||
void updateSpeed(int speed);
|
||||
private:
|
||||
int currentSpeed;
|
||||
QPixmap numberPixmap;
|
||||
QPixmap barPixmapOn;
|
||||
QPixmap barPixmapOff;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // FM_SPEED_WIDGET_H
|
||||
86
project/fm_viewer/ui/fm_systeminfo_dialog.cpp
Normal file
86
project/fm_viewer/ui/fm_systeminfo_dialog.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "fm_systeminfo_dialog.h"
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
#include <QPlainTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QSysInfo>
|
||||
#include <QStorageInfo>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
#include <QDateTime>
|
||||
#include <QCryptographicHash>
|
||||
#include "../core/rm_player.h"
|
||||
|
||||
FMSystemInfoDialog::FMSystemInfoDialog(QWidget *parent,Qt::WindowFlags f) : QDialog(parent,f)
|
||||
{
|
||||
setWindowTitle("SYSTEM INFO.");
|
||||
setFixedSize(600,300);
|
||||
|
||||
_layout = new QVBoxLayout(this);
|
||||
_layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
_layout->setMargin(0);
|
||||
_layout->setSpacing(0);
|
||||
|
||||
_text = new QPlainTextEdit(this);
|
||||
_text->setReadOnly(true);
|
||||
// color : #00FF00;background-color: #111111;border:1px;border-style:solid;border-color:#313131;
|
||||
_text->setStyleSheet("font-family: Fixedsys;");
|
||||
_text->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
|
||||
|
||||
_layout->addWidget(_text);
|
||||
|
||||
QString message;
|
||||
|
||||
message += ("DATETIME:" + QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss") + "\n");
|
||||
|
||||
message += ("WINDOWS:" + QSysInfo::prettyProductName() + " (" + QSysInfo::currentCpuArchitecture() + ")\n");
|
||||
message += ("KERNEL:" + QSysInfo::kernelType() + " VER " + QSysInfo::kernelVersion() + "\n");
|
||||
|
||||
QSettings settings("HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS", QSettings::NativeFormat);
|
||||
message += ("Manufacturer:" + settings.value("SystemManufacturer", "0").toString() + "\n");
|
||||
message += ("Product:" + settings.value("SystemProductName", "0").toString() + "\n");
|
||||
//message += ("Product:" + settings.value("BaseBoardProduct", "0").toString() + "\n");
|
||||
|
||||
QProcess process_system;
|
||||
QString system_output;
|
||||
QString cpuname = "wmic cpu get name";
|
||||
process_system.start(cpuname);
|
||||
process_system.waitForFinished();
|
||||
system_output = process_system.readAllStandardOutput().toUpper();
|
||||
|
||||
while(system_output.contains(" ")) {
|
||||
system_output = system_output.replace(" "," ");
|
||||
}
|
||||
message += ("CPU:" + system_output.replace("\n","").replace("\r","") + "\n");
|
||||
|
||||
QString gpuname = "wmic PATH Win32_videocontroller get VideoProcessor ";
|
||||
process_system.start(gpuname);
|
||||
process_system.waitForFinished();
|
||||
system_output = process_system.readAllStandardOutput();
|
||||
while(system_output.contains(" ")) {
|
||||
system_output = system_output.replace(" "," ");
|
||||
}
|
||||
message += ("GPU:" + system_output.replace("\n","").replace("\r","") + "\n");
|
||||
|
||||
message += "Audio Devices:\n";
|
||||
|
||||
QList<QAudioDeviceInfo> ls = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
foreach(QAudioDeviceInfo info, ls) {
|
||||
|
||||
message.append(" " + info.deviceName() + "\n");
|
||||
//qInfo() << info.deviceName() << __FUNCTION__;
|
||||
}
|
||||
message.append("Main Audio Device:" + QAudioDeviceInfo::defaultOutputDevice().deviceName() + "\n");
|
||||
|
||||
message.append("Audio API:" + RMPlayer::instance()->playerF()->audio()->backend() + "\n");
|
||||
message.append("Audio API Log:" + RMPlayer::instance()->playerF()->audio()->status() + "\n");
|
||||
|
||||
QString hash = QCryptographicHash::hash(message.toLocal8Bit(), QCryptographicHash::Md5).toHex();
|
||||
message.append("MD5:" + hash + "\n");
|
||||
|
||||
_text->appendPlainText(message);
|
||||
|
||||
}
|
||||
#endif // SYSTEM_INFO_DIALOG
|
||||
23
project/fm_viewer/ui/fm_systeminfo_dialog.h
Normal file
23
project/fm_viewer/ui/fm_systeminfo_dialog.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef FM_SYSTEMINFO_DIALOG_H
|
||||
#define FM_SYSTEMINFO_DIALOG_H
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
#include <QDialog>
|
||||
|
||||
class QPlainTextEdit;
|
||||
class QVBoxLayout;
|
||||
class FMSystemInfoDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QPlainTextEdit* _text;
|
||||
QVBoxLayout* _layout;
|
||||
public:
|
||||
explicit FMSystemInfoDialog(QWidget *parent = nullptr,Qt::WindowFlags f= Qt::WindowTitleHint | Qt::Dialog | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
#endif // SYSTEM_INFO_DIALOG
|
||||
|
||||
#endif // FM_SYSTEMINFO_DIALOG_H
|
||||
714
project/fm_viewer/ui/fm_thumbnail_dialog.cpp
Normal file
714
project/fm_viewer/ui/fm_thumbnail_dialog.cpp
Normal file
@@ -0,0 +1,714 @@
|
||||
#include "fm_thumbnail_dialog.h"
|
||||
//#include "fm_thumbnail.h"
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#include <QFileInfo>
|
||||
#include <QGridLayout>
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../core/rm_math.h"
|
||||
#include "fm_button.h"
|
||||
#include <QLabel>
|
||||
#include <QRunnable>
|
||||
#include <QScrollArea>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QDir>
|
||||
|
||||
#include <QShortcut>
|
||||
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <QtConcurrent>
|
||||
#if (DETECT_USB_CHANGE)
|
||||
#include "../core/rm_usb.h"
|
||||
#endif // #if (DETECT_USB_CHANGE)
|
||||
|
||||
int g_thumbnail_dialog_width = 814;
|
||||
int g_thumbnail_dialog_height = 600;
|
||||
int g_thumbnail_column_count = 4;
|
||||
const int g_thumbnail_row_count = 4; // 표시 줄...
|
||||
const int g_thumbnail_title_height = 22; // 타이틀 높이
|
||||
const int g_thumbnail_width = 200;
|
||||
const int g_thumbnail_height = (int)((double)g_thumbnail_width / 480.0 * 320.0);
|
||||
const int g_thumbnail_border_size = 4; // 선택영역 처리 ETC
|
||||
const bool g_dual_ch_thumbnail = true; // 전후방 모두 처리
|
||||
//const int td_width = 1024;
|
||||
|
||||
#if (USE_DATE_FILTER)
|
||||
QStringList FMThumbnailDialog::_files = QStringList();
|
||||
#endif // #if (USE_DATE_FILTER)
|
||||
|
||||
#if (USE_1HOUR_FILTER)
|
||||
QList<QPair<QString,QString>> FMThumbnailDialog::_thumbnails = QList<QPair<QString,QString>>();
|
||||
QList<RMVideoItem*> FMThumbnailDialog::_items = QList<RMVideoItem*>();
|
||||
#endif
|
||||
|
||||
QRect rectAspectFit(QRect src,int w, int h) {
|
||||
int l = src.left();
|
||||
int t = src.top();
|
||||
if(src.width() > w )
|
||||
{
|
||||
l += (src.width() - w) / 2;
|
||||
}
|
||||
if(src.height() > h )
|
||||
{
|
||||
t += (src.height() - h) / 2;
|
||||
}
|
||||
return QRect(l,t,w,h);
|
||||
}
|
||||
|
||||
FM_COLOR_SET g_thumb_button_colors[5] = {
|
||||
0x595959, // normal
|
||||
0x2e2e2e, // pressed
|
||||
0x343434, // hover
|
||||
0x595959, // disabled
|
||||
0x3a3a3a, // checked
|
||||
};
|
||||
|
||||
|
||||
void FMThumbnailDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
// accept, reject 호출되지 않음
|
||||
//qInfo() << playItems << __FUNCTION__;
|
||||
selectedItem = NULL;
|
||||
if(FMThumbnailLoader::bRunning) {
|
||||
FMThumbnailLoader::bStop = true;
|
||||
event->ignore();
|
||||
#if !(THUMBNAIL_ITEM_CONNECT_EACH)
|
||||
for(int i=0;i<_items.size();i++) {
|
||||
disconnect(_items.at(i),SIGNAL(thumnbnailsLoaded(RMVideoItem*)),this,SLOT(onThumbnailLoaded(RMVideoItem*)));
|
||||
// for(int j=0;j<_items.at(i)->thumbnails.size();j++)
|
||||
// {
|
||||
// FMThumbnail* thumbnail = _items.at(i)->thumbnails.at(j);
|
||||
// total += thumbnail->size;
|
||||
// delete _items.at(i)->thumbnails.at(j);
|
||||
// }
|
||||
// _items.at(i)->thumbnails.clear();
|
||||
}
|
||||
#endif // THUMBNAIL_ITEM_CONNECT_EACH
|
||||
|
||||
// 강제 종료 후 연결
|
||||
FMThumbnailSignal::instance()->mode = FMThumbnailSignal::MODE_REJECT; // 종료 모드
|
||||
connect(FMThumbnailSignal::instance(),SIGNAL(finished()),SLOT(onProcessFinished()));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
#if (USE_DATE_FILTER)
|
||||
FMThumbnailDialog::FMThumbnailDialog(QWidget *parent, QString folder) : QDialog(parent,Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
#else // USE_DATE_FILTER
|
||||
FMThumbnailDialog::FMThumbnailDialog(QWidget *parent, bool bAll) : QDialog(parent,Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
#endif // USE_DATE_FILTER
|
||||
{
|
||||
_bFirst = false;
|
||||
_mode = MODE_SIMPLE;
|
||||
#if (USE_DATE_FILTER)
|
||||
_folder = folder;
|
||||
#endif
|
||||
|
||||
|
||||
if( RMApp::instance()->pMainWindow->isFullScreen()) {
|
||||
int maxWidth = RMApp::instance()->pMainWindow->width() - 360;
|
||||
g_thumbnail_column_count = (maxWidth / 400) * 2;
|
||||
g_thumbnail_dialog_width = (g_thumbnail_column_count * 200) + 14;
|
||||
g_thumbnail_dialog_height = RMApp::instance()->pMainWindow->height() - 240;
|
||||
qInfo() << g_thumbnail_dialog_width << g_thumbnail_column_count << __FUNCTION__;
|
||||
} else {
|
||||
g_thumbnail_dialog_width = 814;
|
||||
g_thumbnail_dialog_height = 600;
|
||||
g_thumbnail_column_count = 4;
|
||||
}
|
||||
|
||||
//qInfo() << "isMaximized:" << RMApp::instance()->pMainWindow->isFullScreen() << __FUNCTION__;
|
||||
|
||||
setFixedWidth(g_thumbnail_dialog_width+5);
|
||||
resize(g_thumbnail_dialog_width+5,g_thumbnail_dialog_height);
|
||||
|
||||
QVBoxLayout* l = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(l);
|
||||
|
||||
QWidget* top = new QWidget(this);
|
||||
top->setStyleSheet("background-color: #595959;");
|
||||
top->setFixedHeight(40);
|
||||
l->addWidget(top);
|
||||
QHBoxLayout* topL = new QHBoxLayout(top);
|
||||
ZERO_LAYOUT(topL);
|
||||
_titleBar = new QLabel(top);
|
||||
_titleBar->setAlignment(Qt::AlignCenter);
|
||||
_titleBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
_titleBar->setStyleSheet("font-family: Malgun Gothic;font-size: 16px; color : #FFFFFF;");
|
||||
topL->addWidget(_titleBar);
|
||||
//_titleBar->setText(FM_WSTR(L"1시간 대표 이미지"));
|
||||
|
||||
_backButton = FMButton::btnType0(top,topL,"thumbnail_back",FM_WSTR(L"1시간 리스트로 돌아가기"),QSize(40,40),g_thumb_button_colors);
|
||||
_backButton->setHidden(true);
|
||||
//l->addWidget(_backButton);
|
||||
connect(_backButton,SIGNAL(clicked()),this,SLOT(onBack()));
|
||||
|
||||
_tableView = new QTableWidget(this);
|
||||
_tableView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
_tableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
_tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
_tableView->verticalHeader()->hide();
|
||||
_tableView->horizontalHeader()->hide();
|
||||
|
||||
_tableView->verticalHeader()->setDefaultSectionSize(g_thumbnail_height + g_thumbnail_title_height);
|
||||
_tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||
_tableView->horizontalHeader()->setDefaultSectionSize(g_thumbnail_width);
|
||||
_tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||
_tableView->setAttribute(Qt::WA_Hover);
|
||||
_tableView->viewport()->setAttribute(Qt::WA_Hover);
|
||||
_tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
_tableView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||
_tableView->setShowGrid(false);
|
||||
_tableView->setObjectName("thumbnail");
|
||||
_tableView->setStyleSheet("QTableWidget#thumbnail{background-color: #333333;}");
|
||||
|
||||
_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
|
||||
_delegate = new FMThumbnailDelegate(this);
|
||||
//_tableView->setItemDelegate(_delegate);
|
||||
|
||||
l->addWidget(_tableView);
|
||||
|
||||
// 배경색만 바꿈..
|
||||
connect(_tableView->selectionModel(),SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),this,SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
|
||||
|
||||
createLayout(MODE_SIMPLE);
|
||||
|
||||
connect(thumbnail_cache::instance(),SIGNAL(thumbnailLoaded(int)),this,SLOT(onThumbnailUpdated(int)));
|
||||
|
||||
if(bAll) {
|
||||
_mode = MODE_SUB;
|
||||
}
|
||||
|
||||
QTimer::singleShot(100,Qt::PreciseTimer,this,SLOT(onLoadThumbnails()));
|
||||
|
||||
connect(_tableView, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(onDoubleClickItem(int,int)));
|
||||
|
||||
#if (DETECT_USB_CHANGE)
|
||||
connect(RMApp::instance()->usb,SIGNAL(usbChanged(bool,QString&)),SLOT(onUSBChange(bool,QString&)));
|
||||
#endif // DETECT_USB_CHANGE
|
||||
|
||||
}
|
||||
#if (DETECT_USB_CHANGE)
|
||||
void FMThumbnailDialog::onUSBChange(bool inserted, QString& drive)
|
||||
{
|
||||
// 제거시 리스트 삭제
|
||||
if(!inserted && drive.toUpper() == _usb->_openDrive) {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
#endif // #if (DETECT_USB_CHANGE)
|
||||
void FMThumbnailDialog::showEvent(QShowEvent * event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
_tableView->setItemDelegate(_delegate);
|
||||
}
|
||||
void FMThumbnailDialog::onThumbnailUpdated(int index)
|
||||
{
|
||||
int row_start = qMax(_tableView->verticalHeader()->visualIndexAt(0), 0);
|
||||
int row_end = _tableView->verticalHeader()->visualIndexAt(_tableView->verticalHeader()->height());
|
||||
if(row_end == -1) {
|
||||
row_end = _tableView->rowCount() - 1;
|
||||
}
|
||||
|
||||
if (index >= row_start && index <= row_end) {
|
||||
_tableView->viewport()->update();
|
||||
//qInfo() << "row_start:" << row_start << index << "row_end:" << row_end << "loaded";
|
||||
}
|
||||
}
|
||||
void FMThumbnailDialog::scrollTo()
|
||||
{
|
||||
if(_lastIndex.isValid()) {
|
||||
_tableView->setItemDelegate(_delegate);
|
||||
_tableView->scrollTo(_lastIndex); // ,QTableView::PositionAtTop
|
||||
_lastIndex = QModelIndex();
|
||||
}
|
||||
}
|
||||
void FMThumbnailDialog::onDoubleClickItem(int row, int column)
|
||||
{
|
||||
if(_mode == MODE_SIMPLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
int idx = ((row * g_thumbnail_column_count) + column) / 2;
|
||||
bool ch1 = column % 2 == 0;// ? " - [CH1]" : " - [CH2]";
|
||||
selectedFile = _items.at(idx)->filePath;// ch1 ? FMThumbnailDialog::_thumbnails.at(idx).first : FMThumbnailDialog::_thumbnails.at(idx).second;
|
||||
accept();
|
||||
//qInfo() << "idx:" << idx << selectedFile << __FUNCTION__;
|
||||
}
|
||||
void FMThumbnailDialog::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||
{
|
||||
//qInfo() << __FUNCTION__;
|
||||
|
||||
QModelIndex index = selected.indexes().first();
|
||||
int idx = ((index.row() * g_thumbnail_column_count) + index.column()) / 2;
|
||||
// bool ch1 = index.column() % 2 == 0;// ? " - [CH1]" : " - [CH2]"; // 더블클릭 재생으로 이동
|
||||
#if (USE_DATE_FILTER)
|
||||
selectedFile = FMThumbnailDialog::_files.at((idx * 2) + (ch1 ? 0 : 1));
|
||||
accept();
|
||||
#endif // USE_DATE_FILTER
|
||||
|
||||
#if (USE_1HOUR_FILTER)
|
||||
if (FMThumbnailDialog::_thumbnails.size() <= idx) {
|
||||
return;
|
||||
}
|
||||
if(_mode == MODE_SIMPLE) {
|
||||
RMVideoItem* item = FMThumbnailDialog::_items.at(idx);
|
||||
_selectedDateTime = item->startTime();
|
||||
_mode = MODE_SUB;
|
||||
onLoadThumbnails();
|
||||
_tableView->setEnabled(false);
|
||||
QTimer::singleShot(300,Qt::PreciseTimer,this,SLOT(onEnableClick()));
|
||||
} else {
|
||||
// 더블클릭 재생으로 변경
|
||||
//selectedFile = ch1 ? FMThumbnailDialog::_thumbnails.at(idx).first : FMThumbnailDialog::_thumbnails.at(idx).second;
|
||||
//accept();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void FMThumbnailDialog::onEnableClick()
|
||||
{
|
||||
_tableView->setEnabled(true);
|
||||
}
|
||||
void FMThumbnailDialog::createLayout(MODE mode,RMVideoItem* selected)
|
||||
{
|
||||
}
|
||||
#if (USE_DATE_FILTER)
|
||||
void FMThumbnailDialog::loadThumbnails(QString folder)
|
||||
{
|
||||
thumbnail_cache::instance()->clear();
|
||||
QDir dir(folder);
|
||||
dir.setFilter(QDir::Dirs);
|
||||
foreach (const QString& eachFolder, dir.entryList()) {
|
||||
|
||||
if(eachFolder == "." || eachFolder == "..")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 폴더는 탐색
|
||||
QString fullPath = QDir::cleanPath(folder + PATH_COMPONENT + eachFolder);
|
||||
loadThumbnails(fullPath);
|
||||
}
|
||||
|
||||
QDir dirFile(folder);
|
||||
dirFile.setNameFilters(QList<QString>() << QString("*.JPG"));
|
||||
QStringList allFiles = dirFile.entryList();
|
||||
foreach (const QString& eachFile, allFiles) {
|
||||
//QDateTime dateTime;
|
||||
QString fullPath = QDir::cleanPath(folder + PATH_COMPONENT + eachFile);
|
||||
|
||||
QRegExp regexp("[0-9]{8}-[0-9]{6}_(?:REC|MOT|PSR|EVT)[0,1,2]_[0-9]{4}_[0-9]{1}.jpg"); // $
|
||||
//QRegExp regexp("[0-9]{8}-[0-9]{6}_(?:REC|EVT)_[0-9]{4}_[0-9]{1}.jpg"); // $
|
||||
if(regexp.exactMatch(eachFile)) {
|
||||
_files.append(fullPath);
|
||||
//qInfo() << eachFile << __FUNCTION__;
|
||||
}
|
||||
}
|
||||
}
|
||||
void FMThumbnailDialog::onLoadThumbnails()
|
||||
{
|
||||
_files.clear();
|
||||
_tableView->setItemDelegate(NULL);
|
||||
loadThumbnails(_folder);
|
||||
|
||||
qSort(_files.begin(),_files.end());
|
||||
|
||||
int itemCount = _files.size(); // 파일개수
|
||||
int rowCount = qMax((int)ceil((double)(itemCount) / ((double)g_thumbnail_column_count)),g_thumbnail_row_count);
|
||||
|
||||
//_tableView->clear();
|
||||
_tableView->setItemDelegate(_delegate);
|
||||
_tableView->setColumnCount(g_thumbnail_column_count);
|
||||
_tableView->setRowCount(rowCount); // ON LOADED 에서 처리
|
||||
//qInfo() << __FUNCTION__;
|
||||
}
|
||||
#else // USE_DATE_FILTER
|
||||
void FMThumbnailDialog::loadThumbnails()
|
||||
{
|
||||
FMThumbnailDialog::_items.clear();
|
||||
//QList<RMVideoItem*> res = QList<RMVideoItem*>();
|
||||
// 1시간 단위
|
||||
if(_mode == MODE_SIMPLE) {
|
||||
RMVideoFileList::instance()->load1HourList(_items);
|
||||
} else {
|
||||
RMVideoFileList::instance()->load1HourInList(_selectedDateTime,_items);
|
||||
}
|
||||
RMVideoFileList::instance()->loadThumbnails(_items,_thumbnails);
|
||||
}
|
||||
void FMThumbnailDialog::onLoadThumbnails()
|
||||
{
|
||||
// 선택해제하지 않으면 이후 이전 선택된 CELL 선택이 안됨
|
||||
_tableView->selectionModel()->blockSignals(true);
|
||||
_tableView->clearSelection();
|
||||
_tableView->selectionModel()->blockSignals(false);
|
||||
|
||||
_tableView->setItemDelegate(NULL);
|
||||
|
||||
loadThumbnails();
|
||||
|
||||
int itemCount = FMThumbnailDialog::_thumbnails.size() * 2;// 0;//_files.size(); // 파일개수
|
||||
int rowCount = qMax((int)ceil((double)(itemCount) / ((double)g_thumbnail_column_count)),g_thumbnail_row_count);
|
||||
|
||||
_tableView->setItemDelegate(_delegate);
|
||||
_tableView->setColumnCount(g_thumbnail_column_count);
|
||||
_tableView->setRowCount(rowCount); // ON LOADED 에서 처리
|
||||
|
||||
_backButton->setHidden(_mode == MODE_SIMPLE);
|
||||
QString wTitle = "";
|
||||
QString barTitle = "";
|
||||
if(_mode == MODE_SIMPLE) {
|
||||
barTitle = FM_WSTR(L"1시간 대표 이미지");
|
||||
wTitle = FM_WSTR(L"1시간리스트 (이미지 클릭 시 1시간내 전체 이미지를 볼 수 있습니다.)");
|
||||
} else {
|
||||
wTitle = FM_WSTR(L"세부리스트 (이미지 더블 클릭 시 해당 영상이 재생됩니다.)");
|
||||
|
||||
QString title = _items.first()->startTime().toString("yyyy-MM-dd HH:mm:ss");
|
||||
title += " ~ ";
|
||||
title += _items.last()->startTime().toString("yyyy-MM-dd HH:mm:ss");
|
||||
barTitle = title;
|
||||
}
|
||||
_titleBar->setText(barTitle + QString().sprintf(" [%d]",_items.size()));
|
||||
//setWindowTitle(wTitle + QString().sprintf(" [%d]",_items.size()));
|
||||
setWindowTitle(wTitle);
|
||||
|
||||
}
|
||||
void FMThumbnailDialog::onBack() {
|
||||
_mode = MODE_SIMPLE;
|
||||
onLoadThumbnails();
|
||||
}
|
||||
#endif // USE_DATE_FILTER
|
||||
|
||||
|
||||
FMThumbnailDelegate::FMThumbnailDelegate(QObject *parent) :
|
||||
QStyledItemDelegate(parent)
|
||||
{
|
||||
_dialog = (FMThumbnailDialog*)parent;
|
||||
}
|
||||
#if (USE_DATE_FILTER)
|
||||
void FMThumbnailDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QRect rect = option.rect;
|
||||
|
||||
painter->fillRect(rect,QColor(0x33,0x33,0x33));
|
||||
|
||||
//qInfo() << rect << index << index.column() << __FUNCTION__;
|
||||
painter->setRenderHint(QPainter::NonCosmeticDefaultPen); // Antialiasing
|
||||
int idx = ((index.row() * g_thumbnail_column_count) + index.column()) / 2;
|
||||
bool ch1 = index.column() % 2 == 0;// ? " - [CH1]" : " - [CH2]";
|
||||
|
||||
// _dialog->_items.size()
|
||||
bool drawItem = true;
|
||||
// if(_dialog->_loadedCount <= idx) {
|
||||
// drawItem = false;
|
||||
// }
|
||||
|
||||
if(drawItem) {
|
||||
//RMVideoItem* item = _dialog->_items.at(idx);
|
||||
//qInfo() << idx << __FUNCTION__;
|
||||
QString p1 = FMThumbnailDialog::_files.at((idx * 2) + (ch1 ? 0 : 1));
|
||||
|
||||
//painter->fillRect(option.rect,background);
|
||||
QFont font = QFont("Arial", 1);
|
||||
font.setPixelSize(12);
|
||||
painter->setFont(font);
|
||||
QRect tr = QRect(rect.left()+1,rect.bottom()-g_thumbnail_title_height,rect.width(),g_thumbnail_title_height);
|
||||
//tr.adjust(0,tr.height() - g_thumbnail_title_height,0,- g_thumbnail_title_height);
|
||||
//tr.setHeight(g_thumbnail_height);
|
||||
|
||||
painter->fillRect(tr,QColor(0x33,0x33,0x33)); // "#333333"
|
||||
|
||||
QFileInfo fi(p1);
|
||||
|
||||
painter->setPen(QPen(QColor(0xDD,0xDD,0xDD))); // "#DDDDDD"
|
||||
painter->drawText(tr, Qt::AlignCenter | Qt::AlignVCenter, fi.baseName());
|
||||
//qInfo() << "TR:" << tr << "RECT:" << rect.size() << __LINE__;
|
||||
|
||||
|
||||
|
||||
//QPixmap map;
|
||||
if (fi.exists()) {
|
||||
|
||||
QRect ir = rect;
|
||||
ir.adjust(0,0,-0,-g_thumbnail_title_height);
|
||||
|
||||
|
||||
//int iid = (index.row() * g_thumbnail_column_count) + index.column();
|
||||
QPixmap pix = thumbnail_cache::instance()->thumbnail(p1,index.row(),ir.size());
|
||||
if (!pix.isNull()) {
|
||||
painter->drawPixmap(rectAspectFit(ir,pix.width(),pix.height()),pix);
|
||||
}
|
||||
|
||||
// if(p1.contains("040556_PSR0_0017_") || p1.contains("040536_PSR0_0016_")) {
|
||||
// qInfo() << "DRAW:" << p1 << ir << __FUNCTION__;
|
||||
// }
|
||||
// painter->scale(1*((double)(ir.width())/(double)(map.width())),1*((double)(ir.height())/(double)(map.height())));
|
||||
// painter->scale(1,1);
|
||||
}
|
||||
|
||||
// IR: QRect(0,166 254x143) PIX SIZE: QSize(247, 138) RECT: QRect(0,166 254x165) 930
|
||||
/*
|
||||
if(thumbnails.size() > 1) {
|
||||
QRect ir = rect;
|
||||
ir.adjust(0,0,-0,-g_thumbnail_title_height);
|
||||
//ir.adjust(g_thumbnail_border_size,g_thumbnail_border_size,-g_thumbnail_border_size,-(g_thumbnail_title_height+g_thumbnail_border_size));
|
||||
|
||||
FMThumbnail* thumb = item->thumbnails.at(ch1 ? 0 : 1);
|
||||
|
||||
//qInfo() << thumb->size << __FUNCTION__;
|
||||
|
||||
if(thumb->size == 0) {
|
||||
painter->fillRect(ir,QColor(0x11,0x11,0x11));// "#111111"
|
||||
painter->drawText(ir, Qt::AlignCenter | Qt::AlignVCenter, QString::fromWCharArray(L"로딩 실패"));
|
||||
}
|
||||
else {
|
||||
QPixmap pix;
|
||||
pix.loadFromData(thumb->buffer,thumb->size);
|
||||
painter->drawPixmap(ir,pix);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// 외곽선 그리기
|
||||
QPen pen2; // c5ff5f
|
||||
pen2.setJoinStyle(Qt::MiterJoin);
|
||||
pen2.setColor(QColor(0xd0,0xd5,0xef)); // d0d5ef,b8bee0
|
||||
pen2.setWidth(4);
|
||||
painter->setPen(pen2);
|
||||
|
||||
QLine lines[3];
|
||||
int al = rect.left()+1;
|
||||
int ar = rect.right() - (ch1 ? 0 : 1);
|
||||
int at = rect.top()+1;
|
||||
int ab = rect.bottom();
|
||||
lines[0] = !ch1 ? QLine(al,at,ar,at) : QLine(ar,at,al,at);
|
||||
lines[1] = !ch1 ? QLine(ar,at,ar,ab) : QLine(al,at,al,ab);
|
||||
lines[2] = !ch1 ? QLine(ar,ab,al,ab) : QLine(al,ab,ar,ab);
|
||||
|
||||
painter->drawLines(lines,3);
|
||||
|
||||
// GRID LINE
|
||||
pen2.setColor(QColor(0x31,0x33,0x4A)); // fcc186,31334a
|
||||
pen2.setWidth(1);
|
||||
painter->setPen(pen2);
|
||||
if(!ch1) {
|
||||
painter->drawLine(QLine(ar+1,at,ar+1,ab));
|
||||
}
|
||||
//painter->drawLine(QLine(al-1,ab,ar,ab));
|
||||
|
||||
if(drawItem) {
|
||||
bool hover = option.state & QStyle::State_MouseOver;
|
||||
if (hover) {
|
||||
//qInfo() << "STATE:" << QString().sprintf("%0X",(int)option.state) << __FUNCTION__;
|
||||
int iw = g_thumbnail_border_size / 2;
|
||||
QRect br = rect;
|
||||
br.adjust(iw,iw,-iw,-iw);
|
||||
QPen pen; // c5ff5f
|
||||
pen.setJoinStyle(Qt::MiterJoin);
|
||||
pen.setColor(QColor(0xFF,0x99,0x33)); // "#FF9933"
|
||||
pen.setWidth(g_thumbnail_border_size);
|
||||
painter->setPen(pen);
|
||||
//QPalette palette = _checkContainerWidget->palette();
|
||||
//palette.setColor(_checkContainerWidget->backgroundRole(),background);
|
||||
//qInfo() << "index:" << index << "option:" << option.rect << __FUNCTION__;
|
||||
painter->drawRect(br);// fillRect(r, QColor(0,0,0,10));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#else // #if (USE_DATE_FILTER)
|
||||
void FMThumbnailDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QRect rect = option.rect;
|
||||
|
||||
painter->fillRect(rect,QColor(0x33,0x33,0x33));
|
||||
|
||||
painter->setRenderHint(QPainter::NonCosmeticDefaultPen); // Antialiasing
|
||||
int idx = ((index.row() * g_thumbnail_column_count) + index.column()) / 2;
|
||||
bool ch1 = index.column() % 2 == 0;// ? " - [CH1]" : " - [CH2]";
|
||||
|
||||
if(FMThumbnailDialog::_thumbnails.size() <= idx) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool drawItem = true;
|
||||
|
||||
if(drawItem) {
|
||||
QString p1 = ch1 ? FMThumbnailDialog::_thumbnails.at(idx).first : FMThumbnailDialog::_thumbnails.at(idx).second;
|
||||
//painter->fillRect(option.rect,background);
|
||||
QFont font = QFont("Arial", 1);
|
||||
font.setPixelSize(12);
|
||||
painter->setFont(font);
|
||||
QRect tr = QRect(rect.left()+1,rect.bottom()-g_thumbnail_title_height,rect.width(),g_thumbnail_title_height);
|
||||
//tr.adjust(0,tr.height() - g_thumbnail_title_height,0,- g_thumbnail_title_height);
|
||||
//tr.setHeight(g_thumbnail_height);
|
||||
|
||||
painter->fillRect(tr,QColor(0x33,0x33,0x33)); // "#333333"
|
||||
|
||||
QFileInfo fi(p1);
|
||||
|
||||
painter->setPen(QPen(QColor(0xDD,0xDD,0xDD))); // "#DDDDDD"
|
||||
//painter->drawText(tr, Qt::AlignCenter | Qt::AlignVCenter, fi.baseName());
|
||||
if(ch1) {
|
||||
painter->drawText(tr, Qt::AlignRight | Qt::AlignVCenter, fi.baseName().left(8));
|
||||
} else {
|
||||
painter->drawText(tr, Qt::AlignLeft | Qt::AlignVCenter, fi.baseName().mid(8, 7));
|
||||
}
|
||||
//qInfo() << "TR:" << tr << "RECT:" << rect.size() << __LINE__;
|
||||
|
||||
//QPixmap map;
|
||||
|
||||
|
||||
QRect ir = rect;
|
||||
ir.adjust(0,0,-0,-g_thumbnail_title_height);
|
||||
|
||||
QPixmap pix;
|
||||
//int iid = (index.row() * g_thumbnail_column_count) + index.column();
|
||||
if (fi.exists()) {
|
||||
pix = thumbnail_cache::instance()->thumbnail(p1,index.row(),ir.size());
|
||||
} else {
|
||||
static QPixmap no_image;
|
||||
// 200,133
|
||||
//qInfo() << ir.size() << __FUNCTION__;
|
||||
if(no_image.isNull()) {
|
||||
QPixmap ni = QPixmap(":/image/no_thumbnail.png");
|
||||
if(ni.width() != ir.size().width() || ni.height() != ir.size().width()) {
|
||||
no_image = ni.scaled(ir.size().width(),ir.size().width(),Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
} else {
|
||||
no_image = ni;
|
||||
}
|
||||
}
|
||||
pix = no_image;
|
||||
}
|
||||
if (!pix.isNull()) {
|
||||
painter->drawPixmap(rectAspectFit(ir,pix.width(),pix.height()),pix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 외곽선 그리기
|
||||
QPen pen2; // c5ff5f
|
||||
pen2.setJoinStyle(Qt::MiterJoin);
|
||||
pen2.setColor(QColor(0xd0,0xd5,0xef)); // d0d5ef,b8bee0
|
||||
pen2.setWidth(4);
|
||||
painter->setPen(pen2);
|
||||
|
||||
QLine lines[3];
|
||||
int al = rect.left()+1;
|
||||
int ar = rect.right() - (ch1 ? 0 : 1);
|
||||
int at = rect.top()+1;
|
||||
int ab = rect.bottom();
|
||||
lines[0] = !ch1 ? QLine(al,at,ar,at) : QLine(ar,at,al,at);
|
||||
lines[1] = !ch1 ? QLine(ar,at,ar,ab) : QLine(al,at,al,ab);
|
||||
lines[2] = !ch1 ? QLine(ar,ab,al,ab) : QLine(al,ab,ar,ab);
|
||||
|
||||
painter->drawLines(lines,3);
|
||||
|
||||
// GRID LINE
|
||||
pen2.setColor(QColor(0x31,0x33,0x4A)); // fcc186,31334a
|
||||
pen2.setWidth(1);
|
||||
painter->setPen(pen2);
|
||||
if(!ch1) {
|
||||
painter->drawLine(QLine(ar+1,at,ar+1,ab));
|
||||
}
|
||||
//painter->drawLine(QLine(al-1,ab,ar,ab));
|
||||
|
||||
if(drawItem) {
|
||||
bool hover = option.state & QStyle::State_MouseOver;
|
||||
if (hover) {
|
||||
//qInfo() << "STATE:" << QString().sprintf("%0X",(int)option.state) << __FUNCTION__;
|
||||
int iw = g_thumbnail_border_size / 2;
|
||||
QRect br = rect;
|
||||
br.adjust(iw,iw,-iw,-iw-g_thumbnail_title_height);
|
||||
QPen pen; // c5ff5f
|
||||
pen.setJoinStyle(Qt::MiterJoin);
|
||||
pen.setColor(QColor(0xFF,0x99,0x33)); // "#FF9933"
|
||||
pen.setWidth(g_thumbnail_border_size);
|
||||
painter->setPen(pen);
|
||||
painter->drawRect(br);// fillRect(r, QColor(0,0,0,10));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif // #else // #if (USE_DATE_FILTER)
|
||||
|
||||
void FMThumbnailDelegate::entered(const QModelIndex &index)
|
||||
{
|
||||
qInfo() << index << __FUNCTION__ << __LINE__;
|
||||
}
|
||||
|
||||
|
||||
thumbnail_cache::thumbnail_cache(QObject* parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
QPixmap thumbnail_cache::_load(QString path, const QSize& wh)
|
||||
{
|
||||
QPixmap map;
|
||||
map.load(path);
|
||||
|
||||
// 1:1 이미지 CROP
|
||||
if((float)map.width() / (float)map.height() < 1.1) {
|
||||
|
||||
|
||||
// 16:9 = 1.7777
|
||||
qreal wr = (qreal)wh.width() / (qreal)wh.height(); // 1.7777
|
||||
//qreal tw = wr; // 0.88888
|
||||
|
||||
int width = map.width();
|
||||
int height = map.height() / wr;
|
||||
|
||||
// 50% 크롭 영역 계산 (가운데 50%만 남기기)
|
||||
// 시작점은 너비와 높이의 25% 지점
|
||||
|
||||
// 잘라낼 영역의 너비와 높이는 원본의 50%
|
||||
//int cropHeight = height * 0.5;
|
||||
//int cropWidth = cropHeight * wr;
|
||||
int yOffset = (map.width() - height) / 2;
|
||||
//int xOffset = (width - cropWidth) / 2;
|
||||
|
||||
//qInfo() << "wh:" << wh << "width:" << width << "height:" << height << "X:" << xOffset << cropWidth << "Y:" << yOffset << cropHeight;
|
||||
map = map.copy(QRect(0, yOffset, width, height));
|
||||
}
|
||||
|
||||
|
||||
// resize
|
||||
if(map.width() > wh.width() || map.height() > wh.height())
|
||||
{
|
||||
map = map.scaled(wh.width(),wh.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
const QPixmap thumbnail_cache::thumbnail(const QString path,int index, const QSize& wh)
|
||||
{
|
||||
// 존재할 경우 리턴
|
||||
if(cache.contains(path)) {
|
||||
//qInfo() << "E" << path << __FUNCTION__;
|
||||
return cache.value(path);
|
||||
}
|
||||
|
||||
// 없으면 생성
|
||||
QFuture<QPixmap> loaded = QtConcurrent::run(this,&thumbnail_cache::_load,path,wh);
|
||||
cache[path] = loaded;
|
||||
|
||||
emit thumbnailLoaded(index);
|
||||
return _dummy;
|
||||
}
|
||||
|
||||
#endif // #if (GENERATE_THUMBNAIL)
|
||||
170
project/fm_viewer/ui/fm_thumbnail_dialog.h
Normal file
170
project/fm_viewer/ui/fm_thumbnail_dialog.h
Normal file
@@ -0,0 +1,170 @@
|
||||
#ifndef FM_THUMBNAIL_H
|
||||
#define FM_THUMBNAIL_H
|
||||
#include "../rm_include.h"
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#define DYNAMIC_THUMBNAIL 1
|
||||
|
||||
#define MULTI_THUMBNAIL_ONLY 1 // SINGLE 모드 제거
|
||||
#define FIXED_SIZE_THUMBNAIL 1 // 고정 크기
|
||||
#define THUMBNAIL_ITEM_CONNECT_EACH 1 // FMSIGNAL 로 연결
|
||||
#define THUMBNAIL_DIALOG_SNAP 1 // 크기 조정
|
||||
#include <QDialog>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
class QScrollArea;
|
||||
class QVBoxLayout;
|
||||
class RMVideoItem;
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QDateTime>
|
||||
class FMThumbnailDelegate;
|
||||
class QItemSelection;
|
||||
class FMButton;
|
||||
|
||||
class QTableWidget;
|
||||
#if (DETECT_USB_CHANGE)
|
||||
class rm_usb;
|
||||
#endif
|
||||
|
||||
class FMThumbnailDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#if (USE_DATE_FILTER)
|
||||
FMThumbnailDialog(QWidget *parent, QString folder);
|
||||
#else // USE_DATE_FILTER
|
||||
FMThumbnailDialog(QWidget *parent, bool bAll);
|
||||
#endif // USE_DATE_FILTER
|
||||
enum MODE {
|
||||
MODE_SIMPLE, // 심플 아이템 표시
|
||||
MODE_SUB // 심플 아이템에 포함된 모든 영상
|
||||
};
|
||||
|
||||
QString selectedFile;
|
||||
|
||||
protected:
|
||||
bool _bFirst;
|
||||
|
||||
#if (DETECT_USB_CHANGE)
|
||||
rm_usb* _usb; // 메인 윈도우의 참조
|
||||
#endif // #if (DETECT_USB_CHANGE)
|
||||
|
||||
#if (USE_DATE_FILTER)
|
||||
QString _folder;
|
||||
static QStringList _files;
|
||||
QList<RMVideoItem*> _items; // 멀티에서만 사용
|
||||
#endif // #if (USE_DATE_FILTER)
|
||||
#if (USE_1HOUR_FILTER)
|
||||
QDateTime _selectedDateTime; ///!< 선택된 영상 시간
|
||||
static QList<RMVideoItem*> _items; ///!< 시간 및 재생처리를 위해..
|
||||
static QList<QPair<QString,QString>> _thumbnails; ///!< 로딩된 Thumbnail 경로
|
||||
FMButton* _backButton; ///!< 세부->1시간으로 돌아가기 버튼
|
||||
QLabel* _titleBar; ///!< 1시간 및 세부 리스트에서 표시되는 타이틀
|
||||
#endif
|
||||
|
||||
QModelIndex _lastIndex; // 1시간 리스트에서 전체 리스트로 이동시
|
||||
//QString windowTitle;
|
||||
MODE _mode;
|
||||
QTableWidget* _tableView;
|
||||
FMThumbnailDelegate* _delegate;
|
||||
|
||||
void createLayout(MODE mode,RMVideoItem* selected = NULL);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void showEvent(QShowEvent * event);
|
||||
#if (USE_DATE_FILTER)
|
||||
void loadThumbnails(QString folder);
|
||||
#else
|
||||
void loadThumbnails();
|
||||
#endif // #if (USE_DATE_FILTER)
|
||||
public slots:
|
||||
void onLoadThumbnails();
|
||||
|
||||
//void onThumbnailLoaded(RMVideoItem* item); // FMThumbnail* thumbnail,
|
||||
//void onProcessFinished();
|
||||
#if (USE_1HOUR_FILTER)
|
||||
void onBack();
|
||||
#endif // #if (USE_1HOUR_FILTER)
|
||||
|
||||
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
|
||||
friend class FMThumbnailDelegate;
|
||||
void scrollTo();
|
||||
void onThumbnailUpdated(int);
|
||||
|
||||
void onDoubleClickItem(int row, int column);
|
||||
|
||||
void onEnableClick(); ///! 더블클릭 방지용
|
||||
|
||||
#if (DETECT_USB_CHANGE)
|
||||
void onUSBChange(bool inserted, QString& drive);
|
||||
#endif // #if (DETECT_USB_CHANGE)
|
||||
};
|
||||
|
||||
|
||||
class thumbnail_cache : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
thumbnail_cache(QObject* parent = nullptr);
|
||||
QMap<QString,QPixmap> cache;
|
||||
QPixmap _load(QString path, const QSize& wh);
|
||||
QPixmap _dummy;
|
||||
public:
|
||||
const QPixmap thumbnail(const QString path,int index, const QSize& wh);
|
||||
|
||||
static thumbnail_cache* instance() {
|
||||
static thumbnail_cache _instance;
|
||||
return &_instance;
|
||||
}
|
||||
void clear() {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
signals:
|
||||
void thumbnailLoaded(int index);
|
||||
};
|
||||
|
||||
class FMThumbnailDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FMThumbnailDelegate(QObject *parent = 0);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
private:
|
||||
QPersistentModelIndex currentEditedCellIndex;
|
||||
FMThumbnailDialog* _dialog;
|
||||
public slots:
|
||||
void entered(const QModelIndex &index);
|
||||
};
|
||||
|
||||
// PROCESS 강제 종료하기 위해 사용
|
||||
class FMThumbnailSignal : public QObject {
|
||||
Q_OBJECT
|
||||
private:
|
||||
static FMThumbnailSignal* _instance;
|
||||
public:
|
||||
enum SIGNAL_MODE {
|
||||
MODE_REJECT, // 종료(닫기, 취소)
|
||||
MODE_ACCEPT, // 선택됨
|
||||
MODE_RESTART // 다른 썸네일 로딩
|
||||
};
|
||||
static FMThumbnailSignal* instance()
|
||||
{
|
||||
if(_instance == NULL)
|
||||
{
|
||||
_instance = new FMThumbnailSignal();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
SIGNAL_MODE mode;
|
||||
FMThumbnailDialog::MODE restartMode;
|
||||
RMVideoItem* restartItem;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
void thumnbnailsLoaded(RMVideoItem* item);
|
||||
};
|
||||
|
||||
|
||||
#endif // #if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#endif // FM_THUMBNAIL_H
|
||||
30
project/fm_viewer/ui/rm_bottom_border.cpp
Normal file
30
project/fm_viewer/ui/rm_bottom_border.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "rm_bottom_border.h"
|
||||
#if (MODEL_WATEX)
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
RMBottomBorder::RMBottomBorder(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
setObjectName("bottom_border_watex");
|
||||
setFixedHeight(21);
|
||||
}
|
||||
void RMBottomBorder::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
if(event == RMApp::WillFullScreen)
|
||||
{
|
||||
setHidden(true);
|
||||
}
|
||||
else if (event == RMApp::WillNormalScreen)
|
||||
{
|
||||
setHidden(false);
|
||||
}
|
||||
|
||||
}
|
||||
void RMBottomBorder::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
#endif
|
||||
22
project/fm_viewer/ui/rm_bottom_border.h
Normal file
22
project/fm_viewer/ui/rm_bottom_border.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef RM_BOTTOM_BORDER_H
|
||||
#define RM_BOTTOM_BORDER_H
|
||||
#if (MODEL_WATEX)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
|
||||
class RMBottomBorder : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMBottomBorder(QWidget *parent = nullptr);
|
||||
private:
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event) override;
|
||||
};
|
||||
|
||||
#endif // MODEL_WATEX
|
||||
#endif // RM_BOTTOM_BORDER_H
|
||||
96
project/fm_viewer/ui/rm_button.cpp
Normal file
96
project/fm_viewer/ui/rm_button.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
#include "rm_button.h"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QVariant>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
#include "../core/rm_language.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#endif
|
||||
|
||||
RMButton::RMButton(QWidget *parent) : QPushButton(parent)
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
#if (DEBUG_BUTTON_EVENT)
|
||||
bCheckEvent = false;
|
||||
#endif
|
||||
}
|
||||
RMButton::~RMButton()
|
||||
{
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
RMLanguage::instance()->remove(this);
|
||||
#endif
|
||||
}
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* RMButton::create2(QWidget* parent, QLayout* layout, const char* name, const char* toolTip, QSize size)
|
||||
{
|
||||
RMButton* btn = new RMButton(parent);
|
||||
|
||||
if(toolTip != NULL) {
|
||||
btn->setToolTip(FMS::txt(toolTip));
|
||||
}
|
||||
btn->setObjectName(name);
|
||||
btn->setFixedSize(size);
|
||||
// 34,42
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
if(toolTip != NULL) {
|
||||
RMLanguage::instance()->append(toolTip,RMLanguage::TOOLTIP_TEXT,btn);
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* RMButton::create(QWidget* parent, QLayout* layout, const char* name, QString toolTip, QSize size)
|
||||
{
|
||||
RMButton* btn = new RMButton(parent);
|
||||
|
||||
if(toolTip.length() > 0 ) {
|
||||
btn->setToolTip(toolTip);
|
||||
}
|
||||
btn->setObjectName(name);
|
||||
btn->setFixedSize(size);
|
||||
// 34,42
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addWidget(btn);
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if(LIVE_LANGUAGE_CHANGE)
|
||||
if(toolTip.length() > 0 ) {
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TOOLTIP_TEXT,btn,toolTip);
|
||||
}
|
||||
#endif
|
||||
#endif // LIVE_LANGUAGE2
|
||||
return btn;
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (DEBUG_BUTTON_EVENT)
|
||||
bool RMButton::event(QEvent *e)
|
||||
{
|
||||
if(bCheckEvent){
|
||||
if(e->type() == QEvent::WindowBlocked)
|
||||
{
|
||||
qInfo() << __FUNCTION__ << e->type();
|
||||
}
|
||||
}
|
||||
return QPushButton::event(e);
|
||||
}
|
||||
#endif
|
||||
void RMButton::setStyleStatus(const char* status,bool toggle)
|
||||
{
|
||||
setProperty(status,toggle);
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
update();
|
||||
}
|
||||
void RMButton::updateObject(QString objectName)
|
||||
{
|
||||
setObjectName(objectName);
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
update();
|
||||
}
|
||||
30
project/fm_viewer/ui/rm_button.h
Normal file
30
project/fm_viewer/ui/rm_button.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef RM_BUTTON_H
|
||||
#define RM_BUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#define DEBUG_BUTTON_EVENT 0
|
||||
|
||||
class QLayout;
|
||||
class RMButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RMButton(QWidget *parent = 0);
|
||||
~RMButton();
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
static RMButton* create2(QWidget* parent, QLayout* layout, const char* name, const char* toolTip, QSize size);
|
||||
#else // LIVE_LANGUAGE2
|
||||
static RMButton* create(QWidget* parent, QLayout* layout, const char* name, QString toolTip, QSize size);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
void setStyleStatus(const char* status,bool toggle);
|
||||
void updateObject(QString objectName);
|
||||
#if (DEBUG_BUTTON_EVENT)
|
||||
bool bCheckEvent;
|
||||
virtual bool event(QEvent *e);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // RM_BUTTON_H
|
||||
321
project/fm_viewer/ui/rm_dialog_bbviewer.cpp
Normal file
321
project/fm_viewer/ui/rm_dialog_bbviewer.cpp
Normal file
@@ -0,0 +1,321 @@
|
||||
#include "rm_dialog_bbviewer.h"
|
||||
#include <QComboBox>
|
||||
#include "title_widget.h"
|
||||
#include "../core/rm_language.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "fm_button.h"
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
#include "../core/fm_strings.h"
|
||||
#endif // FORCE_FM_STRING
|
||||
|
||||
int RMDialogBBViewer::languageIndex = -1;
|
||||
QString RMDialogBBViewer::selectedDisk = "";
|
||||
|
||||
#if (MODEL_WATEX)
|
||||
#define POPUP_BUTTON_HEIGHT 27
|
||||
#else
|
||||
#define POPUP_BUTTON_HEIGHT 24
|
||||
#endif
|
||||
|
||||
RMDialogBBViewer::RMDialogBBViewer(QWidget *parent,QString title) : RMPopup(parent,title)
|
||||
{
|
||||
setFixedSize(550,162);
|
||||
// 言語選択
|
||||
//RMPopup::RMPopup(parent,title);
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
_buttonLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
#if !(FORCE_FM_STRING)
|
||||
bool bJP = RMLanguage::isJP();
|
||||
#endif // #if (FORCE_FM_STRING)
|
||||
|
||||
// 確認
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QString okString = FMS::txt("ok");
|
||||
#else // FORCE_FM_STRING
|
||||
#if (MODEL_BBVIEWER)
|
||||
QString okString = "OK";
|
||||
#else // MODEL_BBVIEWER
|
||||
QString okString = bJP ? MKU8("\xe7\xa2\xba\xe8\xaa\x8d") : "OK";
|
||||
#endif // MODEL_BBVIEWER
|
||||
#endif // FORCE_FM_STRING
|
||||
_okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",okString,QSize(100,POPUP_BUTTON_HEIGHT));
|
||||
_okButton->setText(okString);
|
||||
connect(_okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,10,0);
|
||||
|
||||
// キャンセル
|
||||
#if (FORCE_FM_STRING)
|
||||
QString cancelString = FMS::txt("cancel");
|
||||
|
||||
#else // FORCE_FM_STRING
|
||||
QString cancelString = bJP ? MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab") : "Cancel";
|
||||
#endif // FORCE_FM_STRING
|
||||
_cancelButton = RMButton::create(_buttonWidget,
|
||||
_buttonLayout,
|
||||
"button",
|
||||
cancelString,
|
||||
QSize(100,POPUP_BUTTON_HEIGHT));
|
||||
_cancelButton->setText(cancelString);
|
||||
|
||||
connect(_cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,20,0);
|
||||
}
|
||||
void RMDialogBBViewer::createInfoLayout()
|
||||
{
|
||||
_cancelButton->setHidden(true);
|
||||
//bool isJP = RMLanguage::isJP();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,2,10,2);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
QString("DRIVE RECORDER FD500 Viewer"),
|
||||
"text");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,5);
|
||||
|
||||
|
||||
QString pcViewer = "PC Viewer ";
|
||||
QString swVersion;
|
||||
swVersion.sprintf("%d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
// のバージョン
|
||||
//MKU8("\xe3\x81\xae\xe3\x83\x90\xe3\x83\xbc\xe3\x82\xb8\xe3\x83\xa7\xe3\x83\xb3");
|
||||
pcViewer += FMS::txt("version_of");
|
||||
pcViewer += " : ";
|
||||
#else // FORCE_FM_STRING
|
||||
if(RMLanguage::isJP())
|
||||
{
|
||||
// のバージョン
|
||||
pcViewer += MKU8("\xe3\x81\xae\xe3\x83\x90\xe3\x83\xbc\xe3\x82\xb8\xe3\x83\xa7\xe3\x83\xb3");
|
||||
pcViewer += " : ";
|
||||
}
|
||||
else
|
||||
{
|
||||
pcViewer += "Version : ";
|
||||
}
|
||||
#endif // FORCE_FM_STRING
|
||||
|
||||
pcViewer += swVersion;
|
||||
//QString message = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84") : "Select a language";
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
pcViewer,
|
||||
"text");
|
||||
}
|
||||
void RMDialogBBViewer::createOpenLayout()
|
||||
{
|
||||
#if !(FORCE_FM_STRING)
|
||||
bool isJP = RMLanguage::isJP();
|
||||
#endif
|
||||
#if (FORCE_FM_STRING)
|
||||
QString otherString = FMS::txt("others");
|
||||
#else
|
||||
// その他フォルダ
|
||||
#if (MODEL_WATEX)
|
||||
QString otherString = isJP ? MKU8("\xe3\x81\x9d\xe3\x81\xae\xe4\xbb\x96\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Others..";
|
||||
#else
|
||||
// 他の保存先
|
||||
QString otherString = isJP ? MKU8("\xe4\xbb\x96\xe3\x81\xae\xe4\xbf\x9d\xe5\xad\x98\xe5\x85\x88") : "Others..";
|
||||
#endif
|
||||
#endif // FORCE_FM_STRING
|
||||
RMButton* otherButton = RMButton::create(_buttonWidget,_buttonLayout,"button",otherString,QSize(100,POPUP_BUTTON_HEIGHT));
|
||||
|
||||
_buttonLayout->removeWidget(otherButton);
|
||||
_buttonLayout->insertWidget(0,otherButton);
|
||||
|
||||
QSpacerItem* seperator = new QSpacerItem(1000,0,QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
_buttonLayout->insertSpacerItem(1,seperator);
|
||||
|
||||
QSpacerItem* seperator2 = new QSpacerItem(20,0,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
_buttonLayout->insertSpacerItem(0,seperator2);
|
||||
|
||||
otherButton->setText(otherString);
|
||||
connect(otherButton,SIGNAL(clicked()),this,SLOT(onSelectOther()));
|
||||
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,10,0);
|
||||
|
||||
|
||||
RMDialogBBViewer::selectedDisk = "";
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,2,10,2);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
|
||||
QWidget* comboWidget = new QWidget(bg);
|
||||
contentLayout->addWidget(comboWidget);
|
||||
|
||||
QHBoxLayout* comboLayout = new QHBoxLayout(comboWidget);
|
||||
comboLayout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
comboLayout->setContentsMargins(0,2,8,2);
|
||||
comboLayout->setSpacing(3);
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QString driveString = FMS::txt("drive");//isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
||||
#else // FORCE_FM_STRING
|
||||
#if (MODEL_WATEX)
|
||||
// フォルダ:
|
||||
QString driveString = isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
||||
#else
|
||||
// ドライブを選択してください。
|
||||
QString driveString = isJP ? MKU8("\xe3\x83\x89\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\x96") : "Drive";
|
||||
#endif
|
||||
#endif // FORCE_FM_STRING
|
||||
driveString += " : ";
|
||||
|
||||
RMLayout::addLabel(comboWidget,
|
||||
comboLayout,
|
||||
driveString,
|
||||
"text");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,15);
|
||||
QStringList disks = RMApp::getRemovableDisks();
|
||||
QComboBox* combo = new QComboBox(bg);
|
||||
combo->setFixedWidth(300);
|
||||
if(disks.size() > 0)
|
||||
{
|
||||
RMDialogBBViewer::selectedDisk = disks[0];
|
||||
foreach (QString disk, disks) {
|
||||
combo->addItem(disk);
|
||||
}
|
||||
connect(combo,SIGNAL(currentIndexChanged(QString)),SLOT(onDiskSelected(QString)));
|
||||
}
|
||||
else
|
||||
{
|
||||
_okButton->setEnabled(false);
|
||||
combo->setEnabled(false);
|
||||
}
|
||||
comboLayout->addWidget(combo);
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
// "Select the drive which memory card is inserted on."
|
||||
QString message = FMS::txt("select_memory_drive");//isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
||||
#else // FORCE_FM_STRING
|
||||
// メモリカードが挿入されているドライブを選択します。
|
||||
QString message = isJP ? MKU8("\xe3\x83\xa1\xe3\x83\xa2\xe3\x83\xaa\xe3\x82\xab\xe3\x83\xbc\xe3\x83\x89\xe3\x81\x8c\xe6\x8c\xbf\xe5\x85\xa5\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x82\x8b\xe3\x83\x89\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\x96\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82") : "Select the drive which memory card is inserted on.";
|
||||
#endif // FORCE_FM_STRING
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
message,
|
||||
"text");
|
||||
|
||||
}
|
||||
|
||||
void RMDialogBBViewer::createLanguageLayout()
|
||||
{
|
||||
RMDialogBBViewer::languageIndex = -1;
|
||||
|
||||
#if !(FORCE_FM_STRING)
|
||||
bool isJP = RMLanguage::isJP();
|
||||
#endif //
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,2,10,2);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
|
||||
// 言語
|
||||
QWidget* comboWidget = new QWidget(bg);
|
||||
contentLayout->addWidget(comboWidget);
|
||||
|
||||
QHBoxLayout* comboLayout = new QHBoxLayout(comboWidget);
|
||||
comboLayout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
comboLayout->setContentsMargins(0,2,8,2);
|
||||
comboLayout->setSpacing(3);
|
||||
#if !(FORCE_FM_STRING)
|
||||
QString title = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e") : "Language";
|
||||
#else
|
||||
QString title = MKU8("\xe8\xa8\x80\xe8\xaa\x9e");
|
||||
#endif
|
||||
title += ":";
|
||||
RMLayout::addLabel(comboWidget,
|
||||
comboLayout,
|
||||
title,
|
||||
"text");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,5);
|
||||
|
||||
QComboBox* comboBox = new QComboBox(this);
|
||||
comboBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
comboBox->setFixedWidth(200);
|
||||
comboBox->setObjectName("settings");
|
||||
comboBox->setMaxVisibleItems(100);
|
||||
|
||||
// 日本語, 自動
|
||||
#if !(FORCE_FM_STRING)
|
||||
QString autoString = isJP ? MKU8("\xe8\x87\xaa\xe5\x8b\x95") : "Auto";
|
||||
#else
|
||||
QString autoString = MKU8("\xe8\x87\xaa\xe5\x8b\x95");
|
||||
#endif
|
||||
QStringList items = QStringList() << autoString << MKU8("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e") << "English";
|
||||
|
||||
comboBox->addItems(items);
|
||||
|
||||
//comboBox->setCurrentIndex(realIndex(*value));
|
||||
connect(comboBox,SIGNAL(currentIndexChanged(int)),SLOT(onLanguageSelected(int)));
|
||||
comboLayout->addWidget(comboBox);
|
||||
|
||||
int current = 0; // AUTO
|
||||
if(RMLanguage::isAuto == false)
|
||||
{
|
||||
current = RMLanguage::isJP() ? 1 : 2;
|
||||
}
|
||||
comboBox->setCurrentIndex(current);
|
||||
|
||||
|
||||
// 言語を選択してください
|
||||
#if !(FORCE_FM_STRING)
|
||||
QString message = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84") : "Select a language";
|
||||
#else
|
||||
QString message = MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84");
|
||||
#endif
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
message,
|
||||
"text");
|
||||
|
||||
}
|
||||
void RMDialogBBViewer::onLanguageSelected(int index)
|
||||
{
|
||||
RMDialogBBViewer::languageIndex = index;
|
||||
}
|
||||
void RMDialogBBViewer::onDiskSelected(QString disk)
|
||||
{
|
||||
RMDialogBBViewer::selectedDisk = disk;
|
||||
// qInfo() << "disk:" << disk;
|
||||
//RMDialogBBViewer::languageIndex = index;
|
||||
}
|
||||
void RMDialogBBViewer::onSelectOther()
|
||||
{
|
||||
RMDialogBBViewer::selectedDisk = "OPENFOLDER";
|
||||
accept();
|
||||
}
|
||||
|
||||
#endif // #if !(LIVE_LANGUAGE2)
|
||||
34
project/fm_viewer/ui/rm_dialog_bbviewer.h
Normal file
34
project/fm_viewer/ui/rm_dialog_bbviewer.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef RM_DIALOG_BBVIEWER_H
|
||||
#define RM_DIALOG_BBVIEWER_H
|
||||
#include "rm_popup.h"
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
|
||||
class RMButton;
|
||||
class RMDialogBBViewer : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMDialogBBViewer(QWidget *parent = nullptr,QString title = QString(""));
|
||||
|
||||
void createLanguageLayout();
|
||||
void createInfoLayout();
|
||||
void createOpenLayout();
|
||||
static int languageIndex;
|
||||
|
||||
static QString selectedDisk;
|
||||
|
||||
private:
|
||||
RMButton* _cancelButton;
|
||||
RMButton* _okButton;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onLanguageSelected(int index);
|
||||
void onSelectOther();
|
||||
void onDiskSelected(QString disk);
|
||||
};
|
||||
|
||||
#endif // #if !(LIVE_LANGUAGE2)
|
||||
|
||||
#endif // RM_DIALOG_BBVIEWER_H
|
||||
595
project/fm_viewer/ui/rm_dialog_map.cpp
Normal file
595
project/fm_viewer/ui/rm_dialog_map.cpp
Normal file
@@ -0,0 +1,595 @@
|
||||
#if !(DO_NOT_USE_MAP)
|
||||
#if !(USE_WEBVIEW2)
|
||||
|
||||
#include "rm_dialog_map.h"
|
||||
#include "../rm_include.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../rm_app.h"
|
||||
#include "title_widget.h"
|
||||
#include "rm_widget_drag.h"
|
||||
#include "rm_widget_map.h"
|
||||
#include "fm_layer.h"
|
||||
#include "fm_button.h"
|
||||
#include <QMainWindow>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../data/rm_sensordata.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
#if (KMH_MPH_TOGGLE)
|
||||
#include "rm_gps_position.h"
|
||||
#include "rm_speed_label.h"
|
||||
#endif
|
||||
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
#include "../core/rm_key_event.h"
|
||||
#endif
|
||||
|
||||
|
||||
RMDialogMap::RMDialogMap(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
|
||||
//qInfo() << "parent:" << parent;
|
||||
_bHTMLLoaded = false;
|
||||
_hideOnFullScreen = false;
|
||||
|
||||
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
|
||||
this->setWindowModality(Qt::NonModal);
|
||||
|
||||
// 시작시 표시 및 처리되지 않도록 시작
|
||||
#if !(TOGGLE_PLAYER)
|
||||
this->setAttribute(Qt::WA_DontShowOnScreen,true);
|
||||
this->setAttribute(Qt::WA_ShowWithoutActivating,true);
|
||||
#endif
|
||||
|
||||
//setFocusPolicy(Qt::NoFocus);
|
||||
#if (TOGGLE_PLAYER)
|
||||
this->setFixedSize(RIGHT_FRAME_WIDTH,RIGHT_SUB_HEIGHT);
|
||||
#else
|
||||
#if (MAP_SINGLE_PATH)
|
||||
this->setFixedSize(403,493-48);
|
||||
#else
|
||||
this->setFixedSize(403,493);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (MODEL_BBVIEWER)
|
||||
this->setFixedSize(628,500);
|
||||
#endif
|
||||
|
||||
_layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(_layout);
|
||||
|
||||
|
||||
// 地図, マップを見る(MODEL_WATEX)
|
||||
#if !(TOGGLE_PLAYER)
|
||||
_title = new TitleWidget(this,FMS::txt("map"),"",true);
|
||||
_layout->addWidget(_title);
|
||||
connect(_title->closeButton,SIGNAL(clicked()),this,SLOT(onClose()));
|
||||
#endif
|
||||
_map = new RMWidgetMap(this);
|
||||
//_map->setHidden(true);
|
||||
|
||||
#if (TOGGLE_PLAYER)
|
||||
// 392 x 274
|
||||
_map->setFixedSize(RIGHT_FRAME_WIDTH,RIGHT_SUB_HEIGHT);
|
||||
#else
|
||||
_map->setFixedSize(403,406);
|
||||
#endif
|
||||
|
||||
_layout->addWidget(_map);
|
||||
|
||||
#if !(TOGGLE_PLAYER)
|
||||
|
||||
#if !(MAP_SINGLE_PATH)
|
||||
// FD500 도 표시함
|
||||
QWidget* speedWidget = new QWidget(this);
|
||||
speedWidget->setObjectName("bg_widget");
|
||||
speedWidget->setFixedHeight(48);
|
||||
_layout->addWidget(speedWidget);
|
||||
FMWidgetBackground(speedWidget,"map",0x4f4f4f);
|
||||
|
||||
QVBoxLayout* speedLayout = new QVBoxLayout(speedWidget);
|
||||
speedLayout->setMargin(0);
|
||||
speedLayout->setSpacing(0);
|
||||
speedLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel* speedBar = new QLabel(speedWidget);
|
||||
speedBar->setPixmap( QPixmap(":/image/speed_bar.png") );
|
||||
speedBar->setFixedSize(392,22);
|
||||
speedBar->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
speedLayout->addWidget(speedBar);
|
||||
|
||||
QWidget* speedLabelWidget = new QWidget(speedWidget);
|
||||
//speedLabelWidget->setFixedHeight(51);
|
||||
speedLayout->addWidget(speedLabelWidget);
|
||||
|
||||
QGridLayout* speedLabeLayout = new QGridLayout(speedLabelWidget);
|
||||
speedLabeLayout->setMargin(3);
|
||||
speedLabeLayout->setSpacing(0);
|
||||
|
||||
// 低速
|
||||
lowLable = new QLabel(speedLabelWidget);
|
||||
lowLable->setObjectName("text");
|
||||
lowLable->setText(FMS::txt("low_speed"));
|
||||
//#if(LIVE_LANGUAGE_CHANGE)
|
||||
// RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TITLE_TEXT,lowLable,MKU8("\xe4\xbd\x8e\xe9\x80\x9f"));
|
||||
//#if !(LANGUAGE_REMOVE_ENG) // WATEX
|
||||
// RMLanguage::instance()->append(RMLanguage::LANGUAGE_EN,RMLanguage::TITLE_TEXT,lowLable,QString("Low speed"));
|
||||
//#endif // #if (LANGUAGE_REMOVE_ENG) // WATEX
|
||||
//#endif
|
||||
|
||||
// 高速 ( 130 Km/h 以上 )
|
||||
highLable = new QLabel(speedLabelWidget);
|
||||
highLable->setObjectName("text");
|
||||
highLable->setText(FMS::txt("high_speed"));
|
||||
|
||||
#if (MODEL_BBVIEWER)
|
||||
connect(speedLabel,SIGNAL(speedUnitChange()),SLOT(onSpeedUnitChange()));
|
||||
refreshSpeedBarUnit();
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
#endif
|
||||
|
||||
speedLabeLayout->addWidget(lowLable,0,0,Qt::AlignLeft);
|
||||
speedLabeLayout->addWidget(highLable,0,0,Qt::AlignRight);
|
||||
#endif // #if !(MAP_SINGLE_PATH)
|
||||
_drag = new RMWidgetDrag(this,POPUP_TITLE_BAR_HEIGHT);
|
||||
#endif // TOGGLE_PLAYER
|
||||
|
||||
connect(RMApp::instance(),SIGNAL(appEvent(RMApp::Event,int)),this,SLOT(onAppEvent(RMApp::Event,int)));
|
||||
|
||||
sensor = NULL;
|
||||
lonX = -9999;
|
||||
latY = -9999;
|
||||
speed = -9999;
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
connect(&updater,SIGNAL(moveTo(double, double, double, bool)),SLOT(onMoveToProcess(double,double,double,bool)),Qt::BlockingQueuedConnection);
|
||||
#endif
|
||||
|
||||
//setHidden(true);
|
||||
_bFirst = true;
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
refreshLanguage();
|
||||
#endif
|
||||
|
||||
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
}
|
||||
|
||||
|
||||
#if (TOGGLE_PLAYER)
|
||||
|
||||
void RMDialogMap::snapTo(QWidget* target)
|
||||
{
|
||||
if(target != NULL) {
|
||||
snapTarget = target;
|
||||
}
|
||||
QPoint lt = snapTarget->mapToGlobal(QPoint(0,0));
|
||||
//qInfo() << lt;
|
||||
move(lt);
|
||||
//setGeometry(lt.x(),lt.y(),354,226);
|
||||
//target->installEventFilter(this);
|
||||
}
|
||||
#endif // TOGGLE_PLAYER
|
||||
|
||||
#if (KMH_MPH_TOGGLE)
|
||||
void RMDialogMap::onSpeedUnitChange()
|
||||
{
|
||||
refreshSpeedBarUnit();
|
||||
}
|
||||
void RMDialogMap::refreshSpeedBarUnit()
|
||||
{
|
||||
QString speed = "";
|
||||
//#if (MODEL_BBVIEWER)
|
||||
// if(speedLabel->isMPH) 이거 왜 에러남?
|
||||
//#else
|
||||
if(RMApp::isMPH)
|
||||
//#endif
|
||||
{
|
||||
speed = "80 mph";
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = "130 km/h";
|
||||
}
|
||||
if(RMLanguage::isJP())
|
||||
{
|
||||
// // 高速 ( 130 Km/h 以上 )
|
||||
highLable->setText(MKU8("\xe9\xab\x98\xe9\x80\x9f") + QString(" ( ") + speed + MKU8(" \xe4\xbb\xa5\xe4\xb8\x8a \x29"));
|
||||
}
|
||||
else
|
||||
{
|
||||
highLable->setText(QString("High speed ( up to ") + speed + QString(" )"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
void RMDialogMap::onLanguageChange(RMLanguage::LANGUAGE_TYPE language)
|
||||
{
|
||||
Q_UNUSED(language)
|
||||
#if (MODEL_BBVIEWER)
|
||||
refreshSpeedBarUnit();
|
||||
#else
|
||||
refreshLanguage();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void RMDialogMap::refreshLanguage()
|
||||
{
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_title->titleLabel->setText(FMS::txt("map"));
|
||||
#endif
|
||||
// bool isJP = RMLanguage::isJP();
|
||||
// _title->titleLabel->setText(isJP ? MKU8("\xe5\x9c\xb0\xe5\x9b\xb3") : "MAP");
|
||||
// lowLable->setText(isJP ? MKU8("\xe4\xbd\x8e\xe9\x80\x9f") : "Low speed");
|
||||
// highLable->setText(isJP ? MKU8("\xe9\xab\x98\xe9\x80\x9f \x28 \x31\x33\x30 \x4b\x6d\x2f\x68 \xe4\xbb\xa5\xe4\xb8\x8a \x29") : "High speed (up to 130km/h)");
|
||||
// _title->closeButton->setToolTip(isJP ? MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b") : "Exit");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void RMDialogMap::runScript(QString script)
|
||||
{
|
||||
if(_map != NULL) {
|
||||
_map->runScript(script);
|
||||
}
|
||||
}
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
// @TODO -> MAP
|
||||
void RMDialogMap::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(event->isAutoRepeat() == false) {
|
||||
RMKeyEvent::instance()->pressed(event->key());
|
||||
}
|
||||
}
|
||||
void RMDialogMap::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
if(event->isAutoRepeat() == false) {
|
||||
RMKeyEvent::instance()->released(event->key());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bool RMDialogMap::isGPSExist()
|
||||
{
|
||||
return (sensor != NULL && sensor->getGPSCount() > 0);
|
||||
}
|
||||
#if (USE_HTML_MAP)
|
||||
void RMDialogMap::removeHtml()
|
||||
{
|
||||
_map->removePage();
|
||||
}
|
||||
#endif // USE_HTML_MAP
|
||||
|
||||
RMDialogMap* RMDialogMap::instance(QWidget* parent)
|
||||
{
|
||||
static RMDialogMap * _instance = NULL;
|
||||
if ( _instance == NULL )
|
||||
{
|
||||
_instance = new RMDialogMap(parent);
|
||||
_instance->initHtml();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
void RMDialogMap::initHtml()
|
||||
{
|
||||
// 로딩완료 처리
|
||||
connect(_map->_ax, SIGNAL(signal(const QString&, int, void*)),SLOT(activexEventHandler(const QString&, int, void*)));
|
||||
#if (USE_HTML_MAP)
|
||||
_map->loadFirstPage();
|
||||
#else
|
||||
_map->navigate("");
|
||||
#endif
|
||||
|
||||
// navigate 종료 후 HTML 로딩
|
||||
// _map->navigate("https://www.whatismybrowser.com/");
|
||||
}
|
||||
// 초기 로딩 완료 여부 확인
|
||||
void RMDialogMap::activexEventHandler(const QString &name, int argc, void *argv)
|
||||
{
|
||||
Q_UNUSED(argc)
|
||||
Q_UNUSED(argv)
|
||||
if(name == QString("NavigateComplete(QString)"))
|
||||
{
|
||||
//qInfo() << "NavigateComplete";
|
||||
//_map->setHidden(false);
|
||||
_bHTMLLoaded = true;
|
||||
disconnect(_map->_ax,SIGNAL(signal(const QString&, int, void*)),this,SLOT(activexEventHandler(const QString&, int, void*)));
|
||||
#if !(USE_HTML_MAP)
|
||||
_map->load();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool RMDialogMap::isHiddenReal()
|
||||
{
|
||||
#if !(TOGGLE_PLAYER)
|
||||
if(testAttribute(Qt::WA_DontShowOnScreen))
|
||||
{
|
||||
setAttribute(Qt::WA_DontShowOnScreen,false);
|
||||
setAttribute(Qt::WA_ShowWithoutActivating,false);
|
||||
setHidden(true);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return isHidden();
|
||||
}
|
||||
void RMDialogMap::onClose()
|
||||
{
|
||||
_hideOnFullScreen = false;
|
||||
setHidden(true);
|
||||
close();
|
||||
RMApp::instance()->pMainWindow->setFocus();
|
||||
}
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
void RMDialogMap::moveTo(double lon, double lat,double speed, bool drawLine)
|
||||
{
|
||||
updater.runMove(new RMMapMove(lon,lat,speed,drawLine));
|
||||
}
|
||||
void RMDialogMap::onMoveToProcess(double lon, double lat,double speed, bool drawLine)
|
||||
#else
|
||||
void RMDialogMap::moveTo(double lon, double lat,double speed, bool drawLine)
|
||||
#endif
|
||||
{
|
||||
if(_bHTMLLoaded == false) {
|
||||
return;
|
||||
}
|
||||
#if !(TEST_DO_NOT_UPDATE_MAP)
|
||||
QString script = "setLatLag(";
|
||||
script.append(QString::number(lat,'f', 6));
|
||||
script.append(",");
|
||||
script.append(QString::number(lon,'f', 6));
|
||||
script.append(",");
|
||||
|
||||
int color = MAX(MIN((int)((double)speed / 13.0),13),0);
|
||||
|
||||
script.append(QString::number(color));
|
||||
if(_bFirst == true)
|
||||
{
|
||||
script.append(",1,1);");
|
||||
_bFirst = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(drawLine)
|
||||
{
|
||||
script.append(",0,0);");
|
||||
//lineCount++;
|
||||
//qInfo() << "LINE COUNT:" << lineCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIRST, DISTANCE
|
||||
script.append(",0,1);");
|
||||
}
|
||||
}
|
||||
_map->runScript(script);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void RMDialogMap::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
|
||||
if(item->getSensorData() != NULL && item->getSensorData()->getGPSCount() > 0)
|
||||
{
|
||||
sensor = item->getSensorData();
|
||||
|
||||
#if (MAP_SINGLE_PATH)
|
||||
QString arg = "drawPaths([";
|
||||
|
||||
int pointCount = 0;
|
||||
const NMEA_INFO* nmea = item->getSensorData()->getGPS();
|
||||
bool bStart = false;
|
||||
int pathCount = 0;
|
||||
|
||||
for(uint32_t i=0;i<item->getSensorData()->getGPSCount();i++) {
|
||||
|
||||
#if (CHECK_GPS_LOCATION)
|
||||
if( nmea[i].nStatus != 0 && IS_VALID_LOCATION(nmea[i].Longitude,nmea[i].Latitude)) //
|
||||
#else
|
||||
if(nmea[i].nStatus != 0)
|
||||
#endif
|
||||
{
|
||||
// 시작되지 않은 경우 시작
|
||||
if(bStart == false) {
|
||||
pointCount = 0;
|
||||
bStart = true;
|
||||
if(pathCount > 0) {
|
||||
arg.append(",");
|
||||
}
|
||||
pathCount += 1;
|
||||
arg.append("[");
|
||||
}
|
||||
|
||||
if(pointCount > 0)
|
||||
{
|
||||
arg.append(",");
|
||||
}
|
||||
|
||||
arg.append("{lat:" + QString::number(nmea[i].Latitude,'f', 6)
|
||||
+ ", lng:" + QString::number(nmea[i].Longitude,'f', 6) + "}");
|
||||
pointCount++;
|
||||
}
|
||||
else if (bStart) { // 중단된 경우 닫기
|
||||
bStart = false;
|
||||
pointCount = 0;
|
||||
arg.append("]");
|
||||
}
|
||||
}
|
||||
// 마지막까지 데이터가 정상일 경우 닫기
|
||||
if(bStart) {
|
||||
arg.append("]");
|
||||
}
|
||||
arg.append("]);");
|
||||
//qInfo() << arg;
|
||||
runScript(arg);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastPosition = -1;
|
||||
lonX = -9999;
|
||||
latY = -9999;
|
||||
speed = -9999;
|
||||
sensor = NULL;
|
||||
#if (MAP_SINGLE_PATH)
|
||||
runScript("clearPath();");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_lastPosition = -1;
|
||||
sensor = NULL;
|
||||
// lonX = -9999;
|
||||
// latY = -9999;
|
||||
// speed = -9999;
|
||||
#if (MAP_SINGLE_PATH)
|
||||
runScript("clearPath();");
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
QString RMDialogMap::_packLine(double lon1, double lat1, double lon2, double lat2)
|
||||
{
|
||||
int32_t o1 = (int32_t)(lon1 * 1000000.0);
|
||||
int32_t a1 = (int32_t)(lat1 * 1000000.0);
|
||||
|
||||
int32_t o2 = (int32_t)(lon2 * 1000000.0);
|
||||
int32_t a2 = (int32_t)(lat2 * 1000000.0);
|
||||
|
||||
return QString().sprintf("%X_%X_%X_%X",o1,a1,o2,a2);
|
||||
}
|
||||
void RMDialogMap::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
|
||||
if(sensor != NULL)
|
||||
{
|
||||
#if !(MAP_SINGLE_PATH)
|
||||
// 뒤로 이동
|
||||
bool isFirstLine = (_lastPosition == -1);
|
||||
bool drawLine = true;
|
||||
if(_lastPosition > position)
|
||||
{
|
||||
drawLine = false;
|
||||
}
|
||||
else if (position > _lastPosition + 2000)
|
||||
{
|
||||
drawLine = false;
|
||||
}
|
||||
_lastPosition = position;
|
||||
#endif
|
||||
double ratio = ((double)position) / ((double)duration);
|
||||
|
||||
// 처리 속도를 줄이기 위해
|
||||
double x,y,s;
|
||||
if(sensor->getGPSPosition(ratio,&x,&y,&s))
|
||||
{
|
||||
if(x != lonX || y != latY || s != speed)
|
||||
{
|
||||
#if !(MAP_SINGLE_PATH)
|
||||
// 시속 200 KM 의 경우 1초당 55.5 m 주행 가능
|
||||
//qInfo() << "DIST:" << RMDialogMap::distance(y,x,latY,lonX);
|
||||
if(drawLine == false && isFirstLine)
|
||||
{
|
||||
drawLine = true;
|
||||
}
|
||||
|
||||
if(drawLine == true && RMDialogMap::distance(y,x,latY,lonX) > (55*3)) // 버퍼 3초
|
||||
{
|
||||
drawLine = false;
|
||||
}
|
||||
#endif // MAP_SINGLE_PATH
|
||||
|
||||
//qInfo() << "LON:" << lonX << " LAT:" << latY << " SPEED:" << s << " DRAW:" << drawLine;
|
||||
// Status 는 getGPSPosition 에서 처리하지만 잘못된 경우가 있음
|
||||
#if (FORCE_VALID_LOCATION)
|
||||
if(true)
|
||||
#else
|
||||
if(IS_VALID_LOCATION(x,y))
|
||||
#endif
|
||||
{
|
||||
#if !(MAP_SINGLE_PATH)
|
||||
if(drawLine == true)
|
||||
{
|
||||
QString key = _packLine(lonX,latY,x,y);
|
||||
if(_drawList.contains(key) == true)
|
||||
{
|
||||
drawLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_drawList.insert(key,true);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
lonX = x;
|
||||
latY = y;
|
||||
speed = s;
|
||||
#if !(MAP_SINGLE_PATH)
|
||||
moveTo(lonX,latY,speed,drawLine);
|
||||
#else
|
||||
runScript(QString().sprintf("moveToMap(%.6f,%.6f);",latY,lonX));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
runScript("clearCarMarker();");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
runScript("clearCarMarker();");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void RMDialogMap::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
if(event == RMApp::WillFullScreen && isHidden() == false)
|
||||
{
|
||||
// MAXIMIZE 모드
|
||||
if(param == 1) {
|
||||
|
||||
}
|
||||
else {
|
||||
_hideOnFullScreen = true;
|
||||
setHidden(true);
|
||||
}
|
||||
}
|
||||
else if (_hideOnFullScreen == true && event == RMApp::WillNormalScreen && isHidden() == true)
|
||||
{
|
||||
// MAXIMIZE 모드
|
||||
if(param == 1) {
|
||||
|
||||
} else {
|
||||
_hideOnFullScreen = false;
|
||||
setHidden(false);
|
||||
}
|
||||
}
|
||||
else if (event == RMApp::WillCloseApplication)
|
||||
{
|
||||
// clearHtml();
|
||||
}
|
||||
}
|
||||
#endif // #if !(USE_WEBVIEW2)
|
||||
#endif // #if !(DO_NOT_USE_MAP)
|
||||
|
||||
156
project/fm_viewer/ui/rm_dialog_map.h
Normal file
156
project/fm_viewer/ui/rm_dialog_map.h
Normal file
@@ -0,0 +1,156 @@
|
||||
#ifndef RM_DIALOG_MAP_H
|
||||
#define RM_DIALOG_MAP_H
|
||||
|
||||
#if !(DO_NOT_USE_MAP)
|
||||
#if !(USE_WEBVIEW2)
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMap>
|
||||
#include "../rm_app.h"
|
||||
#include "../fm_event_types.h"
|
||||
//#include "../core/rm_player_base.h"
|
||||
#include <QMainWindow>
|
||||
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
#include "rm_map_thread.h"
|
||||
#endif
|
||||
|
||||
class RMVideoItem;
|
||||
class RMSensorData;
|
||||
|
||||
// 전체 경로를 그리는 방식이라 무조건 처음부터 사용해야함...
|
||||
class TitleWidget;
|
||||
class RMWidgetDrag;
|
||||
class RMWidgetMap;
|
||||
|
||||
#if (KMH_MPH_TOGGLE)
|
||||
class RMSpeedLabel;
|
||||
#endif
|
||||
|
||||
class RMDialogMap : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class RMExcelReport;
|
||||
public:
|
||||
//static void start(); // show
|
||||
static RMDialogMap* instance(QWidget* parent = nullptr);
|
||||
//#if (TOGGLE_PLAYER)
|
||||
// ~RMDialogMap();
|
||||
//#endif
|
||||
|
||||
bool isHiddenReal();
|
||||
|
||||
bool isGPSExist();
|
||||
|
||||
static double distance(double slat, double slon, double dlat, double dlon)
|
||||
{
|
||||
double R = 6378137; // Earth’s mean radius in meter
|
||||
double dLat = (dlat - slat) * 0.0174533; // degree to radian
|
||||
double dLong = (dlon - slon) * 0.0174533;
|
||||
double a = sin(dLat / 2) * sin(dLat / 2) +
|
||||
cos(slat * 0.0174533) * cos(dlat * 0.0174533) *
|
||||
sin(dLong / 2) * sin(dLong / 2);
|
||||
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
double d = R * c;
|
||||
return d;
|
||||
}
|
||||
#if (TOGGLE_PLAYER || USE_MAXIMIZE)
|
||||
void snapTo(QWidget* target);
|
||||
#endif
|
||||
#if (USE_HTML_MAP)
|
||||
void removeHtml();
|
||||
#endif
|
||||
|
||||
#if (KMH_MPH_TOGGLE)
|
||||
#if (MODEL_BBVIEWER)
|
||||
RMSpeedLabel* speedLabel;
|
||||
#endif
|
||||
void refreshSpeedBarUnit();
|
||||
#endif
|
||||
|
||||
void runScript(QString script);
|
||||
|
||||
private:
|
||||
double lonX;
|
||||
double latY;
|
||||
double speed;
|
||||
RMSensorData* sensor;
|
||||
// 기존 위치 확인해서 2초 이상 점프시 라인 그리지 않는다 SEEK
|
||||
qint64 _lastPosition;
|
||||
|
||||
// 연속 그리기 방지
|
||||
QMap<QString,bool> _drawList;
|
||||
QString _packLine(double lon1, double lat1, double lon2, double lat2);
|
||||
|
||||
bool _bFirst;
|
||||
bool _bHTMLLoaded;
|
||||
explicit RMDialogMap(QWidget *parent = nullptr);
|
||||
bool _hideOnFullScreen;
|
||||
void initHtml();
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
#endif
|
||||
|
||||
#if (TOGGLE_PLAYER)
|
||||
QWidget* snapTarget;
|
||||
#endif
|
||||
|
||||
#if !(TOGGLE_PLAYER)
|
||||
QLabel* highLable; // 고속 MPH 의 경우 변경하기 위해
|
||||
QLabel* lowLable;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#if !(TOGGLE_PLAYER)
|
||||
TitleWidget* _title;
|
||||
#endif
|
||||
QVBoxLayout* _layout;
|
||||
RMWidgetMap* _map;
|
||||
#if !(TOGGLE_PLAYER)
|
||||
RMWidgetDrag* _drag;
|
||||
#endif
|
||||
|
||||
void moveTo(double lon, double lat, double speed, bool drawLine);
|
||||
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
RMMapUpdater updater;
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void refreshLanguage();
|
||||
#endif
|
||||
|
||||
//#if (TOGGLE_PLAYER)
|
||||
// // SNAP
|
||||
// bool eventFilter(QObject *o, QEvent *e) override;
|
||||
//#endif
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onClose();
|
||||
void onAppEvent(RMApp::Event event,int param);
|
||||
void activexEventHandler(const QString &name, int argc, void *argv);
|
||||
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
void onMoveToProcess(double lon, double lat, double speed, bool drawLine);
|
||||
#endif
|
||||
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
|
||||
#if (KMH_MPH_TOGGLE)
|
||||
void onSpeedUnitChange();
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // #if !(USE_WEBVIEW2)
|
||||
#endif // #if !(DO_NOT_USE_MAP)
|
||||
#endif // RM_DIALOG_MAP_H
|
||||
206
project/fm_viewer/ui/rm_dialog_overwrite.cpp
Normal file
206
project/fm_viewer/ui/rm_dialog_overwrite.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
#include "rm_dialog_overwrite.h"
|
||||
#include "../data/rm_overwrite.h"
|
||||
#include "../rm_include.h"
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QCheckBox>
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "rm_button.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
// ファイルの保存
|
||||
#if (FORCE_FM_STRING)
|
||||
RMDialogOverwrite::RMDialogOverwrite(QWidget *parent) : RMPopup(parent,FMS::txt("backup_title"),"")
|
||||
#else
|
||||
RMDialogOverwrite::RMDialogOverwrite(QWidget *parent) : RMPopup(parent,MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\xae\xe4\xbf\x9d\xe5\xad\x98"),"")
|
||||
#endif
|
||||
{
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
this->setFixedSize(392,206);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(20,13,20,13);
|
||||
QWidget* bg = _contentWidget;
|
||||
QVBoxLayout* contentLayout = layout;
|
||||
|
||||
contentLayout->setSpacing(14);
|
||||
RMLayout::addThemeLabel(bg,contentLayout,FMS::txt("file_exist"),"version_label");
|
||||
RMLayout::addThemeLabel(bg,contentLayout,RMOverwrite::currentFileName,"version_label");
|
||||
|
||||
if(RMOverwrite::currentCount > 1) {
|
||||
// 동일한 작업을 다음의
|
||||
// 파일에도 적용
|
||||
QString allString = FMS::txt("apply_rule") + \
|
||||
QString::number(RMOverwrite::currentCount) + \
|
||||
FMS::txt("after_files");
|
||||
// 同じ処理を次の%d個の競合に適用
|
||||
_chkBox = new QCheckBox(this);
|
||||
_chkBox->setObjectName("popup");
|
||||
_chkBox->setText(allString);
|
||||
contentLayout->addWidget(_chkBox);
|
||||
}
|
||||
else {
|
||||
_chkBox = NULL;
|
||||
}
|
||||
|
||||
RMButton* skipButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","skip",QSize(120,30));
|
||||
skipButton->setText(FMS::txt("skip"));
|
||||
connect(skipButton,SIGNAL(clicked()),this,SLOT(onSkip()));
|
||||
|
||||
RMButton* overwriteButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","overwrite",QSize(120,30));
|
||||
overwriteButton->setText(FMS::txt("overwrite"));
|
||||
connect(overwriteButton,SIGNAL(clicked()),this,SLOT(onOverwrite()));
|
||||
|
||||
RMButton* cancelButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","cancel",QSize(120,30));
|
||||
cancelButton->setText(FMS::txt("cancel"));
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
#else // RM_MODEL_EMT_KR
|
||||
#if !(FORCE_FM_STRING)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
bool bJP = RMLanguage::isJP();
|
||||
if(bJP == false)
|
||||
{
|
||||
_title->titleLabel->setText("Backup files");
|
||||
}
|
||||
#endif
|
||||
#endif //FORCE_FM_STRING
|
||||
|
||||
this->setFixedSize(392,266);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
contentLayout->setSpacing(18);
|
||||
contentLayout->setMargin(10);
|
||||
#if (FORCE_FM_STRING)
|
||||
RMLayout::addLabel(bg,contentLayout,FMS::txt("file_exist"),"text_header_label");
|
||||
#else
|
||||
QString fileExistString = MKU8("\xe3\x81\x93\xe3\x81\xae\xe5\xa0\xb4\xe6\x89\x80\xe3\x81\xab\xe5\x90\x8c\xe3\x81\x98\xe5\x90\x8d\xe5\x89\x8d\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(bJP == false)
|
||||
{
|
||||
fileExistString = "File already exists.";
|
||||
}
|
||||
#endif
|
||||
RMLayout::addLabel(bg,contentLayout,fileExistString,"text_header_label");
|
||||
#endif
|
||||
|
||||
RMLayout::addLabel(bg,contentLayout,RMOverwrite::currentFileName,"text_header_label");
|
||||
if(RMOverwrite::currentCount > 1) {
|
||||
#if (FORCE_FM_STRING)
|
||||
// 同じ処理を次の
|
||||
// 個の競合に適用
|
||||
// 동일한 작업을 다음의
|
||||
// 파일에도 적용
|
||||
QString allString = FMS::txt("apply_rule") + \
|
||||
QString::number(RMOverwrite::currentCount) + \
|
||||
FMS::txt("after_files");
|
||||
#else // FORCE_FM_STRING
|
||||
QString allString = MKU8("\xe5\x90\x8c\xe3\x81\x98\xe5\x87\xa6\xe7\x90\x86\xe3\x82\x92\xe6\xac\xa1\xe3\x81\xae") + \
|
||||
QString::number(RMOverwrite::currentCount) + \
|
||||
MKU8("\xe5\x80\x8b\xe3\x81\xae\xe7\xab\xb6\xe5\x90\x88\xe3\x81\xab\xe9\x81\xa9\xe7\x94\xa8");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(bJP == false)
|
||||
{
|
||||
allString = "Apply to next " + QString::number(RMOverwrite::currentCount) + " files.";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// 同じ処理を次の%d個の競合に適用
|
||||
_chkBox = new QCheckBox(this);
|
||||
_chkBox->setObjectName("popup");
|
||||
_chkBox->setText(allString);
|
||||
contentLayout->addWidget(_chkBox);
|
||||
}
|
||||
else {
|
||||
_chkBox = NULL;
|
||||
}
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* skipButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","skip",QSize(120,30));
|
||||
#else
|
||||
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("skip"),QSize(120,30));
|
||||
#endif
|
||||
skipButton->setText(FMS::txt("skip"));
|
||||
#else
|
||||
// スキップ
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString skipString = bJP ? MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97") : "Skip";
|
||||
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",skipString,QSize(120,30));
|
||||
skipButton->setText(skipString);
|
||||
#else
|
||||
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97"),QSize(120,30));
|
||||
skipButton->setText(MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97"));
|
||||
#endif
|
||||
#endif
|
||||
connect(skipButton,SIGNAL(clicked()),this,SLOT(onSkip()));
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* overwriteButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","overwrite",QSize(120,30));
|
||||
#else
|
||||
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("overwrite"),QSize(120,30));
|
||||
#endif
|
||||
overwriteButton->setText(FMS::txt("overwrite"));
|
||||
#else
|
||||
// 置き換える
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString overwriteString = bJP ? MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b") : "Overwrite";
|
||||
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",overwriteString,QSize(120,30));
|
||||
overwriteButton->setText(overwriteString);
|
||||
#else
|
||||
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b"),QSize(120,30));
|
||||
overwriteButton->setText(MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b"));
|
||||
#endif
|
||||
#endif // FORCE_FM_STRING
|
||||
connect(overwriteButton,SIGNAL(clicked()),this,SLOT(onOverwrite()));
|
||||
|
||||
// キャンセル
|
||||
#if (FORCE_FM_STRING)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* cancelButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","cancel",QSize(120,30));
|
||||
#else
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("cancel"),QSize(120,30));
|
||||
#endif
|
||||
cancelButton->setText(FMS::txt("cancel"));
|
||||
#else
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString cancelString = bJP ? MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab") : "Cancel";
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",cancelString,QSize(120,30));
|
||||
cancelButton->setText(cancelString);
|
||||
#else
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab"),QSize(120,30));
|
||||
cancelButton->setText(MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab"));
|
||||
#endif
|
||||
#endif
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
#endif // #else // RM_MODEL_EMT_KR
|
||||
}
|
||||
|
||||
void RMDialogOverwrite::onSkip()
|
||||
{
|
||||
if(_chkBox != NULL) {
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_SKIP | (_chkBox->isChecked() ? OVERWRITE_OPTION_ALL : 0);
|
||||
}
|
||||
else {
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_SKIP;
|
||||
}
|
||||
accept();
|
||||
}
|
||||
void RMDialogOverwrite::onOverwrite()
|
||||
{
|
||||
if(_chkBox != NULL) {
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_WRITE | (_chkBox->isChecked() ? OVERWRITE_OPTION_ALL : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_WRITE;
|
||||
}
|
||||
accept();
|
||||
}
|
||||
20
project/fm_viewer/ui/rm_dialog_overwrite.h
Normal file
20
project/fm_viewer/ui/rm_dialog_overwrite.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef RM_DIALOG_OVERWRITE_H
|
||||
#define RM_DIALOG_OVERWRITE_H
|
||||
|
||||
#include "rm_popup.h"
|
||||
class QCheckBox;
|
||||
class RMDialogOverwrite : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMDialogOverwrite(QWidget *parent = nullptr);
|
||||
private:
|
||||
QCheckBox* _chkBox;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onSkip();
|
||||
void onOverwrite();
|
||||
};
|
||||
|
||||
#endif // RM_DIALOG_OVERWRITE_H
|
||||
111
project/fm_viewer/ui/rm_dialog_overwrite_sys.cpp
Normal file
111
project/fm_viewer/ui/rm_dialog_overwrite_sys.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
#include "rm_dialog_overwrite_sys.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include "../rm_include.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
RMDialogOverwriteSys::RMDialogOverwriteSys(QWidget *parent,QString fileName) : QDialog(parent,Qt::WindowCloseButtonHint)
|
||||
{
|
||||
#if (FORCE_FM_STRING)
|
||||
QString title = FMS::txt("backup_title");
|
||||
#else
|
||||
QString title = MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\xae\xe4\xbf\x9d\xe5\xad\x98");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
title = "Backup files";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
setWindowTitle(title);
|
||||
setFixedSize(316,151);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
QLabel* fileNameLabel = new QLabel(this);
|
||||
fileNameLabel->setText(fileName);
|
||||
layout->addWidget(fileNameLabel);
|
||||
fileNameLabel->setStyleSheet("font-size: 13px;");
|
||||
|
||||
QLabel* messageLabel = new QLabel(this);
|
||||
#if (FORCE_FM_STRING)
|
||||
QString message = FMS::txt("file_exist");
|
||||
#else
|
||||
QString message = MKU8("\xe3\x81\x93\xe3\x81\xae\xe5\xa0\xb4\xe6\x89\x80\xe3\x81\xab\xe5\x90\x8c\xe3\x81\x98\xe5\x90\x8d\xe5\x89\x8d\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
bool bJP = RMLanguage::isJP();
|
||||
if(bJP == false)
|
||||
{
|
||||
message = "File already exists.";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
messageLabel->setText(message);
|
||||
layout->addWidget(messageLabel);
|
||||
messageLabel->setStyleSheet("font-size: 13px;");
|
||||
|
||||
QSpacerItem* space = new QSpacerItem(0,35);
|
||||
layout->addSpacerItem(space);
|
||||
|
||||
QWidget* buttonWidget = new QWidget(this);
|
||||
layout->addWidget(buttonWidget);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonWidget);
|
||||
|
||||
QSize btnSize = QSize(90,24);
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QPushButton* skipButton = new QPushButton(buttonWidget);
|
||||
skipButton->setText(FMS::txt("skip"));
|
||||
#else
|
||||
// スキップ
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString skipString = bJP ? MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97") : "Skip";
|
||||
QPushButton* skipButton = new QPushButton(buttonWidget);
|
||||
skipButton->setText(skipString);
|
||||
#else
|
||||
QPushButton* skipButton = new QPushButton(buttonWidget);
|
||||
skipButton->setText(MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97"));
|
||||
#endif
|
||||
#endif // FORCE_FM_STRING
|
||||
buttonLayout->addWidget(skipButton);
|
||||
skipButton->setStyleSheet("font-size: 14px;");
|
||||
skipButton->setFixedSize(btnSize);
|
||||
connect(skipButton,SIGNAL(clicked()),SLOT(reject()));
|
||||
|
||||
QPushButton* btnOverwrite = new QPushButton(buttonWidget);
|
||||
#if (FORCE_FM_STRING)
|
||||
btnOverwrite->setText(FMS::txt("overwrite"));
|
||||
#else
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString overwriteString = bJP ? MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b") : "Overwrite";
|
||||
btnOverwrite->setText(overwriteString);
|
||||
#else
|
||||
btnOverwrite->setText(MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b"));
|
||||
#endif
|
||||
#endif // FORCE_FM_STRING
|
||||
buttonLayout->addWidget(btnOverwrite);
|
||||
btnOverwrite->setStyleSheet("font-size: 14px;");
|
||||
btnOverwrite->setFixedSize(btnSize);
|
||||
connect(btnOverwrite,SIGNAL(clicked()),SLOT(accept()));
|
||||
btnOverwrite->setFocus();
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QString cancelString = FMS::txt("cancel");
|
||||
#else
|
||||
QString cancelString = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
cancelString = "Cancel";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
QPushButton* btnCancel = new QPushButton(buttonWidget);
|
||||
btnCancel->setText(cancelString);
|
||||
buttonLayout->addWidget(btnCancel);
|
||||
btnCancel->setStyleSheet("font-size: 14px;");
|
||||
btnCancel->setFixedSize(btnSize);
|
||||
connect(btnCancel,SIGNAL(clicked()),SLOT(reject()));
|
||||
}
|
||||
16
project/fm_viewer/ui/rm_dialog_overwrite_sys.h
Normal file
16
project/fm_viewer/ui/rm_dialog_overwrite_sys.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef RM_DIALOG_OVERWRITE_SYS_H
|
||||
#define RM_DIALOG_OVERWRITE_SYS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class RMDialogOverwriteSys : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMDialogOverwriteSys(QWidget *parent = nullptr,QString fileName = "");
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // RM_DIALOG_OVERWRITE_SYS_H
|
||||
150
project/fm_viewer/ui/rm_dialog_progress.cpp
Normal file
150
project/fm_viewer/ui/rm_dialog_progress.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
#include "rm_dialog_progress.h"
|
||||
#include "../rm_include.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "title_widget.h"
|
||||
#include "../rm_app.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
#include "../data/rm_overwrite.h"
|
||||
#include "fm_button.h"
|
||||
#include "fm_colors.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
|
||||
RMDialogProgress* RMDialogProgress::_progress = NULL;
|
||||
|
||||
void RMDialogProgress::start(QString title,bool bCancel,bool bFileList)
|
||||
{
|
||||
stop();
|
||||
|
||||
RMDialogProgress::_progress = new RMDialogProgress(RMApp::instance()->pMainWindow,title,bCancel,bFileList);
|
||||
RMDialogProgress::_progress->show();
|
||||
|
||||
connect(RMVideoFileList::instance(),SIGNAL(updateProgress(int)),RMDialogProgress::_progress,SLOT(onUpdateValue(int)));
|
||||
|
||||
}
|
||||
void RMDialogProgress::stop()
|
||||
{
|
||||
if(RMDialogProgress::_progress != NULL)
|
||||
{
|
||||
RMDialogProgress::_progress->setHidden(true);
|
||||
delete RMDialogProgress::_progress;
|
||||
RMDialogProgress::_progress = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RMDialogProgress::RMDialogProgress(QWidget *parent, QString title, bool bCancel, bool bFileList) : QDialog(parent)
|
||||
{
|
||||
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
|
||||
|
||||
this->setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
this->setFixedSize(414,bCancel ? 140 : 100);
|
||||
|
||||
_layout = new QVBoxLayout(this);
|
||||
_layout->setSpacing(0);
|
||||
_layout->setMargin(0);
|
||||
|
||||
_title = new TitleWidget(this,title,"",true);
|
||||
_layout->addWidget(_title);
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QWidget* contentWidget = new QWidget(this);
|
||||
FMWidgetBackground(contentWidget,"dialog_bg",0x3a3a3a);
|
||||
//contentWidget->setObjectName("bg_widget");
|
||||
_layout->addWidget(contentWidget);
|
||||
|
||||
QBoxLayout* contentLayout = new QHBoxLayout(contentWidget);
|
||||
contentLayout->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||
|
||||
QWidget* borderWidget = new QWidget(contentWidget);
|
||||
FMWidgetBorder(borderWidget,"dialog_border",0x595959);
|
||||
borderWidget->setFixedSize(398,46);
|
||||
contentLayout->addWidget(borderWidget);
|
||||
|
||||
QBoxLayout* borderLayout = new QHBoxLayout(borderWidget);
|
||||
borderLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
_progressBar = new QProgressBar(borderWidget);
|
||||
_progressBar->setTextVisible(false);
|
||||
_progressBar->setFixedSize(364,16);
|
||||
_progressBar->setMaximum(PROGRESS_BAR_MAX);
|
||||
_progressBar->setMinimum(0);
|
||||
_progressBar->setValue(0);
|
||||
|
||||
|
||||
QString progressStyle = "QProgressBar\
|
||||
{\
|
||||
background-color: white;\
|
||||
border-style: none;\
|
||||
}\
|
||||
QProgressBar::chunk\
|
||||
{\
|
||||
background-color: #%color%;\
|
||||
}";
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
progressStyle = progressStyle.replace("%color%",QString().sprintf("%06X",FM_TEHEM_COLOR_P1));
|
||||
#else
|
||||
progressStyle = progressStyle.replace("%color%",QString().sprintf("%06X",FM_SILDER_COLOR));
|
||||
#endif
|
||||
|
||||
_progressBar->setStyleSheet(progressStyle);
|
||||
|
||||
borderLayout->addWidget(_progressBar);
|
||||
|
||||
_bFileList = bFileList;
|
||||
|
||||
if(bCancel) {
|
||||
|
||||
QWidget* buttonWidget = new QWidget(this);
|
||||
buttonWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
//buttonWidget->setObjectName("bg_widget");
|
||||
FMWidgetBackground(buttonWidget,"dialog_bg",0x595959);
|
||||
buttonWidget->setFixedHeight(43); // 65??
|
||||
_layout->addWidget(buttonWidget);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonWidget);
|
||||
buttonLayout->setSpacing(0);
|
||||
buttonLayout->setMargin(0);
|
||||
#if (FORCE_FM_STRING)
|
||||
QString cancelString = FMS::txt("cancel");
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* calcelButton = RMButton::create2(buttonWidget,buttonLayout,"popup_button","cancel",QSize(120,30));
|
||||
#else // LIVE_LANGUAGE2
|
||||
//FMButton* calcelButton = FMButton::btnTypeText(buttonWidget,buttonLayout,cancelString,cancelString,QSize(120,30),g_default_text_button_color_set);
|
||||
RMButton* calcelButton = RMButton::create(buttonWidget,buttonLayout,"popup_button",cancelString,QSize(120,30));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#else // FORCE_FM_STRING
|
||||
QString cancelString = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
cancelString = "Cancel";
|
||||
}
|
||||
#endif
|
||||
RMButton* calcelButton = RMButton::create(buttonWidget,buttonLayout,"popup_button",cancelString,QSize(120,30));
|
||||
#endif // FORCE_FM_STRING
|
||||
calcelButton->setText(cancelString);
|
||||
connect(calcelButton,SIGNAL(clicked()),this,SLOT(onCancel()));
|
||||
}
|
||||
|
||||
}
|
||||
void RMDialogProgress::onCancel()
|
||||
{
|
||||
if(!_bFileList) {
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
//setHidden(true);
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_CANCEL;
|
||||
//emit cancelProcess();
|
||||
}
|
||||
#if (SUPPORT_LOADING_CANCEL)
|
||||
// 로딩 취소
|
||||
RMVideoFileList::instance()->bCancelLoading = true;
|
||||
#endif // SUPPORT_LOADING_CANCEL
|
||||
}
|
||||
|
||||
void RMDialogProgress::onUpdateValue(int value)
|
||||
{
|
||||
_progressBar->setValue(value);
|
||||
//qInfo() << "RMProgressDialog:" << value;
|
||||
}
|
||||
54
project/fm_viewer/ui/rm_dialog_progress.h
Normal file
54
project/fm_viewer/ui/rm_dialog_progress.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef RM_PROGRESS_DIALOG_H
|
||||
#define RM_PROGRESS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QProgressBar>
|
||||
#include <QDebug>
|
||||
#include <QMutexLocker>
|
||||
|
||||
class TitleWidget;
|
||||
class RMDialogProgress : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void start(QString title,bool bCancel = false,bool bFileList = false);
|
||||
static void stop();
|
||||
|
||||
static void pause() {
|
||||
if(RMDialogProgress::_progress != NULL) {
|
||||
//qInfo() << "pause";
|
||||
RMDialogProgress::_progress->setHidden(true);
|
||||
}
|
||||
}
|
||||
static void resume() {
|
||||
if(RMDialogProgress::_progress != NULL) {
|
||||
//qInfo() << "resume";
|
||||
RMDialogProgress::_progress->setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
explicit RMDialogProgress(QWidget *parent = nullptr,QString title = "",bool bCancel = false, bool bFileList = false);
|
||||
static RMDialogProgress* _progress;
|
||||
|
||||
static QMutexLocker* lock;
|
||||
static QMutex mutex;
|
||||
bool _bFileList; // 파일리스트 로딩 모드
|
||||
|
||||
protected:
|
||||
TitleWidget* _title;
|
||||
QVBoxLayout* _layout;
|
||||
QProgressBar* _progressBar;
|
||||
|
||||
signals:
|
||||
//void cancelProcess();
|
||||
|
||||
public slots:
|
||||
void onUpdateValue(int value);
|
||||
void onCancel();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RM_PROGRESS_DIALOG_H
|
||||
137
project/fm_viewer/ui/rm_eq_widget.cpp
Normal file
137
project/fm_viewer/ui/rm_eq_widget.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
#include "rm_eq_widget.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include "rm_button.h"
|
||||
#include "../rm_include.h"
|
||||
#include "rm_slider.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../core/rm_language.h"
|
||||
|
||||
#if (MODEL_BBVIEWER)
|
||||
RMEQWidget::RMEQWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
#if (MODEL_WATEX)
|
||||
setFixedSize(202,167);
|
||||
setObjectName("eq_widget");
|
||||
#else
|
||||
setFixedWidth(104);
|
||||
#endif
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
// LINE
|
||||
// 再生速度
|
||||
RMButton* speedButton = NULL;
|
||||
_addLine(MKU8("\xe5\x86\x8d\xe7\x94\x9f\xe9\x80\x9f\xe5\xba\xa6"),":/image/icon_pbspeed.png",&speedButton,0);
|
||||
RMLanguage::instance()->appendENGToolTip(speedButton,"Playback speed");
|
||||
connect(speedButton,SIGNAL(clicked()),SLOT(onDefaultSpeed()));
|
||||
layout->addSpacerItem(new QSpacerItem(0,5));
|
||||
|
||||
RMButton* brightnessButton = NULL;
|
||||
_addLine(MKU8("\xe6\x98\x8e\xe3\x82\x8b\xe3\x81\x95"),":/image/icon_brightness.png",&brightnessButton,1);
|
||||
RMLanguage::instance()->appendENGToolTip(brightnessButton,"Brightness");
|
||||
|
||||
connect(brightnessButton,SIGNAL(clicked()),SLOT(onDefaultBrightness()));
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(0,5));
|
||||
|
||||
RMButton* contrastButton = NULL;
|
||||
_addLine(MKU8("\xe3\x82\xb3\xe3\x83\xb3\xe3\x83\x88\xe3\x83\xa9\xe3\x82\xb9\xe3\x83\x88"),":/image/icon_contrast.png",&contrastButton,2);
|
||||
RMLanguage::instance()->appendENGToolTip(contrastButton,"Contrast");
|
||||
connect(contrastButton,SIGNAL(clicked()),SLOT(onDefaultContrast()));
|
||||
|
||||
RMPlayer* player = RMPlayer::instance();
|
||||
|
||||
player->setEQFrame(this);
|
||||
|
||||
|
||||
connect(brightnessSlider, SIGNAL(sliderPressed()),player, SLOT(onSetBrightness()));
|
||||
connect(brightnessSlider, SIGNAL(valueChanged(int)),player, SLOT(onSetBrightness()));
|
||||
|
||||
connect(contrastSlider, SIGNAL(sliderPressed()),player, SLOT(onSetContrast()));
|
||||
connect(contrastSlider, SIGNAL(valueChanged(int)),player, SLOT(onSetContrast()));
|
||||
|
||||
}
|
||||
void RMEQWidget::_addLine(QString toolTip,QString icon,RMButton** btn, int type)
|
||||
{
|
||||
#if (MODEL_WATEX)
|
||||
QSize buttonSize = QSize(32,32);
|
||||
int spacing = 10;
|
||||
int margin = 8;
|
||||
#else
|
||||
QSize buttonSize = QSize(25,25);
|
||||
int spacing = 0;
|
||||
int margin = 0;
|
||||
#endif
|
||||
QWidget* lineWidget = new QWidget(this);
|
||||
layout->addWidget(lineWidget);
|
||||
QHBoxLayout* lineLayout = new QHBoxLayout(lineWidget);
|
||||
lineLayout->setMargin(margin);
|
||||
lineLayout->setSpacing(spacing);
|
||||
RMButton* bn = RMButton::create(lineWidget,lineLayout,"",toolTip,buttonSize);
|
||||
bn->setIcon(QPixmap(icon));
|
||||
bn->setIconSize(buttonSize);
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
speedSlider = new RMReleasedSlider(lineWidget);
|
||||
speedSlider->setObjectName("normal");
|
||||
speedSlider->setTickInterval(1);
|
||||
speedSlider->setValue(2); // 1.0 = 2
|
||||
speedSlider->setRange(0,4);
|
||||
lineLayout->addWidget(speedSlider);
|
||||
//speedSlider->setTickPosition(QSlider::TicksBothSides);
|
||||
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
brightnessSlider = new RMSlider(lineWidget);
|
||||
brightnessSlider->setObjectName("normal");
|
||||
brightnessSlider->setRange(0,100);
|
||||
brightnessSlider->setValue(50);
|
||||
lineLayout->addWidget(brightnessSlider);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
contrastSlider = new RMSlider(lineWidget);
|
||||
contrastSlider->setObjectName("normal");
|
||||
contrastSlider->setRange(0,100);
|
||||
contrastSlider->setValue(50);
|
||||
lineLayout->addWidget(contrastSlider);
|
||||
}
|
||||
lineLayout->addSpacerItem(new QSpacerItem(10,0));
|
||||
*btn = bn;
|
||||
}
|
||||
|
||||
void RMEQWidget::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter painter(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this);
|
||||
}
|
||||
|
||||
void RMEQWidget::onDefaultSpeed()
|
||||
{
|
||||
speedSlider->setValue(2);
|
||||
RMPlayer::instance()->updateSpeedForce(1.0);
|
||||
// emit speedSlider->sliderMoved(2);
|
||||
// emit speedSlider->sliderReleased();
|
||||
//RMPlayer::instance()->updateSpeed(1.0);
|
||||
}
|
||||
void RMEQWidget::onDefaultBrightness()
|
||||
{
|
||||
brightnessSlider->setValue(50);
|
||||
}
|
||||
void RMEQWidget::onDefaultContrast()
|
||||
{
|
||||
contrastSlider->setValue(50);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // #if (MODEL_BBVIEWER)
|
||||
33
project/fm_viewer/ui/rm_eq_widget.h
Normal file
33
project/fm_viewer/ui/rm_eq_widget.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef RM_EQ_WIDGET_H
|
||||
#define RM_EQ_WIDGET_H
|
||||
#if (MODEL_BBVIEWER)
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
class RMButton;
|
||||
class RMReleasedSlider;
|
||||
class RMSlider;
|
||||
|
||||
class RMEQWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMEQWidget(QWidget *parent = nullptr);
|
||||
RMReleasedSlider* speedSlider;
|
||||
RMSlider* brightnessSlider;
|
||||
RMSlider* contrastSlider;
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
QVBoxLayout* layout;
|
||||
|
||||
void _addLine(QString toolTip,QString icon,RMButton** btn, int type);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onDefaultSpeed();
|
||||
void onDefaultBrightness();
|
||||
void onDefaultContrast();
|
||||
};
|
||||
#endif // #if (MODEL_BBVIEWER)
|
||||
#endif // RM_EQ_WIDGET_H
|
||||
33
project/fm_viewer/ui/rm_filename_title.cpp
Normal file
33
project/fm_viewer/ui/rm_filename_title.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "rm_filename_title.h"
|
||||
#if (MODEL_WATEX)
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileInfo>
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
RMFileNameTitle::RMFileNameTitle(QWidget *parent) : RMWidgetStyleBase(parent,"frame_filename",false)
|
||||
{
|
||||
RMPlayer* player = RMPlayer::instance();
|
||||
connect(player,SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(10,0,0,0);
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
titleLabel = new QLabel(this);
|
||||
titleLabel->setObjectName("title_filename");
|
||||
layout->addWidget(titleLabel);
|
||||
titleLabel->setText("");
|
||||
}
|
||||
void RMFileNameTitle::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
if(event == PLAY_DID_LIST_SELECTED && item != NULL)
|
||||
{
|
||||
QFileInfo info = QFileInfo(item->anyFilePath());
|
||||
titleLabel->setText(info.fileName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // #if (MODEL_WATEX)
|
||||
24
project/fm_viewer/ui/rm_filename_title.h
Normal file
24
project/fm_viewer/ui/rm_filename_title.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef RM_FILENAME_TITLE_H
|
||||
#define RM_FILENAME_TITLE_H
|
||||
#if (MODEL_WATEX)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../core/rm_player_base.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
|
||||
class RMFileNameTitle : public RMWidgetStyleBase
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLabel* titleLabel;
|
||||
public:
|
||||
explicit RMFileNameTitle(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
};
|
||||
|
||||
#endif //MODEL_WATEX
|
||||
#endif // RM_FILENAME_TITLE_H
|
||||
169
project/fm_viewer/ui/rm_frame_bottom.cpp
Normal file
169
project/fm_viewer/ui/rm_frame_bottom.cpp
Normal file
@@ -0,0 +1,169 @@
|
||||
#include "rm_frame_bottom.h"
|
||||
#include "rm_button.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include <QDesktopWidget>
|
||||
|
||||
RMFrameBottom::RMFrameBottom(QWidget *parent) : RMWidgetStyleBase(parent,"",true)
|
||||
{
|
||||
setObjectName("player_bg");
|
||||
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignLeft);
|
||||
|
||||
//bFrontCamera = true;
|
||||
|
||||
sliderControl = NULL;
|
||||
playControl = NULL;
|
||||
|
||||
bToggleEnabled = true;
|
||||
|
||||
#if (!DUAL_VIEWER)
|
||||
#if (MODEL_STANDARD)
|
||||
QWidget* cameraControl = new QWidget(this);
|
||||
cameraControl->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
cameraControl->setFixedWidth(120*2);
|
||||
layout->addWidget(cameraControl);
|
||||
QHBoxLayout* cameraLayout = new QHBoxLayout(cameraControl);
|
||||
cameraLayout->setAlignment(Qt::AlignCenter);
|
||||
cameraLayout->setSpacing(0);
|
||||
cameraLayout->setMargin(0);
|
||||
|
||||
#if (REAR_CAMERA_INSIDE)
|
||||
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_inside",QString(""),QSize(110,34));
|
||||
#elif (FRONT_CAMERA_MAIN)
|
||||
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_main",QString(""),QSize(110,34));
|
||||
#elif (FRONT_CAMERA_NAME_FRONT)
|
||||
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_front",QString(""),QSize(110,34));
|
||||
#else
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
frontCamera = RMButton::create2(cameraControl,cameraLayout,"front_camera",NULL,QSize(110,34));
|
||||
#else // LIVE_LANGUAGE2
|
||||
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera",QString(""),QSize(110,34));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#endif
|
||||
frontCamera->setEnabled(false);
|
||||
frontCamera->setStyleStatus("on",true);
|
||||
#if !(SINGLE_CH_VIEWER)
|
||||
connect(frontCamera,SIGNAL(clicked()),RMPlayer::instance(),SLOT(toggleSwap()));
|
||||
#endif
|
||||
#if (REAR_CAMERA_INSIDE)
|
||||
rearCamera = RMButton::create(cameraControl,cameraLayout,"rear_camera_inside",QString(""),QSize(110,34));
|
||||
#else
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
rearCamera = RMButton::create2(cameraControl,cameraLayout,"rear_camera",NULL,QSize(110,34));
|
||||
#else // LIVE_LANGUAGE2
|
||||
rearCamera = RMButton::create(cameraControl,cameraLayout,"rear_camera",QString(""),QSize(110,34));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif
|
||||
rearCamera->setStyleStatus("on",false);
|
||||
#if !(SINGLE_CH_VIEWER)
|
||||
connect(rearCamera,SIGNAL(clicked()),RMPlayer::instance(),SLOT(toggleSwap()));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (SINGLE_CH_VIEWER)
|
||||
frontCamera->setEnabled(false);
|
||||
rearCamera->setEnabled(false);
|
||||
#else
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT, RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT, RMVideoItem*)));
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !DUAL_VIEWER
|
||||
|
||||
|
||||
|
||||
|
||||
this->setFixedHeight(BOTTOM_FRAME_HEIGHT);
|
||||
setHidden(true);
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
refreshLanguage();
|
||||
#endif
|
||||
//_rightMargin = NULL;
|
||||
}
|
||||
|
||||
void RMFrameBottom::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
setHidden(event != RMApp::WillFullScreen);
|
||||
}
|
||||
}
|
||||
#if !(SINGLE_CH_VIEWER)
|
||||
void RMFrameBottom::onPlayEvent(PLAY_EVENT event, RMVideoItem* item)
|
||||
{
|
||||
#if (DUAL_CH_FILE)
|
||||
Q_UNUSED(item)
|
||||
#endif
|
||||
|
||||
if(event == PLAY_DID_SWAPPED || event == PLAY_DID_UNSWAPPED){
|
||||
#if (MODEL_STANDARD)
|
||||
updateSwapStatus();
|
||||
#endif
|
||||
}
|
||||
else if(event == PLAY_DID_LOADED){
|
||||
|
||||
#if (DUAL_CH_FILE && DUAL_CH_1CH_EXIST)
|
||||
bToggleEnabled = (item->isSingleChannel() == false);
|
||||
#elif !(DUAL_CH_FILE)
|
||||
bToggleEnabled = !(item->filePath.isEmpty() || item->filePathCH2.isEmpty());
|
||||
#endif
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
updateSwapStatus();
|
||||
#endif
|
||||
}
|
||||
else if(event == PLAY_DID_USER_STOP){
|
||||
#if !(DUAL_CH_FILE)
|
||||
bToggleEnabled = true;
|
||||
#endif
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
updateSwapStatus();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // !SINGLE_CH_VIEWER
|
||||
|
||||
|
||||
#if (MODEL_STANDARD && !SINGLE_CH_VIEWER)
|
||||
void RMFrameBottom::updateSwapStatus()
|
||||
{
|
||||
bool bFrontCamera = (RMPlayer::instance()->isSwapped() == false);
|
||||
#if (DUAL_CH_FILE && !(DUAL_CH_1CH_EXIST))
|
||||
bToggleEnabled = true; // 항상 TRUE
|
||||
#endif
|
||||
frontCamera->setEnabled((!bFrontCamera && bToggleEnabled));
|
||||
frontCamera->setStyleStatus("on",bFrontCamera);
|
||||
|
||||
rearCamera->setEnabled((bFrontCamera && bToggleEnabled));
|
||||
rearCamera->setStyleStatus("on",!bFrontCamera);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void RMFrameBottom::refreshLanguage()
|
||||
{
|
||||
QString tag = RMLanguage::languageTag();
|
||||
frontCamera->updateObject("front_camera" + tag);
|
||||
rearCamera->updateObject("rear_camera" + tag);
|
||||
}
|
||||
void RMFrameBottom::onLanguageChange(RMLanguage::LANGUAGE_TYPE language)
|
||||
{
|
||||
Q_UNUSED(language)
|
||||
refreshLanguage();
|
||||
}
|
||||
#endif
|
||||
53
project/fm_viewer/ui/rm_frame_bottom.h
Normal file
53
project/fm_viewer/ui/rm_frame_bottom.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef RM_FRAME_BOTTOM_H
|
||||
#define RM_FRAME_BOTTOM_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../fm_event_types.h"
|
||||
//#include "../core/rm_player_base.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
|
||||
class RMBaseControl;
|
||||
class RMButton;
|
||||
class RMFrameBottom : public RMWidgetStyleBase
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class RMFrameLeft; // control layout
|
||||
|
||||
public:
|
||||
//bool bFrontCamera;
|
||||
explicit RMFrameBottom(QWidget *parent = nullptr);
|
||||
|
||||
RMBaseControl* sliderControl; // slider + speed control (created from left frame)
|
||||
RMBaseControl* playControl; // control (created from left frame)
|
||||
|
||||
#if (MODEL_STANDARD && !DUAL_VIEWER)
|
||||
RMButton* frontCamera;
|
||||
RMButton* rearCamera;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool bToggleEnabled;
|
||||
QHBoxLayout* layout;
|
||||
#if (MODEL_STANDARD && !SINGLE_CH_VIEWER)
|
||||
void updateSwapStatus();
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void refreshLanguage();
|
||||
#endif
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
|
||||
#if !(SINGLE_CH_VIEWER)
|
||||
void onPlayEvent(PLAY_EVENT event, RMVideoItem* item);
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // RM_FRAME_BOTTOM_H
|
||||
198
project/fm_viewer/ui/rm_frame_eq.cpp
Normal file
198
project/fm_viewer/ui/rm_frame_eq.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
#include "rm_frame_eq.h"
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
|
||||
#include "rm_slider.h"
|
||||
#include "fm_button.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "fm_colors.h"
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
#include "window_main.h"
|
||||
#endif // PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
RMFrameEQ::RMFrameEQ(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
_createLayouts();
|
||||
|
||||
}
|
||||
void RMFrameEQ::_createLayouts()
|
||||
{
|
||||
RMPlayer* player = RMPlayer::instance();
|
||||
|
||||
layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
LAYOUT_SPACE(layout,4,0);
|
||||
QSize btnSize = QSize(30,30);
|
||||
const int sliderWidth = 114;
|
||||
const int space = 20;
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
contrastBtn = FMButton::btn2(this,layout,"v_constrast","contrast",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
contrastBtn = FMButton::btn(this,layout,"v_constrast",FMS::txt("contrast"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
contrastSlider = new RMSlider(this);
|
||||
contrastSlider->setValue(50);
|
||||
contrastSlider->setFixedWidth(sliderWidth);
|
||||
FMSlider(contrastSlider,"small_slider",FM_SILDER_COLOR,0x666666,true);
|
||||
layout->addWidget(contrastSlider);
|
||||
connect(contrastBtn,SIGNAL(clicked()),SLOT(onDefaultContrast()));
|
||||
|
||||
|
||||
LAYOUT_SPACE(layout,space,0);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
brightnessBtn = FMButton::btn2(this,layout,"v_brightness","brightness",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
brightnessBtn = FMButton::btn(this,layout,"v_brightness",FMS::txt("brightness"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
brightnessSlider = new RMSlider(this);
|
||||
brightnessSlider->setValue(50);
|
||||
brightnessSlider->setFixedWidth(sliderWidth);
|
||||
FMSlider(brightnessSlider,"small_slider",FM_SILDER_COLOR,0x666666,true);
|
||||
layout->addWidget(brightnessSlider);
|
||||
connect(brightnessBtn,SIGNAL(clicked()),SLOT(onDefaultBrightness()));
|
||||
|
||||
connect(brightnessSlider, SIGNAL(sliderPressed()),player, SLOT(onSetBrightness()));
|
||||
connect(brightnessSlider, SIGNAL(valueChanged(int)),player, SLOT(onSetBrightness()));
|
||||
|
||||
connect(contrastSlider, SIGNAL(sliderPressed()),player, SLOT(onSetContrast()));
|
||||
connect(contrastSlider, SIGNAL(valueChanged(int)),player, SLOT(onSetContrast()));
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
LAYOUT_SPACE(layout,space,0);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
volumeBtn = FMButton::btnCheck2(this,layout,"v_volume","volume_mute",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
volumeBtn = FMButton::btnCheck(this,layout,"v_volume",FMS::txt("volume_mute"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
volumeBtn->setCheckable(true);
|
||||
connect(volumeBtn,SIGNAL(clicked()),player,SLOT(onMute()));
|
||||
|
||||
volumeSlider = new RMSlider(this);
|
||||
volumeSlider->setMinimum(0);
|
||||
volumeSlider->setMaximum(100);
|
||||
volumeSlider->setValue(50);
|
||||
volumeSlider->setFixedWidth(sliderWidth);
|
||||
FMSlider(volumeSlider,"small_slider",FM_SILDER_COLOR,0x666666,true);
|
||||
layout->addWidget(volumeSlider);
|
||||
|
||||
connect(volumeSlider, SIGNAL(sliderPressed()),player, SLOT(onSetVolume()));
|
||||
connect(volumeSlider, SIGNAL(valueChanged(int)),player, SLOT(onSetVolume()));
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
LAYOUT_SPACE(layout,space,0);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
speedBtn = FMButton::btn2(this,layout,"v_speed","play_speed",btnSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
speedBtn = FMButton::btn(this,layout,"v_speed",FMS::txt("play_speed"),btnSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
connect(speedBtn,SIGNAL(clicked()),SLOT(onDefaultSpeed()));
|
||||
speedSlider = new RMReleasedSlider(this);
|
||||
speedSlider->setTickInterval(1);
|
||||
speedSlider->setValue(DEFAULT_SPEED_INDEX); // 1.0 = 2
|
||||
speedSlider->setRange(0,PLAY_SPEED_COUNT-1);
|
||||
speedSlider->setFixedWidth(sliderWidth);
|
||||
FMSlider(speedSlider,"small_slider",FM_SILDER_COLOR,0x666666,true);
|
||||
layout->addWidget(speedSlider);
|
||||
|
||||
LAYOUT_SPACE(layout,5,0);
|
||||
speedLabel = new QLabel(this);
|
||||
speedLabel->setAlignment(Qt::AlignCenter);
|
||||
FMLabelBackground(speedLabel,"speed_label","Arial",0xf5f5f5,11,false,FM_SPEED_LABEL_BACK_COLOR); // 0x262626
|
||||
speedLabel->setText("1 x");
|
||||
|
||||
speedLabel->setFixedSize(25,16);
|
||||
layout->addWidget(speedLabel);
|
||||
|
||||
RMPlayer::instance()->setSpeedSlider(speedSlider,speedLabel);
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
RMPlayer::instance()->setVolumeSlider(volumeSlider);
|
||||
RMPlayer::instance()->setMuteButton(volumeBtn);
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
connect(player,SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
layout->addItem(new QSpacerItem(10,0));
|
||||
previousButton = FMButton::btn(this,layout,"vt_prev_file","play_file_previous",QSize(52,26));
|
||||
connect(previousButton, SIGNAL(released()),this,SLOT(onPlayPrevious()));
|
||||
|
||||
playButton = FMButton::btnCheck(this,layout,"splay_play","play_play",QSize(52,26));
|
||||
connect(playButton, SIGNAL(released()),this,SLOT(onPlayOrPause()));
|
||||
|
||||
nextButton = FMButton::btn(this,layout,"vt_next_file","play_file_next",QSize(52,26));
|
||||
connect(nextButton, SIGNAL(released()),this,SLOT(onPlayNext()));
|
||||
#endif // LIBRARY_MODE
|
||||
|
||||
}
|
||||
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
void RMFrameEQ::onPlayOrPause()
|
||||
{
|
||||
playButton->blockFor(150);
|
||||
RMPlayer::instance()->onPlayOrPause();
|
||||
}
|
||||
void RMFrameEQ::onPlayPrevious()
|
||||
{
|
||||
RMPlayer::instance()->stop();
|
||||
WindowMain* p = qobject_cast<WindowMain*>(RMApp::instance()->pMainWindow);
|
||||
p->_onTB5000(1);
|
||||
}
|
||||
void RMFrameEQ::onPlayNext()
|
||||
{
|
||||
RMPlayer::instance()->stop();
|
||||
WindowMain* p = qobject_cast<WindowMain*>(RMApp::instance()->pMainWindow);
|
||||
p->_onTB5000(2);
|
||||
}
|
||||
#endif // #if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
|
||||
|
||||
RMFrameEQ::~RMFrameEQ()
|
||||
{
|
||||
|
||||
}
|
||||
void RMFrameEQ::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
Q_UNUSED(item);
|
||||
if (event == PLAY_DID_MUTED || event == PLAY_DID_UNMUTED)
|
||||
{
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
bool bMuted = event == PLAY_DID_MUTED;
|
||||
// ミュートの解除 MKU8("\xe3\x83\x9f\xe3\x83\xa5\xe3\x83\xbc\xe3\x83\x88\xe3\x81\xae\xe8\xa7\xa3\xe9\x99\xa4")
|
||||
volumeBtn->setToolTip(bMuted ? FMS::txt("volume_un_mute") : FMS::txt("volume_mute"));
|
||||
volumeSlider->setEnabled(!bMuted);
|
||||
|
||||
volumeBtn->setChecked(bMuted);
|
||||
//qInfo() << __FUNCTION__ << bMuted;
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
}
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
if(event == PLAY_DID_PAUSED || event == PLAY_DID_PLAYED || event == PLAY_DID_CLEARED)
|
||||
{
|
||||
bool bShowPaused = (event == PLAY_DID_PLAYED);
|
||||
playButton->setChecked(bShowPaused);
|
||||
playButton->setToolTip(bShowPaused ? FMS::txt("play_pause") :FMS::txt("play_play"));
|
||||
}
|
||||
#endif // #if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
|
||||
}
|
||||
void RMFrameEQ::onDefaultSpeed()
|
||||
{
|
||||
speedSlider->setValue(DEFAULT_SPEED_INDEX);
|
||||
RMPlayer::instance()->updateSpeedForce(1.0);
|
||||
speedLabel->setText("1 x");
|
||||
}
|
||||
void RMFrameEQ::onDefaultBrightness()
|
||||
{
|
||||
brightnessSlider->setValue(50);
|
||||
}
|
||||
void RMFrameEQ::onDefaultContrast()
|
||||
{
|
||||
contrastSlider->setValue(50);
|
||||
}
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
|
||||
55
project/fm_viewer/ui/rm_frame_eq.h
Normal file
55
project/fm_viewer/ui/rm_frame_eq.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef RM_FRAME_EQ_H
|
||||
#define RM_FRAME_EQ_H
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
#include "rm_widget_base.h"
|
||||
#include "../fm_event_types.h"
|
||||
//#include "../core/rm_player_base.h"
|
||||
|
||||
class RMSlider;
|
||||
class RMReleasedSlider;
|
||||
class FMButton;
|
||||
class RMFrameEQ: public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QHBoxLayout* layout;
|
||||
void _createLayouts();
|
||||
public:
|
||||
explicit RMFrameEQ(QWidget *parent = nullptr);
|
||||
~RMFrameEQ();
|
||||
|
||||
FMButton* contrastBtn;
|
||||
RMSlider* contrastSlider;
|
||||
|
||||
FMButton* brightnessBtn;
|
||||
RMSlider* brightnessSlider;
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
FMButton* volumeBtn;
|
||||
RMSlider* volumeSlider;
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
FMButton* speedBtn;
|
||||
RMReleasedSlider* speedSlider;
|
||||
QLabel* speedLabel;
|
||||
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
FMButton* playButton;
|
||||
FMButton* previousButton;
|
||||
FMButton* nextButton;
|
||||
#endif // LIBRARY_MODE
|
||||
|
||||
public slots:
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
void onDefaultSpeed();
|
||||
void onDefaultBrightness();
|
||||
void onDefaultContrast();
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
void onPlayOrPause();
|
||||
void onPlayPrevious();
|
||||
void onPlayNext();
|
||||
#endif // PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
};
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
#endif // RM_FRAME_EQ_H
|
||||
224
project/fm_viewer/ui/rm_frame_graph.cpp
Normal file
224
project/fm_viewer/ui/rm_frame_graph.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
#include "rm_frame_graph.h"
|
||||
//#include "rm_speed_label.h"
|
||||
#include "rm_graph_widget.h"
|
||||
#include "fm_button.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "fm_frame_speed.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "fm_colors.h"
|
||||
|
||||
|
||||
RMFrameGraph::RMFrameGraph(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
|
||||
layout->setAlignment(Qt::AlignLeft);
|
||||
|
||||
speed = new FMSpeedFrame(this);
|
||||
speed->setFixedSize(88,79);
|
||||
layout->addWidget(speed);
|
||||
|
||||
LAYOUT_SPACE(layout,1,0);
|
||||
createXYZLabel();
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
graph = new RMGraphWidget(this,QList<int>() << 1 << 2 << 4 << 8);
|
||||
#else
|
||||
graph = new RMGraphWidget(this,QList<int>() << 1 << 2 << 4);
|
||||
#endif
|
||||
graph->setFixedHeight(70);
|
||||
graph->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
layout->addWidget(graph);
|
||||
LAYOUT_SPACE(layout,2,0);
|
||||
createZoomButtons();
|
||||
}
|
||||
|
||||
void RMFrameGraph::createXYZLabel()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
w->setFixedWidth(66);
|
||||
layout->addWidget(w);
|
||||
//LAYOUT_DEBUG(w);
|
||||
QVBoxLayout* l = new QVBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignTop);
|
||||
l->setContentsMargins(0,1,0,0); // 상단 마진
|
||||
l->setSpacing(0); // 버튼 간격
|
||||
|
||||
xOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_x",&xLabel,FM_SENSOR_COLOR_X);
|
||||
yOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_y",&yLabel,FM_SENSOR_COLOR_Y);
|
||||
zOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_z",&zLabel,FM_SENSOR_COLOR_Z);
|
||||
}
|
||||
FMButton* RMFrameGraph::_createXYZ(QWidget* parent, QLayout* layout, const char* icon, QLabel** lb, int color)
|
||||
{
|
||||
QSize bSize = QSize(30,25);
|
||||
|
||||
QWidget* w = new QWidget(parent);
|
||||
layout->addWidget(w);
|
||||
QHBoxLayout* lw = new QHBoxLayout(w);
|
||||
lw->setAlignment(Qt::AlignVCenter);
|
||||
ZERO_LAYOUT(lw);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* btn = FMButton::btnStatic2(w,lw,icon,NULL,bSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* btn = FMButton::btnStatic(w,lw,icon,QString(""),bSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
QLabel* label = new QLabel(w);
|
||||
label->setText("-0.00");
|
||||
label->setFixedWidth(36-4);
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
FMLabel(label,icon,"Arial",color, 12);
|
||||
|
||||
lw->addWidget(label);
|
||||
*lb = label;
|
||||
return btn;
|
||||
}
|
||||
|
||||
void RMFrameGraph::createZoomButtons()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
w->setFixedWidth(28);
|
||||
layout->addWidget(w);
|
||||
QVBoxLayout* l = new QVBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignTop);
|
||||
l->setContentsMargins(0,2,0,0); // 상단 마진
|
||||
l->setSpacing(1); // 버튼 간격
|
||||
|
||||
QSize sz = QSize(28,36);
|
||||
// 확대-> 실제로는 스케일을 줄인다 拡大
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_zoomIn = FMButton::btn2(w,l,"graph_up","graph_zoom_in",sz);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_zoomIn = FMButton::btn(w,l,"graph_up",FMS::txt("graph_zoom_in"),sz);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
QLabel* seperator = new QLabel(w);
|
||||
seperator->setPixmap(QPixmap(":/image/graph_seperator.png"));
|
||||
l->addWidget(seperator);
|
||||
#endif
|
||||
//LAYOUT_SPACE(l,0,1);
|
||||
|
||||
// 축소-> 실제로는 스케일을 늘린다 縮小
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_zoomOut = FMButton::btn2(w,l,"graph_down","graph_zoom_out",sz);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_zoomOut = FMButton::btn(w,l,"graph_down",FMS::txt("graph_zoom_out"),sz);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
_zoomOut->setEnabled(true);
|
||||
#else
|
||||
_zoomOut->setEnabled(false);
|
||||
#endif
|
||||
|
||||
LAYOUT_SPACE(layout,2,0); // 우측 마진
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
RMLanguage::instance()->appendENGToolTip(_zoomIn,"Zoom In");
|
||||
RMLanguage::instance()->appendENGToolTip(_zoomOut,"Zoom Out");
|
||||
#endif
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
connect(_zoomIn,SIGNAL(clicked()),graph,SLOT(onZoomIn()));
|
||||
connect(_zoomOut,SIGNAL(clicked()),graph,SLOT(onZoomOut()));
|
||||
connect(graph,SIGNAL(zoomChange(bool,bool)),SLOT(onZoomChange(bool,bool)));
|
||||
|
||||
graph->setLabels(xLabel,yLabel,zLabel);
|
||||
}
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
void RMFrameGraph::onZoomChange(bool zi,bool zo)
|
||||
{
|
||||
_zoomOut->setEnabled(zo);
|
||||
_zoomIn->setEnabled(zi);
|
||||
}
|
||||
#endif
|
||||
|
||||
void RMFrameGraph::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
#if (USE_MAXIMIZE)
|
||||
// MAXIMAIZE 모드에서는 처리하지 않음
|
||||
if(event == RMApp::WillFullScreen && param == 0) {
|
||||
setHidden(true);
|
||||
}
|
||||
else {
|
||||
setHidden(false);
|
||||
}
|
||||
#else
|
||||
setHidden(event == RMApp::WillFullScreen);
|
||||
#endif
|
||||
}
|
||||
#if (USE_MAXIMIZE)
|
||||
if (event == RMApp::DidFullScreen || event == RMApp::DidNormalScreen)
|
||||
{
|
||||
graph->redraw();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//void RMFrameGraph::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
//{
|
||||
/*
|
||||
if(event == PLAY_DID_LOADED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
if(item != NULL) {
|
||||
currentData = item->getSensorData();
|
||||
}
|
||||
_updatePolygon();
|
||||
_itemDurationMSec = (double)item->durationInMSecs();
|
||||
}
|
||||
else if(event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
currentData= NULL;
|
||||
_polygonX.clear();
|
||||
_polygonY.clear();
|
||||
_polygonZ.clear();
|
||||
update();
|
||||
}
|
||||
*/
|
||||
|
||||
//}
|
||||
//void RMFrameGraph::onPositionChanged(qint64 position,qint64 duration)
|
||||
//{
|
||||
// double pos = (double)MIN(position,duration);
|
||||
// double du = ((double)(duration));
|
||||
|
||||
// // 센서 값과 유사하게 표시하기위해 보정
|
||||
// //const double tolerance = 50.0;
|
||||
|
||||
// // 실제 시간과 seek duration 보정
|
||||
// //double pos2 = (pos + tolerance) * (_itemDurationMSec / du);
|
||||
// double pos2 = pos;
|
||||
|
||||
|
||||
|
||||
// unsigned int offset = (unsigned int)(((double)pos2) / ((double)du) * ((double)currentData->getSensorCount()) );
|
||||
|
||||
// if(offset < currentData->getSensorCount())
|
||||
// {
|
||||
// const float* sensorValues = currentData->getSensor();
|
||||
// const float x = sensorValues[(offset * NUM_SENSOR_DATA) + 0] * 2.0;
|
||||
// const float y = sensorValues[(offset * NUM_SENSOR_DATA) + 1] * 2.0;
|
||||
// const float z = sensorValues[(offset * NUM_SENSOR_DATA) + 2] * 2.0;
|
||||
// if(xLabel != NULL)
|
||||
// {
|
||||
// xLabel->setText(QString().sprintf("X:% .3f",x));
|
||||
// }
|
||||
// if(yLabel != NULL)
|
||||
// {
|
||||
// yLabel->setText(QString().sprintf("Y:% .3f",y));
|
||||
// }
|
||||
// if(zLabel != NULL)
|
||||
// {
|
||||
// zLabel->setText(QString().sprintf("Z:% .3f",z));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
42
project/fm_viewer/ui/rm_frame_graph.h
Normal file
42
project/fm_viewer/ui/rm_frame_graph.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef RM_FRAME_GRAPH_H
|
||||
#define RM_FRAME_GRAPH_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
#include "../fm_event_types.h"
|
||||
class FMSpeedFrame;
|
||||
class RMGraphWidget;
|
||||
class FMButton;
|
||||
|
||||
class RMFrameGraph : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMFrameGraph(QWidget *parent = nullptr);
|
||||
|
||||
FMSpeedFrame* speed;
|
||||
RMGraphWidget* graph;
|
||||
|
||||
FMButton* xOnBtn;
|
||||
QLabel* xLabel;
|
||||
FMButton* yOnBtn;
|
||||
QLabel* yLabel;
|
||||
FMButton* zOnBtn;
|
||||
QLabel* zLabel;
|
||||
|
||||
private:
|
||||
QHBoxLayout* layout;
|
||||
void createXYZLabel();
|
||||
void createZoomButtons();
|
||||
|
||||
FMButton* _zoomIn;
|
||||
FMButton* _zoomOut;
|
||||
|
||||
static FMButton* _createXYZ(QWidget* parent, QLayout* layout, const char* icon, QLabel** lb, int color);
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
void onZoomChange(bool zi,bool zo);
|
||||
};
|
||||
|
||||
#endif // RM_FRAME_GRAPH_H
|
||||
266
project/fm_viewer/ui/rm_frame_left.cpp
Normal file
266
project/fm_viewer/ui/rm_frame_left.cpp
Normal file
@@ -0,0 +1,266 @@
|
||||
#include "rm_frame_left.h"
|
||||
#include "rm_frame_bottom.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../fm_app_colors.h"
|
||||
#include "fm_layer.h"
|
||||
#include "rm_frame_video_main.h"
|
||||
#include "rm_frame_graph.h"
|
||||
#include "rm_play_slider.h"
|
||||
#include "rm_frame_eq.h"
|
||||
#include "rm_frame_play.h"
|
||||
#include "rm_button.h"
|
||||
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
#include "rm_frame_video_sub.h"
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#include "window_main.h"
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
#include "fm_daytime.h"
|
||||
#endif
|
||||
|
||||
RMFrameLeft::RMFrameLeft(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
this->setFixedWidth(LEFT_FRAME_WIDTH);
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
const int vspace = 2;
|
||||
#else // RM_MODEL_EMT_KR
|
||||
const int vspace = 4;
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
layout->setSpacing(vspace); // 4
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
|
||||
// Video + Slider
|
||||
createVideoSliderFrame();
|
||||
|
||||
// Graph(SpeedLabel) + EQ Frame
|
||||
createSpeedGraphEQPlayFrame();
|
||||
|
||||
//frameBottom = new RMFrameBottom(this);
|
||||
//layout->addWidget(frameBottom);
|
||||
}
|
||||
void RMFrameLeft::createVideoSliderFrame()
|
||||
{
|
||||
mainVideoFrame = new QWidget(this);
|
||||
layout->addWidget(mainVideoFrame);
|
||||
QVBoxLayout* l = new QVBoxLayout(mainVideoFrame);
|
||||
l->setSpacing(0);
|
||||
l->setMargin(1);
|
||||
mainVideoFrame->setFixedHeight(MAIN_VIDEO_FRAME_HEIGHT);
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
FMWidgetBorder(mainVideoFrame,"main_video_frame",FM_COLOR_BORDER);
|
||||
#endif //
|
||||
frameMainVideo = new RMFrameVideoMain(mainVideoFrame);
|
||||
l->addWidget(frameMainVideo);
|
||||
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
subVideoFrame = new QWidget(this);
|
||||
layout->addWidget(subVideoFrame);
|
||||
QVBoxLayout* l2 = new QVBoxLayout(subVideoFrame);
|
||||
l2->setSpacing(0);
|
||||
l2->setMargin(1);
|
||||
subVideoFrame->setFixedHeight(MAIN_VIDEO_FRAME_HEIGHT);
|
||||
FMWidgetBorder(subVideoFrame,"main_video_frame",FM_COLOR_BORDER);
|
||||
#endif // #if (TOPDOWN_CH_LAYOUT)
|
||||
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
frameVideoSub = new RMFrameVideoSub(subVideoFrame);
|
||||
l2->addWidget(frameVideoSub);
|
||||
sliderMain = new QWidget(this);
|
||||
#else // TOPDOWN_CH_LAYOUT
|
||||
sliderMain = new QWidget(mainVideoFrame);
|
||||
#endif // TOPDOWN_CH_LAYOUT
|
||||
|
||||
FMWidgetBackground(sliderMain,"slider_frame",FM_COLOR_SLIDER_BACKGROUND);
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
layout->addWidget(sliderMain);
|
||||
#else // TOPDOWN_CH_LAYOUT
|
||||
l->addWidget(sliderMain);
|
||||
#endif // TOPDOWN_CH_LAYOUT
|
||||
|
||||
sliderMain->setFixedHeight(PLAY_SLIDER_HEIGHT);
|
||||
QHBoxLayout* ls = new QHBoxLayout(sliderMain);
|
||||
ZERO_LAYOUT(ls);
|
||||
|
||||
frameSlider = new RMPlaySlider(sliderMain);
|
||||
frameSlider->setFixedHeight(PLAY_SLIDER_HEIGHT);
|
||||
ls->addWidget(frameSlider);
|
||||
frameSlider->setEnabled(false);
|
||||
|
||||
sliderParentLayout = ls;
|
||||
|
||||
|
||||
}
|
||||
void RMFrameLeft::createSpeedGraphEQPlayFrame()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
FMWidgetBackground(w,"3a3a3a",0x3a3a3a);
|
||||
#endif
|
||||
|
||||
// w->setObjectName("test_w");
|
||||
// w->setStyleSheet("QWidget#test_w {border: 1px solid red;}");
|
||||
|
||||
layout->addWidget(w);
|
||||
QVBoxLayout* l = new QVBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignTop);
|
||||
l->setSpacing(0);
|
||||
l->setMargin(1);
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
w->setFixedSize(LEFT_FRAME_WIDTH,EQ_FRAME_HEIGHT + PLAY_CONTROL_HEIGHT);
|
||||
#elif (RM_MODEL_EMT_KR)
|
||||
w->setFixedSize(LEFT_FRAME_WIDTH,182+5);
|
||||
#else // RM_MODEL_TYPE_TB4000
|
||||
w->setFixedSize(LEFT_FRAME_WIDTH,182);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
FMWidgetBorderBackground(w,"border_back",0x3a3a3a,FM_COLOR_BORDER);
|
||||
#endif
|
||||
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000 && !DO_NOT_USE_GRAPH)
|
||||
frameGraph = new RMFrameGraph(w);
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
FMWidgetBackground(frameGraph,"graph_back",0x212121);
|
||||
#endif
|
||||
|
||||
|
||||
frameGraph->setFixedHeight(79);
|
||||
l->addWidget(frameGraph);
|
||||
//LAYOUT_DEBUG(frameGraph);
|
||||
#endif // #if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
#endif // #if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
frameEQ = new RMFrameEQ(w);
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
FMWidgetBackground(frameEQ,"eq_back",0x212121);
|
||||
#endif // RM_MODEL_TYPE_EMT_KR
|
||||
l->addWidget(frameEQ);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
frameEQ->setFixedSize(LEFT_FRAME_WIDTH-2,EQ_FRAME_HEIGHT);
|
||||
#else // RM_MODEL_EMT_KR
|
||||
frameEQ->setFixedSize(LEFT_FRAME_WIDTH,EQ_FRAME_HEIGHT);
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
//LAYOUT_DEBUG(frameEQ);
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
l->addSpacerItem(new QSpacerItem(0,2));
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
framePlay = new RMFramePlay(w);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
FMWidgetBackground(framePlay,"play_back",0x212121);
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
framePlay->setFixedHeight(PLAY_CONTROL_HEIGHT); //
|
||||
l->addWidget(framePlay);
|
||||
#endif // !PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
frameDayTime = new FMDayTime(w);
|
||||
l->addWidget(frameDayTime);
|
||||
#endif // RM_MODEL_TYPE_AN6000
|
||||
|
||||
controlParent = w;
|
||||
controlParentLayout = l;
|
||||
}
|
||||
void RMFrameLeft::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
bool bFullScreen = (event == RMApp::WillFullScreen) ? true : false;
|
||||
if(bFullScreen)
|
||||
{
|
||||
_normalControlParentHeight = controlParent->size().height();
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
_eqIndex = controlParentLayout->indexOf(frameEQ);
|
||||
#endif
|
||||
this->setFixedWidth(QWIDGETSIZE_MAX);
|
||||
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
mainVideoFrame->setFixedHeight(QWIDGETSIZE_MAX);
|
||||
mainVideoFrame->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && TOPDOWN_CH_LAYOUT)
|
||||
//WindowMain*pw = (WindowMain*)RMApp::instance()->pMainWindow;
|
||||
if(RMApp::mMAXIMIZE) { // pw->mMAXIMIZE
|
||||
subVideoFrame->setFixedHeight(QWIDGETSIZE_MAX);
|
||||
subVideoFrame->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
} else {
|
||||
subVideoFrame->setHidden(true); // 전체화면 모드에서만 사용
|
||||
}
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
controlParentLayout->removeWidget(frameEQ);
|
||||
sliderParentLayout->insertWidget(0,frameEQ);
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if(PLAYER_ONLY_LIBRARY_MODE)
|
||||
// 감추기
|
||||
controlParent->setFixedSize(QWIDGETSIZE_MAX,4);
|
||||
#else // PLAYER_ONLY_LIBRARY_MODE
|
||||
controlParent->setFixedSize(QWIDGETSIZE_MAX,71);
|
||||
#endif
|
||||
#else // RM_MODEL_TYPE_TB4000
|
||||
#if (USE_MAXIMIZE)
|
||||
if(param == 0) {
|
||||
controlParent->setFixedSize(QWIDGETSIZE_MAX,71);
|
||||
} else {
|
||||
controlParent->setFixedSize(QWIDGETSIZE_MAX,182-30);
|
||||
}
|
||||
#else
|
||||
controlParent->setFixedSize(QWIDGETSIZE_MAX,71);
|
||||
#endif
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
frameDayTime->setHidden(true);
|
||||
#endif //
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
framePlay->layout->setAlignment(Qt::AlignCenter);
|
||||
#endif // #if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
}
|
||||
else // 복원
|
||||
{
|
||||
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
this->setFixedWidth(LEFT_FRAME_WIDTH);
|
||||
mainVideoFrame->setFixedHeight(MAIN_VIDEO_FRAME_HEIGHT);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && TOPDOWN_CH_LAYOUT)
|
||||
subVideoFrame->setHidden(false);
|
||||
subVideoFrame->setFixedHeight(MAIN_VIDEO_FRAME_HEIGHT);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
sliderParentLayout->removeWidget(frameEQ);
|
||||
controlParentLayout->insertWidget(_eqIndex,frameEQ); // 1
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
controlParent->setFixedSize(LEFT_FRAME_WIDTH,_normalControlParentHeight);
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
framePlay->layout->setAlignment(Qt::AlignVCenter);
|
||||
#endif // !PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
frameDayTime->setHidden(false);
|
||||
#endif //
|
||||
|
||||
}
|
||||
#if (MODEL_BBVIEWER)
|
||||
gpsWidget->setHidden(bFullScreen);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
91
project/fm_viewer/ui/rm_frame_left.h
Normal file
91
project/fm_viewer/ui/rm_frame_left.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#ifndef RM_LEFT_PANEL_H
|
||||
#define RM_LEFT_PANEL_H
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
|
||||
// NORMAL MODE 에서는 전체 좌측 영역
|
||||
// DUAL MODE 에서는 하단 좌측 영역
|
||||
|
||||
#if !(DUAL_VIEWER)
|
||||
class RMFrameVideoMain;
|
||||
#endif
|
||||
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
class RMFrameVideoSub;
|
||||
#endif
|
||||
|
||||
class RMFrameBottom;
|
||||
|
||||
class RMFrameGraph;
|
||||
|
||||
class RMPlaySlider;
|
||||
class RMFramePlay;
|
||||
class RMFrameEQ;
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
class FMDayTime;
|
||||
#endif
|
||||
|
||||
class RMFrameLeft : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMFrameLeft(QWidget *parent = nullptr);
|
||||
|
||||
#if !(DUAL_VIEWER)
|
||||
RMFrameVideoMain* frameMainVideo; // main video
|
||||
#endif
|
||||
|
||||
#if (TOPDOWN_CH_LAYOUT)
|
||||
RMFrameVideoSub* frameVideoSub;
|
||||
QWidget* subVideoFrame;
|
||||
#endif // TOPDOWN_CH_LAYOUT
|
||||
|
||||
RMPlaySlider* frameSlider; // Play Slider
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000 && !DO_NOT_USE_GRAPH)
|
||||
RMFrameGraph* frameGraph; // speed + graph
|
||||
#endif // RM_MODEL
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
FMDayTime* frameDayTime;
|
||||
#endif // RM_MODEL_TYPE_AN6000
|
||||
#endif // #if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
RMFrameEQ* frameEQ; // EQ Frame
|
||||
#endif // DO_NOT_USE_EQ
|
||||
|
||||
#if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
RMFramePlay* framePlay; // control
|
||||
#endif // #if (!PLAYER_ONLY_LIBRARY_MODE)
|
||||
QWidget* mainVideoFrame;
|
||||
QWidget* sliderMain;
|
||||
QHBoxLayout* sliderParentLayout;
|
||||
QWidget* controlParent;
|
||||
QVBoxLayout* controlParentLayout;
|
||||
protected:
|
||||
QVBoxLayout* layout;
|
||||
|
||||
private:
|
||||
int _normalControlParentHeight; // 전체화면, 복원용
|
||||
void createVideoSliderFrame(); // Video + Slider
|
||||
void createSpeedGraphEQPlayFrame(); // Speed Label + Graph + EQualizer + Play Frame
|
||||
|
||||
#if !(DO_NOT_USE_EQ)
|
||||
int _eqIndex;
|
||||
#endif // #if !(DO_NOT_USE_EQ)
|
||||
int _sliderControlIndex; // toggle full screen restore
|
||||
int _playControlIndex; // "
|
||||
|
||||
//QSpacerItem* _sliderToGraphSpacer;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
};
|
||||
|
||||
#endif // RM_LEFT_PANEL_H
|
||||
794
project/fm_viewer/ui/rm_frame_list.cpp
Normal file
794
project/fm_viewer/ui/rm_frame_list.cpp
Normal file
@@ -0,0 +1,794 @@
|
||||
#include "rm_frame_list.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
#include "fm_layer.h"
|
||||
#include "fm_button.h"
|
||||
#include "../fm_dimensions.h"
|
||||
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "../data/rm_video_list_loader.h"
|
||||
#include "rm_button.h"
|
||||
#include "rm_widget_video_list.h"
|
||||
#include "rm_dialog_progress.h"
|
||||
#include "rm_dialog_overwrite.h"
|
||||
#include "../data/rm_overwrite.h"
|
||||
//#include "../cfg/window_settings_91fh.h"
|
||||
#include <QMainWindow>
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#include <QDir>
|
||||
#include "../core/rm_key_event.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "fm_colors.h"
|
||||
#include "../fm_app_colors.h"
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#include "fm_datepicker.h"
|
||||
#include "fm_thumbnail_dialog.h"
|
||||
#endif
|
||||
|
||||
#if (USE_VERSION_CHECK)
|
||||
#include "../module/fm_version_checker.h"
|
||||
#endif // USE_VERSION_CHECK
|
||||
|
||||
#if (DETECT_USB_CHANGE)
|
||||
#include "window_main.h"
|
||||
#include "../core/rm_usb.h"
|
||||
#endif // DETECT_USB_CHANGE
|
||||
//int normal;
|
||||
//int pressed;
|
||||
//int hover;
|
||||
//int disabled;
|
||||
//int checked;
|
||||
FM_COLOR_SET g_type_button_colors[5] = {
|
||||
0x595959, // normal
|
||||
0x2e2e2e, // pressed
|
||||
0x343434, // hover
|
||||
0x595959, // disabled
|
||||
0x3a3a3a, // checked
|
||||
};
|
||||
|
||||
FM_COLOR_SET g_type_button_colors2[5] = {
|
||||
0x595959, // normal
|
||||
0x2e2e2e, // pressed
|
||||
0x343434, // hover
|
||||
0x595959, // disabled
|
||||
FM_SILDER_COLOR, // checked
|
||||
};
|
||||
|
||||
//const int FRAME_LIST_WIDTH = 352;
|
||||
RMFrameList* RMFrameList::_instance = NULL;
|
||||
RMFrameList* RMFrameList::instance(QWidget* parent)
|
||||
{
|
||||
if ( _instance == NULL )
|
||||
{
|
||||
_instance = new RMFrameList(parent);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
// RMWidgetStyleBase
|
||||
RMFrameList::RMFrameList(QWidget *parent) : RMWidgetBase(parent,false)
|
||||
{
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
FMWidgetBorder(this,"border_frame",0x666666);
|
||||
#endif
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setMargin(1);
|
||||
layout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
createTitle();
|
||||
#endif //
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
createDatePicker();
|
||||
#elif (RM_MODEL != RM_MODEL_TYPE_AN6000) // AN6000 은 타입없음
|
||||
createTypeButtons();
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
|
||||
listWidget = new RMWidgetVideoList(this);
|
||||
listWidget->setFixedWidth(RIGHT_FRAME_WIDTH-2);
|
||||
listWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
layout->addWidget(listWidget);
|
||||
|
||||
|
||||
RMVideoFileList* list = RMVideoFileList::instance();
|
||||
// 리스트 업데이트 완료 후 TOGGLE BUTTON ENABLE
|
||||
connect(list,SIGNAL(listUpdateEnd(bool,RMVideoItem*)),SLOT(onListUpdate(bool,RMVideoItem*)));
|
||||
|
||||
#if !(SINGLE_SAVE_FILE)
|
||||
connect(listWidget,SIGNAL(itemChecked(bool)),SLOT(onItemChecked(bool)));
|
||||
#endif
|
||||
|
||||
connect(list,SIGNAL(backupPaused(bool)),SLOT(onBackupPaused(bool)));
|
||||
|
||||
connect(list,SIGNAL(backupStarted()),SLOT(onBackupStarted()));
|
||||
connect(list,SIGNAL(backupEnd()),SLOT(onBackupEnded()));
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
connect(listWidget,SIGNAL(allList()),this,SLOT(onAllList()));
|
||||
#endif
|
||||
|
||||
#if(LIVE_LANGUAGE2)
|
||||
refreshLanguage();
|
||||
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
#endif // #if(LIVE_LANGUAGE_CHANGE)
|
||||
|
||||
}
|
||||
void RMFrameList::createTitle()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
const int title_height = 33;
|
||||
FMWidgetBottomBorderBackground(w,"list_title",FM_COLOR_BORDER,0x00);
|
||||
#else RM_MODEL_EMT_KR
|
||||
const int title_height = 26;
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
layout->addWidget(w);
|
||||
w->setFixedHeight(title_height);
|
||||
QHBoxLayout* l = new QHBoxLayout(w);
|
||||
ZERO_LAYOUT(l);
|
||||
|
||||
_titleLabel = new QLabel(w);
|
||||
_titleLabel->setPixmap( QPixmap(":/image/title_list.png") );
|
||||
//_titleLabel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
//_titleLabel->setFixedHeight(41);
|
||||
l->addWidget(_titleLabel);
|
||||
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
// AVI 保存 = \x41\x56\x49 \xe4\xbf\x9d\xe5\xad\x98
|
||||
#if (LIVE_LANGUAGE2)
|
||||
backupButton = FMButton::btn2(w,l,"backup","backup",QSize(44,24));
|
||||
#else // LIVE_LANGUAGE2
|
||||
backupButton = FMButton::btn(w,l,"backup",FMS::txt("backup"),QSize(44,24));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#if !(SINGLE_SAVE_FILE)
|
||||
backupButton->setEnabled(false);
|
||||
#endif
|
||||
connect(backupButton,SIGNAL(clicked()),this,SLOT(onBackup()));
|
||||
l->setAlignment(backupButton,Qt::AlignRight);
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
backupShortCut = new QShortcut(QKeySequence(Qt::Key_F4), RMApp::instance()->pMainWindow);
|
||||
backupShortCut->setContext(Qt::ApplicationShortcut);
|
||||
connect(backupShortCut,SIGNAL(activated()),SLOT(onBackup()));
|
||||
backupShortCut->setEnabled(false);
|
||||
#endif
|
||||
#endif // #if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
// DATE PICKER 사용하지 않고 이전 타이틀 ..
|
||||
thumbNailButton = FMButton::btn(w,l,"thumbnail",FMS::txt("thumbnail"),QSize(44,24));
|
||||
thumbNailButton->setEnabled(false);
|
||||
connect(thumbNailButton,SIGNAL(clicked()),this,SLOT(onThumbnail()));
|
||||
#endif
|
||||
|
||||
LAYOUT_SPACE(l,6,0);
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void RMFrameList::createDatePicker()
|
||||
{
|
||||
#if (USE_DATE_FILTER)
|
||||
datePicker = new FMDatePicker(this);
|
||||
layout->addWidget(datePicker);
|
||||
#else
|
||||
|
||||
QWidget* top = new QWidget(this);
|
||||
QVBoxLayout* topL = new QVBoxLayout(top);
|
||||
topL->setMargin(1);
|
||||
topL->setSpacing(1);
|
||||
layout->addWidget(top);
|
||||
|
||||
// 1.썸네일 보기
|
||||
QWidget* thumbnailW = new QWidget(top);
|
||||
topL->addWidget(thumbnailW);
|
||||
QHBoxLayout* thumbnailL = new QHBoxLayout(thumbnailW);
|
||||
thumbnailL->setSpacing(1);
|
||||
thumbnailL->setContentsMargins(0,0,0,0);
|
||||
//ZERO_LAYOUT(thumbnailL);
|
||||
|
||||
QLabel* thumbnailTitle = new QLabel(thumbnailW);
|
||||
thumbnailTitle->setPixmap(QPixmap(":/image/title_show_thumbnail.png"));
|
||||
thumbnailL->addWidget(thumbnailTitle);
|
||||
|
||||
const int bw = RIGHT_FRAME_WIDTH / 3;
|
||||
|
||||
thumbNailButton1 = FMButton::btnType0(thumbnailW,thumbnailL,"title_thumbnail_1hour",FM_WSTR(L"1시간 섬네일 보기"),QSize(bw,24),g_type_button_colors);
|
||||
connect(thumbNailButton1,SIGNAL(clicked()),this,SLOT(onThumbnail()));
|
||||
thumbNailButton1->setEnabled(false);
|
||||
|
||||
thumbNailButton2 = FMButton::btnType0(thumbnailW,thumbnailL,"title_thumbnail_detail",FM_WSTR(L"세부 섬네일 보기"),QSize(bw,24),g_type_button_colors);
|
||||
connect(thumbNailButton2,SIGNAL(clicked()),this,SLOT(onThumbnail()));
|
||||
thumbNailButton2->setEnabled(false);
|
||||
|
||||
// 2. 정렬
|
||||
QWidget* sortW = new QWidget(top);
|
||||
topL->addWidget(sortW);
|
||||
QHBoxLayout* sortL = new QHBoxLayout(sortW);
|
||||
sortL->setSpacing(5);
|
||||
sortL->setContentsMargins(0,0,0,0);
|
||||
|
||||
QLabel* sortTitle = new QLabel(sortW);
|
||||
sortTitle->setPixmap(QPixmap(":/image/title_sort.png"));
|
||||
sortL->addWidget(sortTitle);
|
||||
|
||||
sortButton1 = FMButton::btnCheck(sortW,sortL,"sort_dsc",FM_WSTR(L"최신순으로 정렬"),QSize(bw,24));
|
||||
connect(sortButton1,SIGNAL(clicked()),this,SLOT(onTypeOrSort()));
|
||||
sortButton1->setCheckable(true);
|
||||
sortButton1->setChecked(true);
|
||||
|
||||
sortButton2 = FMButton::btnCheck(sortW,sortL,"sort_asc",FM_WSTR(L"시간순으로 정렬"),QSize(bw,24));
|
||||
sortButton2->setCheckable(true);
|
||||
connect(sortButton2,SIGNAL(clicked()),this,SLOT(onTypeOrSort()));
|
||||
|
||||
//connect(thumbNailButton,SIGNAL(clicked()),this,SLOT(onThumbnail()));
|
||||
|
||||
QWidget* topType = new QWidget(top);
|
||||
topL->addWidget(topType);
|
||||
QHBoxLayout* topTypeL = new QHBoxLayout(topType);
|
||||
ZERO_LAYOUT(topTypeL);
|
||||
topTypeL->setSpacing(1);
|
||||
|
||||
listSimpleButton = FMButton::btnEmpty(topType,topTypeL,"",QSize(-1,24),g_type_button_colors2);
|
||||
//listSimpleButton = FMButton::btnType0(topType,topTypeL,"list_1hour_title","",QSize(-1,24),g_type_button_colors2);
|
||||
listSimpleButton->setCheckable(true);
|
||||
listSimpleButton->setChecked(true);
|
||||
connect(listSimpleButton,SIGNAL(clicked()),this,SLOT(onTypeOrSort()));
|
||||
|
||||
const int rmargin = 4;
|
||||
QHBoxLayout* sl = new QHBoxLayout(listSimpleButton);
|
||||
ZERO_LAYOUT(sl);
|
||||
|
||||
//sl->setContentsMargins(0,0,rmargin,0);
|
||||
sl->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel* sT = new QLabel(listSimpleButton);
|
||||
sT->setPixmap(QPixmap(":/image/list_1hour_title.png"));
|
||||
sl->addWidget(sT);
|
||||
|
||||
countSimple = new QLabel(listSimpleButton);
|
||||
sl->addWidget(countSimple);
|
||||
countSimple->setStyleSheet("font-family: Fixedsys;font-size: 13px;color : #FFFFFF;");
|
||||
|
||||
//countSimple->setText("000");
|
||||
|
||||
listAllButton = FMButton::btnEmpty(topType,topTypeL,"",QSize(-1,24),g_type_button_colors2); // "list_all_title",
|
||||
listAllButton->setCheckable(true);
|
||||
listAllButton->setChecked(false);
|
||||
|
||||
QHBoxLayout* al = new QHBoxLayout(listAllButton);
|
||||
ZERO_LAYOUT(al);
|
||||
//al->setContentsMargins(0,0,rmargin,0);
|
||||
//al->setAlignment(Qt::AlignRight);
|
||||
al->setAlignment(Qt::AlignCenter);
|
||||
QLabel* sA = new QLabel(listAllButton);
|
||||
sA->setPixmap(QPixmap(":/image/list_all_title.png"));
|
||||
al->addWidget(sA);
|
||||
|
||||
|
||||
countAll = new QLabel(listAllButton);
|
||||
al->addWidget(countAll);
|
||||
countAll->setStyleSheet("font-family: Fixedsys;font-size: 13px;color : #FFFFFF;");
|
||||
|
||||
connect(listAllButton,SIGNAL(clicked()),this,SLOT(onTypeOrSort()));
|
||||
|
||||
// 썸네일 표시
|
||||
#endif // USE_DATE_FILTER
|
||||
}
|
||||
#elif (RM_MODEL_EMT_KR)
|
||||
void RMFrameList::createTypeButtons()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
w->setFixedHeight(28);
|
||||
FMWidgetBackground(w,"list_type",FM_COLOR_BORDER);
|
||||
layout->addWidget(w);
|
||||
|
||||
QHBoxLayout* l = new QHBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
|
||||
ZERO_LAYOUT(l);
|
||||
typeCombo = new QComboBox(w);
|
||||
typeCombo->setEditable(false);
|
||||
|
||||
QStringList lst = QStringList() << FM_WSTR(L"주행") << FM_WSTR(L"주행 이벤트") << FM_WSTR(L"주차") << FM_WSTR(L"주차 충격") << FM_WSTR(L"수동 녹화") << FM_WSTR(L"보관함");
|
||||
typeCombo->addItems(lst);
|
||||
QString style = "QComboBox {\
|
||||
font-family: Arial;\
|
||||
color: #7BACFF;\
|
||||
background-color: transparent;\
|
||||
font-size: 13px;\
|
||||
selection-background-color:transparent;\
|
||||
selection-color:#4085FF;\
|
||||
}";
|
||||
|
||||
typeCombo->setStyleSheet(style);
|
||||
connect(typeCombo,SIGNAL(currentIndexChanged(int)),SLOT(onToggleGroup(int)));
|
||||
|
||||
//RMVideoFileList::FILTER_ALL;
|
||||
// 주행 / 주행 이벤트 / 주차 / 주차 충격 / 수동 녹화( / 보관함???)
|
||||
typeCombo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||
typeCombo->setFixedWidth(100);
|
||||
l->addWidget(typeCombo);
|
||||
}
|
||||
#elif (RM_MODEL != RM_MODEL_TYPE_AN6000)
|
||||
void RMFrameList::createTypeButtons()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
|
||||
w->setFixedHeight(28);
|
||||
layout->addWidget(w);
|
||||
#if !(RECORD_TYPE_COMBO_UI)
|
||||
QHBoxLayout* l = new QHBoxLayout(w);
|
||||
ZERO_LAYOUT(l);
|
||||
#if (SUB_MODEL_KEIYO_360)
|
||||
const int count = 3;
|
||||
#else // SUB_MODEL_KEIYO_360
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W || RM_MODEL == RM_MODEL_TYPE_BV2000 || RM_MODEL == RM_MODEL_TYPE_MH9000)
|
||||
const int count = 5;
|
||||
#elif (RM_MODEL == RM_MODEL_TYPE_XLDR_88 )
|
||||
const int count = 4;
|
||||
#elif (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
const int count = 5;
|
||||
#else
|
||||
const int count = 3;
|
||||
#endif
|
||||
#endif // SUB_MODEL_KEIYO_360
|
||||
|
||||
QSize sz = QSize((RIGHT_FRAME_WIDTH-2)/count,28);
|
||||
|
||||
//qInfo() << "BUTTON SIZE:" << sz;
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88 || RM_MODEL == RM_MODEL_TYPE_TBD360)
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88)
|
||||
allButton = FMButton::btnColor(w,l,"type_all2",QString(),sz,g_type_button_colors);
|
||||
allButton->valueTag = RMVideoFileList::FILTER_ALL;
|
||||
buttons.append(allButton);
|
||||
#endif // RM_MODEL_TYPE_XLDR_88
|
||||
|
||||
normalButton = FMButton::btnColor(w,l,"type_all",QString(),sz,g_type_button_colors);
|
||||
normalButton->valueTag = RMVideoFileList::FILTER_NORMAL;
|
||||
buttons.append(normalButton);
|
||||
|
||||
eventButton = FMButton::btnColor(w,l,"type_normal",QString(),sz,g_type_button_colors);
|
||||
eventButton->valueTag = RMVideoFileList::FILTER_EVENT;
|
||||
buttons.append(eventButton);
|
||||
|
||||
parkButton = FMButton::btnColor(w,l,"type_event",QString(),sz,g_type_button_colors);
|
||||
parkButton->valueTag = RMVideoFileList::FILTER_PARK;
|
||||
buttons.append(parkButton);
|
||||
#else
|
||||
#if (LIVE_LANGUAGE2)
|
||||
allButton = FMButton::btnColor2(w,l,"type_all",NULL,sz,g_type_button_colors);
|
||||
normalButton = FMButton::btnColor2(w,l,"type_normal",NULL,sz,g_type_button_colors);
|
||||
eventButton = FMButton::btnColor2(w,l,"type_event",NULL,sz,g_type_button_colors);
|
||||
#else // LIVE_LANGUAGE2
|
||||
allButton = FMButton::btnColor(w,l,"type_all",QString(),sz,g_type_button_colors);
|
||||
normalButton = FMButton::btnColor(w,l,"type_normal",QString(),sz,g_type_button_colors);
|
||||
eventButton = FMButton::btnColor(w,l,"type_event",QString(),sz,g_type_button_colors);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
allButton->valueTag = RMVideoFileList::FILTER_ALL;
|
||||
buttons.append(allButton);
|
||||
|
||||
normalButton->valueTag = RMVideoFileList::FILTER_NORMAL;
|
||||
buttons.append(normalButton);
|
||||
|
||||
eventButton->valueTag = RMVideoFileList::FILTER_EVENT;
|
||||
buttons.append(eventButton);
|
||||
#endif
|
||||
|
||||
#if !(SUB_MODEL_KEIYO_360)
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W || RM_MODEL == RM_MODEL_TYPE_BV2000 || RM_MODEL == RM_MODEL_TYPE_MH9000)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
//#if(RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
manualButton = FMButton::btnColor2(w,l,"type_manual",NULL,sz,g_type_button_colors);
|
||||
//#endif // RM_MODEL == RM_MODEL_TYPE_MH9000
|
||||
parkButton = FMButton::btnColor2(w,l,"type_park",NULL,sz,g_type_button_colors);
|
||||
#else
|
||||
manualButton = FMButton::btnColor(w,l,"type_manual",QString(),sz,g_type_button_colors);
|
||||
parkButton = FMButton::btnColor(w,l,"type_park",QString(),sz,g_type_button_colors);
|
||||
#endif
|
||||
//#if(RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
manualButton->valueTag = RMVideoFileList::FILTER_MANUAL;
|
||||
buttons.append(manualButton);
|
||||
//#endif // #if(RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
|
||||
parkButton->valueTag = RMVideoFileList::FILTER_PARK;
|
||||
buttons.append(parkButton);
|
||||
#elif (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
manualButton = FMButton::btnColor2(w,l,"type_manual",NULL,sz,g_type_button_colors);
|
||||
parkButton = FMButton::btnColor2(w,l,"type_park",NULL,sz,g_type_button_colors);
|
||||
#endif
|
||||
#endif // #if !(SUB_MODEL_KEIYO_360)
|
||||
|
||||
foreach (FMButton* btn, buttons) {
|
||||
btn->setCheckable(true);
|
||||
btn->setEnabled(false);
|
||||
connect(btn,SIGNAL(clicked()),this,SLOT(onToggleGroup()));
|
||||
}
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
}
|
||||
#endif // #if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
|
||||
#if !(SINGLE_SAVE_FILE)
|
||||
void RMFrameList::onItemChecked(bool bSelected)
|
||||
{
|
||||
if(backupButton != NULL)
|
||||
{
|
||||
#if !(LIVE_LANGUAGE_CHANGE)
|
||||
// 2019/09/16:#150 에서 다시 표시 요청
|
||||
backupButton->setToolTip(bSelected ? MKU8("\x41\x56\x49 \xe4\xbf\x9d\xe5\xad\x98") : QString());
|
||||
#endif
|
||||
|
||||
backupButton->setEnabled(bSelected);
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
backupShortCut->setEnabled(bSelected);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // SINGLE_SAVE_FILE
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
#if (RECORD_TYPE_COMBO_UI)
|
||||
void RMFrameList::onToggleGroup(int selected)
|
||||
{
|
||||
RMVideoFileList::FILTER filters[] = {RMVideoFileList::FILTER_NORMAL,RMVideoFileList::FILTER_EVENT,RMVideoFileList::FILTER_PARK,RMVideoFileList::FILTER_PARK_EVENT,RMVideoFileList::FILTER_MANUAL,RMVideoFileList::FILTER_MYBOX};
|
||||
RMVideoFileList* list = RMVideoFileList::instance();
|
||||
list->setFilterSingle(filters[selected]);
|
||||
}
|
||||
#else // !RECORD_TYPE_COMBO_UI
|
||||
void RMFrameList::onToggleGroup()
|
||||
{
|
||||
FMButton* btn = qobject_cast<FMButton*>(QObject::sender());
|
||||
RMVideoFileList* list = RMVideoFileList::instance();
|
||||
list->setFilterSingle((RMVideoFileList::FILTER)btn->valueTag);
|
||||
foreach (FMButton* each, buttons) {
|
||||
each->setChecked(each == btn);
|
||||
}
|
||||
}
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
#endif // #if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
void RMFrameList::onOpen()
|
||||
{
|
||||
// Pressed focus 문제 발생하니 무시
|
||||
if(RMKeyEvent::instance()->exist())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString title = FMS::txt("open_message");
|
||||
//QString title = MKU8("\xe9\x8c\xb2\xe7\x94\xbb\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe3\x81\x82\xe3\x82\x8b\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80\xe9\x81\xb8\xe6\x8a\x9e");
|
||||
#if(!REMOVE_OLD_C)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false) { title = "Open Folder";}
|
||||
#endif
|
||||
#endif // #if(REMOVE_OLD_C)
|
||||
// 録画ファイルがあるフォルダ選択
|
||||
QString dir = RMApp::openFolder(RMSettings::instance()->lastMoviePath(),
|
||||
false,
|
||||
title);
|
||||
|
||||
if(dir.isEmpty() == false)
|
||||
{
|
||||
openFolder(dir);
|
||||
} else {
|
||||
#if (USE_VERSION_CHECK)
|
||||
// 열기 취소시에도 처리
|
||||
FMVersionChecker::instance()->start();
|
||||
#endif // USE_VERSION_CHECK
|
||||
}
|
||||
}
|
||||
void RMFrameList::onBackup()
|
||||
{
|
||||
#if (SINGLE_SAVE_FILE && !SINGLE_SAVE_CHECK_FILE)
|
||||
if(RMVideoFileList::instance()->getPlayItem() == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// Pressed focus 문제 발생하니 무시
|
||||
if(RMKeyEvent::instance()->exist())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RMPlayer::instance()->prepareForCapture();
|
||||
// 保存
|
||||
#if (FORCE_FM_STRING)
|
||||
QString title = FMS::txt("backup_title");
|
||||
#else
|
||||
QString title = MKU8("\xe4\xbf\x9d\xe5\xad\x98");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false) { title = "Backup AVI files";}
|
||||
#endif
|
||||
#endif
|
||||
QString dir = RMApp::openFolder(RMApp::appPath(RMApp::CAPTURE),true,title);
|
||||
if(dir.isEmpty() == false)
|
||||
{
|
||||
RMVideoFileListBackup* backup = new RMVideoFileListBackup(dir);
|
||||
QThreadPool::globalInstance()->start(backup,5);
|
||||
}
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
bool RMFrameList::isRootFolder(QString folderPath)
|
||||
{
|
||||
QString vpath = folderPath + QDir::separator() + "Video";
|
||||
QString ppath = folderPath + QDir::separator() + "Photo";
|
||||
return QDir(vpath).exists() && QDir(ppath).exists();
|
||||
}
|
||||
#endif // #if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void RMFrameList::openFolder(QString folderPath)
|
||||
{
|
||||
#if (USER_LOGER)
|
||||
if(RMApp::userLog) {
|
||||
RMApp::instance()->appendLog("INFO","OPEN FOLDER:" + QDir::cleanPath(folderPath));
|
||||
}
|
||||
#endif //
|
||||
// 년/월/일만 로딩함
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
if(isRootFolder(folderPath)) {
|
||||
thumbNailButton->setEnabled(true);
|
||||
RMApp::currentRoot = folderPath;
|
||||
RMSettings::instance()->setLastMoviePath(folderPath);
|
||||
//emit RMApp::instance()->appEvent(RMApp::ROOT_FOLDER_OPEN,0);
|
||||
//qInfo() << "EMIT RMApp::ROOT_FOLDER_OPEN" << __FUNCTION__;
|
||||
} else {
|
||||
thumbNailButton->setEnabled(false);
|
||||
//emit RMApp::instance()->appEvent(RMApp::NO_ROOT_FOLDER_OPEN,0);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
QList<QUrl> list;
|
||||
// 기타 폴더 가능, 전후방 동일 폴더 가능
|
||||
RMVideoFileList::appendFolderToList(folderPath,list);
|
||||
if(list.isEmpty() == false) {
|
||||
RMApp::currentRoot = folderPath; // USB 와 비교하기 위해 지정
|
||||
RMSettings::instance()->setLastMoviePath(folderPath);
|
||||
|
||||
RMVideoFileListLoader* loader = NULL;
|
||||
#if (PLAY_FIRST_LOADED)
|
||||
loader = new RMVideoFileListLoader(list,true);
|
||||
#else
|
||||
loader = new RMVideoFileListLoader(list);
|
||||
#endif
|
||||
QThreadPool::globalInstance()->start(loader,5);
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
} // else
|
||||
#endif
|
||||
|
||||
}
|
||||
#if (USE_VERSION_CHECK)
|
||||
void RMFrameList::onStartVersionCheck() {
|
||||
FMVersionChecker::instance()->start();
|
||||
}
|
||||
#endif // #if (USE_VERSION_CHECK)
|
||||
|
||||
void RMFrameList::onListUpdate(bool bLoading,RMVideoItem* item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
Q_UNUSED(item)
|
||||
if(bLoading) {
|
||||
countSimple->setText("[" + QString::number(RMVideoFileList::instance()->count1Hour) + "]");
|
||||
int ac = RMVideoFileList::instance()->allItems().count();
|
||||
countAll->setText("[" +QString::number(ac) + "]");
|
||||
#if (USE_VERSION_CHECK)
|
||||
QTimer::singleShot(200, Qt::PreciseTimer,this, SLOT(onStartVersionCheck()));
|
||||
#endif // USE_VERSION_CHECK
|
||||
|
||||
bool exist = !RMVideoFileList::instance()->allItems().isEmpty();
|
||||
thumbNailButton1->setEnabled(exist);
|
||||
thumbNailButton2->setEnabled(exist);
|
||||
}
|
||||
|
||||
#else // TELEBIT
|
||||
if(bLoading) {
|
||||
|
||||
#if !(RECORD_TYPE_COMBO_UI)
|
||||
bool bEnabled = RMVideoFileList::instance()->allItems().count() > 0;
|
||||
foreach (FMButton* btn, buttons) {
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TBD360)
|
||||
btn->setChecked(btn == normalButton);
|
||||
#else
|
||||
btn->setChecked(btn == allButton); // RM_MODEL == RM_MODEL_TYPE_XLDR_88
|
||||
#endif
|
||||
btn->setEnabled(bEnabled);
|
||||
}
|
||||
#else // RECORD_TYPE_COMBO_UI
|
||||
typeCombo->setCurrentIndex(RMVideoFileList::instance()->currentFilterIndex());
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
}
|
||||
#endif // #if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
}
|
||||
void RMFrameList::onBackupStarted()
|
||||
{
|
||||
// バックアップ中
|
||||
#if (FORCE_FM_STRING)
|
||||
RMDialogProgress::start(FMS::txt("backup_title"),true);
|
||||
#else
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
QString msg = RMLanguage::isJP() ? MKU8("\xe3\x83\x90\xe3\x83\x83\xe3\x82\xaf\xe3\x82\xa2\xe3\x83\x83\xe3\x83\x97\xe4\xb8\xad") : "Backup files...";
|
||||
RMDialogProgress::start(msg,true);
|
||||
#else
|
||||
RMDialogProgress::start(MKU8("\xe3\x83\x90\xe3\x83\x83\xe3\x82\xaf\xe3\x82\xa2\xe3\x83\x83\xe3\x83\x97\xe4\xb8\xad"),true);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
void RMFrameList::onBackupEnded()
|
||||
{
|
||||
// 체크 해제 -> 리스트에는 반영됨
|
||||
#if !(USE_1HOUR_FILTER)
|
||||
RMVideoFileList::instance()->clearChecked();
|
||||
#endif// #if !(USE_1HOUR_FILTER)
|
||||
|
||||
#if!(REMOVE_ALL_FILE_CHECK || SINGLE_SAVE_FILE)
|
||||
// ALL 도 UNCHECK 해야함
|
||||
listWidget->uncheckAll();
|
||||
#endif // REMOVE_ALL_FILE_CHECK
|
||||
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
backupButton->setEnabled(false);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
QApplication::restoreOverrideCursor();
|
||||
RMDialogProgress::stop();
|
||||
}
|
||||
void RMFrameList::onBackupPaused(bool bPaused)
|
||||
{
|
||||
if(bPaused) {
|
||||
RMDialogProgress::pause();
|
||||
RMDialogOverwrite* dialog = new RMDialogOverwrite(RMApp::instance()->pMainWindow);
|
||||
|
||||
if( dialog->exec() == 0) {
|
||||
RMOverwrite::gCurrent = OVERWRITE_OPTION_CANCEL;
|
||||
}
|
||||
|
||||
delete dialog;
|
||||
RMOverwrite::unwait();
|
||||
}
|
||||
else {
|
||||
RMDialogProgress::resume();
|
||||
}
|
||||
}
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void RMFrameList::refreshLanguage()
|
||||
{
|
||||
QString tag = RMLanguage::languageTag();
|
||||
_titleLabel->setPixmap( QPixmap(":/image/title_list" + tag + ".png") );
|
||||
#if !(RECORD_TYPE_COMBO_UI)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
allButton->setIcon("type_all" + tag);
|
||||
normalButton->setIcon("type_normal" + tag);
|
||||
eventButton->setIcon("type_event" + tag);
|
||||
//#if (RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
manualButton->setIcon("type_manual" + tag);
|
||||
//#endif // #if (RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
parkButton->setIcon("type_park" + tag);
|
||||
#else
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
normalButton->updateObject("group_normal" + tag);
|
||||
eventButton->updateObject("group_event" + tag);
|
||||
//openButton->updateObject("open" + tag);
|
||||
backupButton->updateObject("backup" + tag);
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
listWidget->onLanguageChange(RMLanguage::instance()->language());
|
||||
}
|
||||
void RMFrameList::onLanguageChange(RMLanguage::LANGUAGE_TYPE language)
|
||||
{
|
||||
Q_UNUSED(language);
|
||||
refreshLanguage();
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void RMFrameList::onAllList()
|
||||
{
|
||||
listSimpleButton->setChecked(false);
|
||||
listAllButton->setChecked(true);
|
||||
}
|
||||
void RMFrameList::onTypeChanged()
|
||||
{
|
||||
// 현재 상태 확인
|
||||
bool b1Hour = RMVideoFileList::instance()->get1HourList();
|
||||
listSimpleButton->setChecked(b1Hour);
|
||||
listAllButton->setChecked(!b1Hour);
|
||||
}
|
||||
void RMFrameList::onTypeOrSort()
|
||||
{
|
||||
//qInfo() << __FUNCTION__;
|
||||
RMVideoItem* selected = listWidget->getSelectedItem();
|
||||
|
||||
// 현재 상태 확인
|
||||
bool b1Hour = RMVideoFileList::instance()->get1HourList();
|
||||
bool bDsc = RMVideoFileList::instance()->getSortList();
|
||||
|
||||
FMButton* btn = qobject_cast<FMButton*>(sender());
|
||||
if(btn == listSimpleButton || btn == listAllButton) {
|
||||
b1Hour = (btn == listSimpleButton);
|
||||
|
||||
listWidget->getSelectedItem();
|
||||
|
||||
listSimpleButton->setChecked(b1Hour);
|
||||
listAllButton->setChecked(!b1Hour);
|
||||
|
||||
// 선택된 1시간 파일내에 포함된 파일 색상 처리는 listWidget 의 setSelected 에서 처리
|
||||
//listWidget->setSimpleDate(b1Hour ? QDateTime() : RMVideoFileList::instance()->simpleFromDateTime2(selected->startTime()));
|
||||
|
||||
} else if (btn == sortButton1) {
|
||||
bDsc = true; //!sortButton->isChecked();
|
||||
sortButton1->setChecked(true);
|
||||
sortButton2->setChecked(false);
|
||||
} else if (btn == sortButton2) {
|
||||
bDsc = false; //!sortButton->isChecked();
|
||||
sortButton1->setChecked(false);
|
||||
sortButton2->setChecked(true);
|
||||
}
|
||||
RMVideoFileList::instance()->setSortList(bDsc);
|
||||
RMVideoFileList::instance()->set1HourList(b1Hour,true,selected);
|
||||
}
|
||||
|
||||
void RMFrameList::onThumbnail()
|
||||
{
|
||||
#if (USE_DATE_FILTER)
|
||||
QString folder = datePicker->_videoDayFolder(true);
|
||||
FMThumbnailDialog* d = new FMThumbnailDialog(this, folder);
|
||||
QString title = datePicker->_yearListCombo->currentText() + FM_WSTR(L"년 ") + datePicker->_monthListCombo->currentText() + FM_WSTR(L"월 ") + datePicker->_dayListCombo->currentText() + FM_WSTR(L"일");
|
||||
d->setWindowTitle(title);
|
||||
if(d->exec() == 1 && !d->selectedFile.isEmpty()) { // ACCEPT
|
||||
|
||||
QString prefix = QFileInfo(d->selectedFile).baseName().left(20);
|
||||
|
||||
RMVideoItem* item = RMVideoFileList::instance()->searchPlayItem(prefix);
|
||||
qInfo() << "RET:" << d->selectedFile << item << __FUNCTION__;
|
||||
if(item != NULL) {
|
||||
listWidget->selectItem(item);
|
||||
listWidget->playItem(item);
|
||||
|
||||
}
|
||||
// 20231007-040556_PSR0_0017
|
||||
// 20231007-040556_PSR0_0017_0.jpg
|
||||
}
|
||||
delete d;
|
||||
#else // USE_DATE_FILTER
|
||||
|
||||
// 재생 종료
|
||||
RMPlayer::instance()->onUserStop();
|
||||
|
||||
bool bDetail = false;
|
||||
if(sender() != NULL && sender() == thumbNailButton2) {
|
||||
bDetail = true;
|
||||
}
|
||||
qInfo() << bDetail << __FUNCTION__;
|
||||
|
||||
|
||||
FMThumbnailDialog* d = new FMThumbnailDialog(RMApp::instance()->pMainWindow,bDetail);
|
||||
|
||||
QString title = "";//datePicker->_yearListCombo->currentText() + FM_WSTR(L"년 ") + datePicker->_monthListCombo->currentText() + FM_WSTR(L"월 ") + datePicker->_dayListCombo->currentText() + FM_WSTR(L"일");
|
||||
d->setWindowTitle(title);
|
||||
if(d->exec() == 1 && !d->selectedFile.isEmpty()) { // ACCEPT
|
||||
|
||||
QString prefix = QFileInfo(d->selectedFile).baseName().left(20);
|
||||
|
||||
// 상세 항목으로 변경
|
||||
if(RMVideoFileList::instance()->get1HourList()) {
|
||||
|
||||
listSimpleButton->setChecked(false);
|
||||
listAllButton->setChecked(true);
|
||||
|
||||
RMVideoFileList::instance()->setSortList(RMVideoFileList::instance()->getSortList());
|
||||
RMVideoFileList::instance()->set1HourList(false,true,NULL);
|
||||
}
|
||||
|
||||
RMVideoItem* item = RMVideoFileList::instance()->searchPlayItem(prefix);
|
||||
if(item != NULL) {
|
||||
listWidget->selectItem(item);
|
||||
listWidget->playItem(item);
|
||||
}
|
||||
// 20231007-040556_PSR0_0017
|
||||
// 20231007-040556_PSR0_0017_0.jpg
|
||||
}
|
||||
delete d;
|
||||
#endif // #if (USE_DATE_FILTER)
|
||||
}
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
#endif
|
||||
148
project/fm_viewer/ui/rm_frame_list.h
Normal file
148
project/fm_viewer/ui/rm_frame_list.h
Normal file
@@ -0,0 +1,148 @@
|
||||
#ifndef RM_FRAME_LIST_H
|
||||
#define RM_FRAME_LIST_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
#include <QShortcut>
|
||||
|
||||
class FMButton;
|
||||
class QComboBox;
|
||||
class RMWidgetVideoList;
|
||||
|
||||
extern int g_type_button_colors[];
|
||||
extern int g_type_button_colors2[];
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && USE_DATE_FILTER)
|
||||
class FMDatePicker;
|
||||
#endif
|
||||
|
||||
class RMFrameList : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static RMFrameList* getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
static RMFrameList* instance(QWidget* parent = nullptr);
|
||||
#if !(RECORD_TYPE_COMBO_UI)
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
QList<FMButton*> buttons;
|
||||
FMButton* normalButton;
|
||||
FMButton* eventButton;
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88)
|
||||
FMButton* allButton;
|
||||
FMButton* parkButton;
|
||||
#elif (RM_MODEL == RM_MODEL_TYPE_TBD360)
|
||||
FMButton* parkButton;
|
||||
#else
|
||||
FMButton* allButton;
|
||||
#endif
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if !(SUB_MODEL_KEIYO_360)
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W || RM_MODEL == RM_MODEL_TYPE_BV2000 || RM_MODEL == RM_MODEL_TYPE_MH9000 || RM_MODEL_TYPE_EMT_KR)
|
||||
FMButton* parkButton;
|
||||
//#if (RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
FMButton* manualButton;
|
||||
//#endif // NO MANUAL
|
||||
#endif // MODELS
|
||||
#endif // SUB_MODEL_KEIYO_360
|
||||
#else
|
||||
QComboBox* typeCombo;
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
|
||||
RMWidgetVideoList* listWidget;
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_TB4000)
|
||||
FMButton* backupButton;
|
||||
#endif // TB4000
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#if (USE_DATE_FILTER)
|
||||
FMDatePicker* datePicker;
|
||||
#endif // USE_DATE_FILTER
|
||||
FMButton* thumbNailButton1; // 1시간
|
||||
FMButton* thumbNailButton2; // 세부
|
||||
QLabel* countSimple;
|
||||
QLabel* countAll;
|
||||
|
||||
FMButton* sortButton1;
|
||||
FMButton* sortButton2;
|
||||
|
||||
FMButton* listSimpleButton;
|
||||
FMButton* listAllButton;
|
||||
|
||||
//! \brief 썸네일과 영상이 날짜별로 정렬 되어 있는 폴더인지 확인
|
||||
//! \param path: 폴더명
|
||||
//! \return
|
||||
static bool isRootFolder(QString path);
|
||||
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
void openFolder(QString folderPath);
|
||||
protected:
|
||||
static RMFrameList* _instance;
|
||||
explicit RMFrameList(QWidget *parent = nullptr);
|
||||
|
||||
QVBoxLayout* layout;
|
||||
void createTitle();
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void createDatePicker();
|
||||
#elif (RM_MODEL != RM_MODEL_TYPE_AN6000)
|
||||
void createTypeButtons();
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
QShortcut* backupShortCut;
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void refreshLanguage();
|
||||
#endif
|
||||
|
||||
#if !(DUAL_VIEWER)
|
||||
QLabel* _titleLabel;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
#if (RECORD_TYPE_COMBO_UI)
|
||||
void onToggleGroup(int selected);
|
||||
#else // RECORD_TYPE_COMBO_UI
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void onAllList();
|
||||
#else
|
||||
void onToggleGroup();
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
#endif // #if !(RECORD_TYPE_COMBO_UI)
|
||||
|
||||
void onOpen();
|
||||
void onBackup();
|
||||
|
||||
void onListUpdate(bool bLoading,RMVideoItem* item);
|
||||
#if !(SINGLE_SAVE_FILE)
|
||||
void onItemChecked(bool bSelected);
|
||||
#endif
|
||||
|
||||
void onBackupStarted();
|
||||
void onBackupEnded();
|
||||
void onBackupPaused(bool bPaused);
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void onThumbnail();
|
||||
void onTypeOrSort();
|
||||
|
||||
//! \brief 외부에서 타입 변경
|
||||
//! \param bSimple
|
||||
void onTypeChanged();
|
||||
#endif
|
||||
#if (USE_VERSION_CHECK)
|
||||
void onStartVersionCheck();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif // RM_CONTROL_LIST_H
|
||||
531
project/fm_viewer/ui/rm_frame_play.cpp
Normal file
531
project/fm_viewer/ui/rm_frame_play.cpp
Normal file
@@ -0,0 +1,531 @@
|
||||
#include "rm_frame_play.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "fm_button.h"
|
||||
#include <QTimer>
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_list.h"
|
||||
#include "../data/rm_video_item_loader.h"
|
||||
#include "../core/rm_play_process.h"
|
||||
#include "rm_widget_video_list.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include <QScreen>
|
||||
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
#include "rm_slider.h"
|
||||
#include "fm_colors.h"
|
||||
#endif // SPEED_IN_PLAY_CONTROL
|
||||
|
||||
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
#include "../core/rm_key_event.h"
|
||||
#endif
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
#include "window_main.h"
|
||||
#endif // TB4000
|
||||
|
||||
RMFramePlay::RMFramePlay(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
setStyleSheet("RMFramePlay{border-image: url(:/image/play_bg.png) 0 0 0 0 repeat stretch;}");
|
||||
#endif
|
||||
_createLayouts();
|
||||
// 플레이 중 버튼 상태 업데이트
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT, RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT, RMVideoItem*)));
|
||||
|
||||
// 리스트 로딩 완료 후 버튼 상태 업데이트
|
||||
connect(RMVideoFileList::instance(),SIGNAL(listUpdateEnd(bool,RMVideoItem*)),this,SLOT(onLoadingListEnd(bool,RMVideoItem*)));
|
||||
|
||||
//_pressTimer = new QElapsedTimer();
|
||||
}
|
||||
|
||||
void RMFramePlay::_createLayouts()
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0,1,0,0);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
|
||||
QWidget* left = new QWidget(this);
|
||||
left->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
layout->addWidget(left);
|
||||
QHBoxLayout* left_layout = new QHBoxLayout(left);
|
||||
left_layout->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
|
||||
left_layout->setContentsMargins(10,0,0,10);
|
||||
QLabel* vLabel = new QLabel(left);
|
||||
vLabel->setText(QString().sprintf("v%d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2));
|
||||
vLabel->setStyleSheet("font-family: Arial;font-size: 14px;color : #AAAAAA;");
|
||||
left_layout->addWidget(vLabel);
|
||||
|
||||
|
||||
layout->setAlignment(Qt::AlignVCenter);
|
||||
layout->setSpacing(10);
|
||||
//LAYOUT_SPACE(layout,17,0);// RMLayout::addSpacer(layout,16,0);
|
||||
QSize buttonSize = QSize(62,62);
|
||||
|
||||
filePreviousButton = FMButton::btn2(this,layout,"play_previous","play_file_previous",buttonSize);
|
||||
filePreviousButton->setEnabled(false);
|
||||
|
||||
frameBackwardButton = FMButton::btn2(this,layout,"play_backward","play_backward",buttonSize);
|
||||
frameBackwardButton->setAutoRepeat(false);
|
||||
RMKeyEvent* k = RMKeyEvent::instance();
|
||||
connect(frameBackwardButton,SIGNAL(pressed()),k,SLOT(onPressedB1()));
|
||||
connect(frameBackwardButton,SIGNAL(released()),k,SLOT(onReleasedB1()));
|
||||
frameBackwardButton->setEnabled(false);
|
||||
|
||||
|
||||
//_paused = false;
|
||||
// 正方向再生 MKU8("\xe6\xad\xa3\xe6\x96\xb9\xe5\x90\x91\xe5\x86\x8d\xe7\x94\x9f")
|
||||
playButton = FMButton::btnCheck2(this,layout,"play_play","play_play",buttonSize);
|
||||
connect(playButton, SIGNAL(released()),this,SLOT(onPlayOrPause()));
|
||||
playButton->setEnabled(false);
|
||||
|
||||
playShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
|
||||
playShortcut->setContext(Qt::ApplicationShortcut);
|
||||
connect(playShortcut, SIGNAL(activated()),this,SLOT(onPlayOrPause()));
|
||||
playShortcut->setEnabled(false);
|
||||
|
||||
restartShortcut = new QShortcut(QKeySequence(Qt::Key_Backspace), this);
|
||||
restartShortcut->setContext(Qt::ApplicationShortcut);
|
||||
connect(restartShortcut, SIGNAL(activated()),RMPlayer::instance(),SLOT(onPlayRestart()));
|
||||
restartShortcut->setEnabled(false);
|
||||
|
||||
stopButton = FMButton::btn2(this,layout,"play_stop","play_stop",buttonSize);
|
||||
connect(stopButton,SIGNAL(clicked()),RMPlayer::instance(),SLOT(onUserStop())); // 정지
|
||||
stopButton->setEnabled(false);
|
||||
stopButton->setHidden(true);
|
||||
|
||||
// 10秒進む MKU8("\x31\x30\xe7\xa7\x92\xe9\x80\xb2\xe3\x82\x80")
|
||||
frameForwardButton = FMButton::btn2(this,layout,"play_forward","play_forward",buttonSize);
|
||||
frameForwardButton->setAutoRepeat(false);
|
||||
connect(frameForwardButton,SIGNAL(pressed()),k,SLOT(onPressedF1()));
|
||||
connect(frameForwardButton,SIGNAL(released()),k,SLOT(onReleasedF1()));
|
||||
frameForwardButton->setEnabled(false);
|
||||
|
||||
fileNextButton = FMButton::btn2(this,layout,"play_next","play_file_next",buttonSize);
|
||||
fileNextButton->setEnabled(false);
|
||||
|
||||
connect(k,SIGNAL(pressedF1()),RMPlayer::instance(),SLOT(onSeekForwardStart()));
|
||||
connect(k,SIGNAL(releasedF1()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
connect(k,SIGNAL(pressedB1()),RMPlayer::instance(),SLOT(onSeekBackwardStart()));
|
||||
connect(k,SIGNAL(releasedB1()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
connect(k,SIGNAL(pressedFF()),RMPlayer::instance(),SLOT(onSeekFrameForwardStart()));
|
||||
connect(k,SIGNAL(releasedFF()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
|
||||
QWidget* right = new QWidget(this);
|
||||
right->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
layout->addWidget(right);
|
||||
QHBoxLayout* right_layout = new QHBoxLayout(right);
|
||||
right_layout->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
ZERO_LAYOUT(right_layout);
|
||||
|
||||
#else // RM_MODEL_TYPE_EMT_KR
|
||||
layout->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
#if !(SPEED_IN_PLAY_CONTROL)
|
||||
const int space = 10;
|
||||
#else // SPEED_IN_PLAY_CONTROL
|
||||
const int space = 7;
|
||||
#endif // SPEED_IN_PLAY_CONTROL
|
||||
layout->setSpacing(space);
|
||||
LAYOUT_SPACE(layout,17,0);// RMLayout::addSpacer(layout,16,0);
|
||||
QSize buttonSize = QSize(62,62);
|
||||
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
// 10秒前へ 이전으로 이동한다 MKU8("\x31\x30\xe7\xa7\x92\xe5\x89\x8d\xe3\x81\xb8")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
frameBackwardButton = FMButton::btn2(this,layout,"play_backward","play_backward",buttonSize);
|
||||
#else // #if (LIVE_LANGUAGE2)
|
||||
frameBackwardButton = FMButton::btn(this,layout,"play_backward",FMS::txt("play_backward"),buttonSize);
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
frameBackwardButton->setAutoRepeat(false);
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
RMKeyEvent* k = RMKeyEvent::instance();
|
||||
connect(frameBackwardButton,SIGNAL(pressed()),k,SLOT(onPressedB1()));
|
||||
connect(frameBackwardButton,SIGNAL(released()),k,SLOT(onReleasedB1()));
|
||||
#endif
|
||||
frameBackwardButton->setEnabled(false);
|
||||
#endif // #if !(REMOVE_SEEK_BUTTON)
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
// 버튼아이콘 다름
|
||||
filePreviousButton = FMButton::btn(this,layout,"play_backward",FMS::txt("play_file_previous"),buttonSize);
|
||||
filePreviousButton->setEnabled(false);
|
||||
#endif
|
||||
|
||||
//_paused = false;
|
||||
// 正方向再生 MKU8("\xe6\xad\xa3\xe6\x96\xb9\xe5\x90\x91\xe5\x86\x8d\xe7\x94\x9f")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
playButton = FMButton::btnCheck2(this,layout,"play_play","play_play",buttonSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
playButton = FMButton::btnCheck(this,layout,"play_play",FMS::txt("play_play"),buttonSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
//playButton->setCheckable(false);
|
||||
//connect(playButton, SIGNAL(released()),RMPlayer::instance(),SLOT(onPlayOrPause()));
|
||||
connect(playButton, SIGNAL(released()),this,SLOT(onPlayOrPause()));
|
||||
playButton->setEnabled(false);
|
||||
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
playShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
|
||||
playShortcut->setContext(Qt::ApplicationShortcut);
|
||||
connect(playShortcut, SIGNAL(activated()),this,SLOT(onPlayOrPause()));
|
||||
playShortcut->setEnabled(false);
|
||||
|
||||
restartShortcut = new QShortcut(QKeySequence(Qt::Key_Backspace), this);
|
||||
restartShortcut->setContext(Qt::ApplicationShortcut);
|
||||
connect(restartShortcut, SIGNAL(activated()),RMPlayer::instance(),SLOT(onPlayRestart()));
|
||||
restartShortcut->setEnabled(false);
|
||||
#endif
|
||||
|
||||
// 停止 MKU8("\xe5\x81\x9c\xe6\xad\xa2")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
stopButton = FMButton::btn2(this,layout,"play_stop","play_stop",buttonSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
stopButton = FMButton::btn(this,layout,"play_stop",FMS::txt("play_stop"),buttonSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
connect(stopButton,SIGNAL(clicked()),RMPlayer::instance(),SLOT(onUserStop())); // 정지
|
||||
stopButton->setEnabled(false);
|
||||
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
// 10秒進む MKU8("\x31\x30\xe7\xa7\x92\xe9\x80\xb2\xe3\x82\x80")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
frameForwardButton = FMButton::btn2(this,layout,"play_forward","play_forward",buttonSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
frameForwardButton = FMButton::btn(this,layout,"play_forward",FMS::txt("play_forward"),buttonSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
frameForwardButton->setAutoRepeat(false);
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
connect(frameForwardButton,SIGNAL(pressed()),k,SLOT(onPressedF1()));
|
||||
connect(frameForwardButton,SIGNAL(released()),k,SLOT(onReleasedF1()));
|
||||
//#else
|
||||
// connect(frameForwardButton,SIGNAL(clicked()),RMPlayer::instance(),SLOT(onSeekForward()));
|
||||
#endif
|
||||
frameForwardButton->setEnabled(false);
|
||||
#endif // #if !(REMOVE_SEEK_BUTTON)
|
||||
|
||||
// 以前ファイル
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
#if (LIVE_LANGUAGE2)
|
||||
filePreviousButton = FMButton::btn2(this,layout,"play_previous","play_file_previous",buttonSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
filePreviousButton = FMButton::btn(this,layout,"play_previous",FMS::txt("play_file_previous"),buttonSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
filePreviousButton->setEnabled(false);
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
layout->removeWidget(filePreviousButton);
|
||||
layout->insertWidget(1,filePreviousButton);
|
||||
#endif
|
||||
|
||||
// 次のファイル
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
fileNextButton = FMButton::btn(this,layout,"play_forward",FMS::txt("play_file_next"),buttonSize);
|
||||
#else
|
||||
#if (LIVE_LANGUAGE2)
|
||||
fileNextButton = FMButton::btn2(this,layout,"play_next","play_file_next",buttonSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
fileNextButton = FMButton::btn(this,layout,"play_next",FMS::txt("play_file_next"),buttonSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif
|
||||
fileNextButton->setEnabled(false);
|
||||
//connect(fileNextButton,SIGNAL(clicked()),fileList,SLOT(onPlayNextVideo()));
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
#if (USE_RM_KEYBOARD_EVENT)
|
||||
connect(k,SIGNAL(pressedF1()),RMPlayer::instance(),SLOT(onSeekForwardStart()));
|
||||
connect(k,SIGNAL(releasedF1()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
connect(k,SIGNAL(pressedB1()),RMPlayer::instance(),SLOT(onSeekBackwardStart()));
|
||||
connect(k,SIGNAL(releasedB1()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
connect(k,SIGNAL(pressedFF()),RMPlayer::instance(),SLOT(onSeekFrameForwardStart()));
|
||||
connect(k,SIGNAL(releasedFF()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
#if (PLAY_SYNC_FIX2)
|
||||
connect(k,SIGNAL(pressedBF()),RMPlayer::instance(),SLOT(onSeekFrameBackwardStart()));
|
||||
connect(k,SIGNAL(releasedBF()),RMPlayer::instance(),SLOT(onSeekStepEnd()));
|
||||
#endif // PLAY_SYNC_FIX2
|
||||
|
||||
#endif // USE_RM_KEYBOARD_EVENT
|
||||
#endif // REMOVE_SEEK_BUTTON
|
||||
#endif // #else // RM_MODEL_TYPE_EMT_KR
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
RMLanguage* lng = RMLanguage::instance();
|
||||
lng->appendENGToolTip(filePreviousButton,QString("Move to previous file"));
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
lng->appendENGToolTip(frameBackwardButton,QString("Move 1 sec backward"));
|
||||
#endif
|
||||
lng->appendENGToolTip(playButton,QString("Play"));
|
||||
lng->appendENGToolTip(stopButton,QString("Stop"));
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
lng->appendENGToolTip(frameForwardButton,QString("Move 1 sec forward"));
|
||||
#endif
|
||||
lng->appendENGToolTip(fileNextButton,QString("Move to next file"));
|
||||
#endif
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
#if (USE_MAXIMIZE)
|
||||
maxSpace = new QSpacerItem(1,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
#endif
|
||||
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
QWidget* speedControl = new QWidget(this);
|
||||
speedControl->setFixedWidth(130);
|
||||
layout->addWidget(speedControl);
|
||||
|
||||
QHBoxLayout* speedLayout = new QHBoxLayout(speedControl);
|
||||
ZERO_LAYOUT(speedLayout);
|
||||
speedLayout->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
speedBtn = FMButton::btn(speedControl,speedLayout,"v_speed",FMS::txt("play_speed"), QSize(30,30));
|
||||
connect(speedBtn,SIGNAL(clicked()),SLOT(onDefaultSpeed()));
|
||||
speedSlider = new RMReleasedSlider(speedControl);
|
||||
speedSlider->setTickInterval(1);
|
||||
speedSlider->setValue(DEFAULT_SPEED_INDEX); // 1.0 = 2
|
||||
speedSlider->setRange(0,3);
|
||||
FMSlider(speedSlider,"small_slider",FM_SILDER_COLOR,0x666666,true);
|
||||
speedLayout->addWidget(speedSlider);
|
||||
LAYOUT_SPACE(speedLayout,5,0);
|
||||
speedLabel = new QLabel(speedControl);
|
||||
speedLabel->setAlignment(Qt::AlignCenter);
|
||||
FMLabelBackground(speedLabel,"speed_label","Arial",0xf5f5f5,11,false,0x262626);
|
||||
speedLabel->setText("1 x");
|
||||
speedLabel->setFixedSize(25,16);
|
||||
speedLayout->addWidget(speedLabel);
|
||||
|
||||
//qInfo() << speedControl->width() << __FUNCTION__;
|
||||
RMPlayer::instance()->setSpeedSlider(speedSlider,speedLabel);
|
||||
#endif // #if (SPEED_IN_PLAY_CONTROL)
|
||||
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
layout->addItem(maxSpace);
|
||||
tool = new QWidget(this);
|
||||
layout->addWidget(tool);
|
||||
QHBoxLayout* toolLayout = new QHBoxLayout(tool);
|
||||
ZERO_LAYOUT(toolLayout);
|
||||
reportButton = FMButton::btn(tool,toolLayout,"report_t",FMS::txt("register"),QSize(77,70));
|
||||
openButton = FMButton::btn(tool,toolLayout,"open",FMS::txt("open"),QSize(77,70));
|
||||
saveButton = FMButton::btn(tool,toolLayout,"save_t",FMS::txt("save_video"),QSize(77,70));
|
||||
|
||||
fSaveButton = FMButton::btn(tool,toolLayout,"ffilesave",FM_WSTR(L"파일저장"),QSize(125,70));
|
||||
fPrintButton = FMButton::btn(tool,toolLayout,"fprint",FM_WSTR(L"프린트"),QSize(125,70));
|
||||
fReportButtonCH1 = FMButton::btn(tool,toolLayout,"freport_ch1",FM_WSTR(L"1번채널 보고서작성"),QSize(125,70));
|
||||
fReportButtonCH2 = FMButton::btn(tool,toolLayout,"freport_ch2",FM_WSTR(L"2번채널 보고서작성"),QSize(125,70));
|
||||
|
||||
fSaveButton->setHidden(true);
|
||||
fPrintButton->setHidden(true);
|
||||
fReportButtonCH1->setHidden(true);
|
||||
fReportButtonCH2->setHidden(true);
|
||||
//endItem = new QSpacerItem(10,0);
|
||||
//toolLayout->addSpacerItem(endItem);
|
||||
#elif (RM_MODEL_EMT_KR)
|
||||
QLabel* seperator = new QLabel(this);
|
||||
seperator->setPixmap(QPixmap(":/image/play_seperator.png"));
|
||||
right_layout->addWidget(seperator);
|
||||
openButton = FMButton::btn2(this,right_layout,"open","open",QSize(121,70));
|
||||
#else // RM_MODEL_TYPE_TB4000
|
||||
// MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x82\x92\xe9\x96\x8b\xe3\x81\x8f")
|
||||
#if (LIVE_LANGUAGE2)
|
||||
openButton = FMButton::btn2(this,layout,"open","open",QSize(121,70));
|
||||
#else // LIVE_LANGUAGE2
|
||||
openButton = FMButton::btn(this,layout,"open",FMS::txt("open"),QSize(121,70));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
layout->setAlignment(openButton,Qt::AlignRight);
|
||||
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
||||
onLanguageChange(RMLanguage::instance()->language());
|
||||
#endif // LIVE_LANGUAGE2
|
||||
}
|
||||
#if (LIVE_LANGUAGE2)
|
||||
void RMFramePlay::onLanguageChange(RMLanguage::LANGUAGE_TYPE language)
|
||||
{
|
||||
Q_UNUSED(language)
|
||||
//qInfo() << "LANGUAGE:" << RMLanguage::instance()->language() << RMLanguage::instance()->languageTag() << __FUNCTION__;
|
||||
openButton->setIcon("open" + RMLanguage::instance()->languageTag());
|
||||
}
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
void RMFramePlay::onDefaultSpeed()
|
||||
{
|
||||
speedSlider->setValue(DEFAULT_SPEED_INDEX);
|
||||
RMPlayer::instance()->updateSpeedForce(1.0);
|
||||
speedLabel->setText("1 x");
|
||||
}
|
||||
#endif // #if (SPEED_IN_PLAY_CONTROL)
|
||||
|
||||
void RMFramePlay::onPlayOrPause()
|
||||
{
|
||||
|
||||
playButton->blockFor(150);
|
||||
RMPlayer::instance()->onPlayOrPause();
|
||||
}
|
||||
RMFramePlay::~RMFramePlay()
|
||||
{
|
||||
// delete _pressTimer;
|
||||
}
|
||||
|
||||
void RMFramePlay::onLoadingListEnd(bool bLoading,RMVideoItem* selected)
|
||||
{
|
||||
Q_UNUSED(selected)
|
||||
Q_UNUSED(bLoading)
|
||||
bool bExist = RMVideoFileList::instance()->filteredItems().count() > 0;
|
||||
playButton->setEnabled(bExist);
|
||||
|
||||
filePreviousButton->setEnabled(bExist);
|
||||
fileNextButton->setEnabled(bExist);
|
||||
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
playShortcut->setEnabled(bExist);
|
||||
restartShortcut->setEnabled(bExist);
|
||||
#endif
|
||||
|
||||
}
|
||||
void RMFramePlay::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
WindowMain* pw = (WindowMain*)RMApp::instance()->pMainWindow;
|
||||
|
||||
// 일반화면에서는 무조건 제거
|
||||
if(event == RMApp::WillNormalScreen) {
|
||||
fSaveButton->setHidden(true);
|
||||
fPrintButton->setHidden(true);
|
||||
fReportButtonCH1->setHidden(true);
|
||||
fReportButtonCH2->setHidden(true);
|
||||
//endItem->changeSize(0,0);
|
||||
}
|
||||
//qInfo() << "pw->mMAXIMIZE:" << pw->mMAXIMIZE << "EVENT:" << event << __FUNCTION__;
|
||||
// 최대화 모드가 아닌 전체화면일 경우 채널버튼 켜기
|
||||
if(RMApp::mMAXIMIZE)
|
||||
{
|
||||
|
||||
} else {
|
||||
if(event == RMApp::WillFullScreen) {
|
||||
fSaveButton->setHidden(false);
|
||||
fPrintButton->setHidden(false);
|
||||
#if (SINGLE_CH_VIEWER)
|
||||
fReportButtonCH1->setHidden(false);
|
||||
#else // SINGLE_CH_VIEWER
|
||||
#if (FORCE_2CH)
|
||||
fReportButtonCH1->setHidden(pw->bSubFullScreen);
|
||||
fReportButtonCH2->setHidden(!pw->bSubFullScreen);
|
||||
#else // FORCE_2CH
|
||||
fReportButtonCH1->setHidden(pw->bSubFullScreen);
|
||||
#endif // FORCE_2CH
|
||||
#endif // #if (!SINGLE_CH_VIEWER)
|
||||
|
||||
//fReportButton->setText(pw->bSubFullScreen ? FM_WSTR(L"2번채널\n보고서작성") : FM_WSTR(L"1번채널\n보고서작성") );
|
||||
//endItem->changeSize(10,0);
|
||||
}
|
||||
// 최대화 모드에서는 건드리지 않는다
|
||||
openButton->setHidden((event == RMApp::WillFullScreen));
|
||||
saveButton->setHidden((event == RMApp::WillFullScreen));
|
||||
reportButton->setHidden((event == RMApp::WillFullScreen));
|
||||
}
|
||||
#else // TB4000
|
||||
#if (USE_MAXIMIZE)
|
||||
if(event == RMApp::WillNormalScreen)
|
||||
{
|
||||
layout->removeItem(maxSpace);
|
||||
}
|
||||
else {
|
||||
layout->insertItem(layout->indexOf(openButton),maxSpace);
|
||||
}
|
||||
#endif // USE_MAXIMIZE
|
||||
if(param == 1)
|
||||
{
|
||||
#if (USE_MAXIMIZE)
|
||||
#endif // #if (USE_MAXIMIZE)
|
||||
}
|
||||
else {
|
||||
openButton->setHidden((event == RMApp::WillFullScreen));
|
||||
}
|
||||
#endif // #else // TB4000
|
||||
}
|
||||
}
|
||||
void RMFramePlay::onPlayEvent(PLAY_EVENT event, RMVideoItem* item)
|
||||
{
|
||||
Q_UNUSED(item)
|
||||
|
||||
//#if (PLAY_CONTINUE_EVENT)
|
||||
// 다음파일 플레이시 변화 없도록 처리
|
||||
// if(RMPlayProcess::instance()->isLoadingNextFile()) {
|
||||
|
||||
// if(frameForwardButton->isDown())
|
||||
// {
|
||||
//// QCoreApplication::processEvents();
|
||||
//// emit frameForwardButton->released();
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
//#endif
|
||||
|
||||
if(event == PLAY_DID_PAUSED || event == PLAY_DID_PLAYED || event == PLAY_DID_CLEARED)
|
||||
{
|
||||
bool bShowPaused = (event == PLAY_DID_PLAYED);
|
||||
//qInfo() << "bShowPaused:" << bShowPaused << __FUNCTION__;
|
||||
playButton->setChecked(bShowPaused);
|
||||
//playButton->setStyleStatus("paused",bShowPaused);
|
||||
// 一時停止, 正方向再生
|
||||
// MKU8("\xe6\xad\xa3\xe6\x96\xb9\xe5\x90\x91\xe5\x86\x8d\xe7\x94\x9f")
|
||||
#if(REMOVE_OLD_C)
|
||||
playButton->setToolTip(bShowPaused ? FMS::txt("play_pause") :FMS::txt("play_play"));
|
||||
#else // REMOVE_OLD_C
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP()) {
|
||||
#endif //LIVE_LANGUAGE_CHANGE
|
||||
|
||||
playButton->setToolTip(bShowPaused ? FMS::txt("play_pause") :FMS::txt("play_play"));
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
} else {
|
||||
playButton->setToolTip(bShowPaused ? "Pause" : "Play");
|
||||
}
|
||||
#endif // LIVE_LANGUAGE_CHANGE
|
||||
#endif // REMOVE_OLD_C
|
||||
}
|
||||
|
||||
if(event == PLAY_DID_CLEARED && (item != NULL || RMPlayProcess::instance()->isLoadingNextFile()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(event == PLAY_DID_CLEARED || event == PLAY_DID_LOADED || event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
// 다음파일로 넘어갈때 5(PLAY_DID_CLEARED),5,2(PLAY_DID_LOADED) 발생
|
||||
// TODO 초기 리스트 로딩시 여러번 발생하는데 특별히 문제는 없음
|
||||
|
||||
// 변경사항이 아니면 처리하지 않는다.
|
||||
// ??? pressed 된 상태에서 enabled 처리되면 release 안됨!!
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
bool bEnabled = (event == PLAY_DID_LOADED);
|
||||
if(bEnabled != frameBackwardButton->isEnabled())
|
||||
#endif
|
||||
{
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
frameBackwardButton->setEnabled(event == PLAY_DID_LOADED);
|
||||
frameForwardButton->setEnabled(event == PLAY_DID_LOADED);
|
||||
#endif
|
||||
stopButton->setEnabled(event == PLAY_DID_LOADED);
|
||||
}
|
||||
|
||||
#if (PROFILE_VIDEO_FILE_LOADING && PROFILE_VIDEO_FILE_LOADING_AUTOPLAY)
|
||||
if(event == PLAY_DID_LOADED && item->durationInMSecs() > 1000)
|
||||
{
|
||||
QTimer::singleShot(1000,Qt::PreciseTimer,this,SLOT(onTestNext()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if (PROFILE_VIDEO_FILE_LOADING && PROFILE_VIDEO_FILE_LOADING_AUTOPLAY)
|
||||
void RMFramePlay::onTestNext()
|
||||
{
|
||||
emit fileNextButton->clicked();
|
||||
}
|
||||
#endif
|
||||
83
project/fm_viewer/ui/rm_frame_play.h
Normal file
83
project/fm_viewer/ui/rm_frame_play.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#ifndef RM_FRAME_PLAY_H
|
||||
#define RM_FRAME_PLAY_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
#include "../fm_event_types.h"
|
||||
#include <QShortcut>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
||||
class FMButton;
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
class RMReleasedSlider;
|
||||
#endif // #if (SPEED_IN_PLAY_CONTROL)
|
||||
class RMFramePlay : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
void _createLayouts();
|
||||
public:
|
||||
QHBoxLayout* layout;
|
||||
explicit RMFramePlay(QWidget *parent = nullptr);
|
||||
~RMFramePlay();
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
FMButton* frameBackwardButton;
|
||||
#endif
|
||||
FMButton* playButton;
|
||||
FMButton* stopButton;
|
||||
|
||||
#if !(REMOVE_SEEK_BUTTON)
|
||||
FMButton* frameForwardButton;
|
||||
#endif
|
||||
|
||||
FMButton* filePreviousButton;
|
||||
FMButton* fileNextButton;
|
||||
|
||||
#if !(REMOVE_ALL_SHORT_CUTS)
|
||||
QShortcut* playShortcut;
|
||||
QShortcut* restartShortcut;
|
||||
#endif
|
||||
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
FMButton* speedBtn;
|
||||
RMReleasedSlider* speedSlider;
|
||||
QLabel* speedLabel;
|
||||
#endif // SPEED_IN_PLAY_CONTROL
|
||||
|
||||
#if (USE_MAXIMIZE)
|
||||
QSpacerItem* maxSpace;
|
||||
#endif
|
||||
|
||||
FMButton* openButton;
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
QWidget* tool;
|
||||
FMButton* saveButton;
|
||||
FMButton* reportButton;
|
||||
|
||||
FMButton* fSaveButton;
|
||||
FMButton* fPrintButton;
|
||||
FMButton* fReportButtonCH1;
|
||||
FMButton* fReportButtonCH2;
|
||||
//QSpacerItem* endItem;
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
void onPlayEvent(PLAY_EVENT event, RMVideoItem* item);
|
||||
void onLoadingListEnd(bool bLoading,RMVideoItem* selected);
|
||||
#if (PROFILE_VIDEO_FILE_LOADING && PROFILE_VIDEO_FILE_LOADING_AUTOPLAY)
|
||||
void onTestNext();
|
||||
#endif
|
||||
void onPlayOrPause();
|
||||
#if (LIVE_LANGUAGE2)
|
||||
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (SPEED_IN_PLAY_CONTROL)
|
||||
void onDefaultSpeed();
|
||||
#endif // #if (SPEED_IN_PLAY_CONTROL)
|
||||
};
|
||||
|
||||
#endif // RM_CONTROL_PLAY_H
|
||||
113
project/fm_viewer/ui/rm_frame_right.cpp
Normal file
113
project/fm_viewer/ui/rm_frame_right.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
#include "rm_frame_right.h"
|
||||
#include "rm_frame_list.h"
|
||||
#include "core/rm_player.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../fm_app_colors.h"
|
||||
#include "fm_layer.h"
|
||||
|
||||
#if !(DUAL_VIEWER)
|
||||
#include "rm_frame_video_sub.h"
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
#include "fm_calendar.h"
|
||||
#endif
|
||||
|
||||
#if (USE_FRAME_GPS)
|
||||
#include "fm_frame_gps.h"
|
||||
#endif
|
||||
|
||||
RMFrameRight::RMFrameRight(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
setFixedWidth(RIGHT_FRAME_WIDTH);
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_KEIYO1 || RM_MODEL == RM_MODEL_TYPE_MBJ5010 || RM_MODEL == RM_MODEL_TYPE_FC_DR232W)
|
||||
frameGPS = new FMFrameGPS(this);
|
||||
frameGPS->setFixedHeight(RIGHT_HEADER_HEIGHT);
|
||||
//LAYOUT_DEBUG(gpsLonLat);
|
||||
layout->addWidget(frameGPS);
|
||||
#endif
|
||||
#if !(TOPDOWN_CH_LAYOUT || SINGLE_CH_VIEWER)
|
||||
QWidget* subVideoFrame = new QWidget(this);
|
||||
//subVideoFrame->setStyleSheet("background-color: #FF0000;");
|
||||
subVideoFrame->setFixedSize(RIGHT_FRAME_WIDTH,RIGHT_SUB_HEIGHT);
|
||||
layout->addWidget(subVideoFrame);
|
||||
#if (TOGGLE_PLAYER)
|
||||
frameMap = subVideoFrame;
|
||||
#else
|
||||
QVBoxLayout* subVideoLayout = new QVBoxLayout(subVideoFrame);
|
||||
subVideoLayout->setSpacing(0);
|
||||
subVideoLayout->setMargin(1);
|
||||
#if (!RM_MODEL_EMT_KR)
|
||||
FMWidgetBorder(subVideoFrame,"sub_video_frame",FM_COLOR_BORDER);
|
||||
#endif
|
||||
frameVideoSub = new RMFrameVideoSub(subVideoFrame);
|
||||
subVideoLayout->addWidget(frameVideoSub);
|
||||
#endif // TOGGLE_PLAYER
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
LAYOUT_SPACE(layout,0,3); // 6이됨
|
||||
#else // RM_MODEL_EMT_KR
|
||||
LAYOUT_SPACE(layout,0,11);
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
#endif // #if !(TOPDOWN_CH_LAYOUT)
|
||||
|
||||
|
||||
|
||||
frameList = RMFrameList::instance(this);
|
||||
frameList->setFixedWidth(RIGHT_FRAME_WIDTH);
|
||||
layout->addWidget(frameList);
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
// QWidget* tw = new QWidget(this);
|
||||
// QVBoxLayout* twl = new QVBoxLayout(tw);
|
||||
address = new QLabel(this);
|
||||
address->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
// twl->addWidget(address);
|
||||
// tw->setFixedHeight(32);
|
||||
address->setStyleSheet("font-size: 12px;color : white;");
|
||||
address->setFixedHeight(32);
|
||||
layout->addWidget(address);
|
||||
#endif // TB4000
|
||||
|
||||
#if (FIXED_MAP_FRAME)
|
||||
layout->addSpacerItem(new QSpacerItem(0,2));
|
||||
frameMap = new QWidget(this);
|
||||
frameMap->setFixedSize(RIGHT_FRAME_WIDTH,RIGHT_SUB_HEIGHT-2);
|
||||
frameMap->setStyleSheet("background-color: #414141;");
|
||||
QHBoxLayout* lb = new QHBoxLayout(frameMap);
|
||||
lb->setAlignment(Qt::AlignCenter);
|
||||
QLabel* logo = new QLabel(frameMap);
|
||||
logo->setPixmap( QPixmap(":/image/title_logo.png") );
|
||||
lb->addWidget(logo);
|
||||
layout->addWidget(frameMap);
|
||||
#endif // FIXED_MAP_FRAME
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
calendar = new FMCalendarFrame(this);
|
||||
layout->addWidget(calendar);
|
||||
#endif
|
||||
|
||||
LAYOUT_SPACE(layout,0,6);
|
||||
}
|
||||
|
||||
void RMFrameRight::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
#else // RM_MODEL_EMT_KR
|
||||
if(param == 0 && (event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen))
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
{
|
||||
setHidden(event == RMApp::WillFullScreen);
|
||||
}
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
else if (event == RMApp::ADDRESS_UPDATED) {
|
||||
address->setText("<p style=\"line-height:110\">" + RMApp::instance()->currentAddress + "<p>");
|
||||
}
|
||||
#endif // TB4000
|
||||
}
|
||||
|
||||
56
project/fm_viewer/ui/rm_frame_right.h
Normal file
56
project/fm_viewer/ui/rm_frame_right.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef RM_RIGHT_PANEL_H
|
||||
#define RM_RIGHT_PANEL_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
|
||||
// NORMAL MODE 에서는 전체 우측 영역
|
||||
// DUAL MODE 에서는 하단 우측 영역
|
||||
#if !(DUAL_VIEWER)
|
||||
class RMFrameVideoSub;
|
||||
#endif
|
||||
class RMFrameList;
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
class FMCalendarFrame;
|
||||
#endif
|
||||
|
||||
#if (USE_FRAME_GPS)
|
||||
class FMFrameGPS;
|
||||
#endif
|
||||
|
||||
class RMFrameRight : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMFrameRight(QWidget *parent = nullptr);
|
||||
|
||||
#if !(DUAL_VIEWER || TOGGLE_PLAYER || TOPDOWN_CH_LAYOUT || SINGLE_CH_VIEWER)
|
||||
RMFrameVideoSub* frameVideoSub; // sub video
|
||||
#endif
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
QLabel* address;
|
||||
#endif // TB4000
|
||||
#if (TOGGLE_PLAYER || FIXED_MAP_FRAME)
|
||||
QWidget* frameMap;
|
||||
#endif
|
||||
#if (USE_FRAME_GPS)
|
||||
FMFrameGPS* frameGPS;
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
||||
FMCalendarFrame* calendar;
|
||||
#endif
|
||||
|
||||
RMFrameList* frameList; // file list
|
||||
protected:
|
||||
QVBoxLayout* layout;
|
||||
|
||||
private:
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
};
|
||||
|
||||
#endif // RM_RIGHT_PANEL_H
|
||||
40
project/fm_viewer/ui/rm_frame_top.cpp
Normal file
40
project/fm_viewer/ui/rm_frame_top.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "rm_frame_top.h"
|
||||
#if (DUAL_VIEWER)
|
||||
#define TOP_FRAME_HEIGHT (MAIN_VIDEO_CONTROL_HEIGHT+10)
|
||||
|
||||
RMFrameTop::RMFrameTop(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
this->setFixedHeight(MAIN_VIDEO_CONTROL_HEIGHT+10);
|
||||
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
frameMainVideo = new RMFrameVideoMain(this);
|
||||
layout->addWidget(frameMainVideo);
|
||||
|
||||
frameVideoSub = new RMFrameVideoSub(this);
|
||||
layout->addWidget(frameVideoSub);
|
||||
|
||||
// 끄기
|
||||
frameVideoSub->dualOff(true);
|
||||
}
|
||||
void RMFrameTop::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
bool bFullScreen = (event == RMApp::WillFullScreen) ? true : false;
|
||||
if(bFullScreen)
|
||||
{
|
||||
this->setFixedSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX);
|
||||
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
this->setFixedHeight(TOP_FRAME_HEIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // DUAL_VIEWER
|
||||
31
project/fm_viewer/ui/rm_frame_top.h
Normal file
31
project/fm_viewer/ui/rm_frame_top.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef RM_FRAME_TOP_H
|
||||
#define RM_FRAME_TOP_H
|
||||
#if (DUAL_VIEWER)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_widget_base.h"
|
||||
#include "rm_frame_right.h"
|
||||
#include "rm_frame_video_main.h"
|
||||
#include "rm_frame_video_sub.h"
|
||||
|
||||
class RMFrameVideoMain;
|
||||
class RMFrameVideoSub;
|
||||
|
||||
class RMFrameTop : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMFrameTop(QWidget *parent = nullptr);
|
||||
|
||||
RMFrameVideoMain* frameMainVideo; // main video
|
||||
RMFrameVideoSub* frameVideoSub; // sub video
|
||||
|
||||
protected:
|
||||
QHBoxLayout* layout;
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event) override;
|
||||
};
|
||||
|
||||
#endif // DUAL_VIEWER
|
||||
#endif // RM_FRAME_TOP_H
|
||||
|
||||
2441
project/fm_viewer/ui/rm_frame_video_base.cpp
Normal file
2441
project/fm_viewer/ui/rm_frame_video_base.cpp
Normal file
File diff suppressed because it is too large
Load Diff
365
project/fm_viewer/ui/rm_frame_video_base.h
Normal file
365
project/fm_viewer/ui/rm_frame_video_base.h
Normal file
@@ -0,0 +1,365 @@
|
||||
#ifndef RM_FRAME_VIDEO_BASE
|
||||
#define RM_FRAME_VIDEO_BASE
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../fm_event_types.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
#include "rm_widget_zoom_pos.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QShortcut>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
|
||||
#if (RM_MODEL_360)
|
||||
#include "../core/rm_player.h"
|
||||
#include "../../fav/VideoRenderer.h"
|
||||
#endif
|
||||
|
||||
class FMButton;
|
||||
class RMVideoItem;
|
||||
class RMWidgetZoomPos;
|
||||
class FMLogoWidget;
|
||||
|
||||
#if (USE_DRAG_ZOOM)
|
||||
class FMDragZoomWidget;
|
||||
#endif
|
||||
|
||||
#if (USE_360_POSITION_VIEW)
|
||||
class QStackedLayout;
|
||||
class FM360PositionView;
|
||||
class FM360StaticPositionView;
|
||||
#endif // #if (USE_360_POSITION_VIEW)
|
||||
|
||||
class RMFrameVideoBase : public RMWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// QString styleChangeName ="",
|
||||
explicit RMFrameVideoBase(QWidget *parent = nullptr,bool bMain = true, bool bEvent = false);
|
||||
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
FMButton* btnClose;
|
||||
#endif //!PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
private:
|
||||
bool _bIsMainVideo; // 처음시작시 MAIN
|
||||
bool _bIsFrontVideo; // SWAP 포함하여 전/후방 구분
|
||||
|
||||
protected:
|
||||
QWidget* _videoWidget;
|
||||
#if (USE_360_POSITION_VIEW)
|
||||
QStackedLayout* videoLayout;
|
||||
FM360PositionView* _posView;
|
||||
//QStackedLayout* videoLayout;
|
||||
FM360StaticPositionView* _posStaticView;
|
||||
#endif // #if (USE_360_POSITION_VIEW)
|
||||
|
||||
#if (DUAL_VIDEO_WIDGET || TOPDOWN_360_QUAD_MODE)
|
||||
QWidget* _videoBaseWidget;
|
||||
QHBoxLayout* _videoWidgetLayout;
|
||||
QWidget* _videoWidget2;
|
||||
#if (TOPDOWN_360_QUAD_MODE)
|
||||
QWidget* _videoBaseTopWidget;
|
||||
QWidget* _videoBaseDownWidget;
|
||||
QVBoxLayout* _videoWidgetVLayout;
|
||||
QHBoxLayout* _videoWidgetLayout2; // 하단 (상단은 _videoWidgetLayout 사용)
|
||||
|
||||
QWidget* _videoWidget3;
|
||||
QWidget* _videoWidget4;
|
||||
#endif // TOPDOWN_360_QUAD_MODE
|
||||
|
||||
#endif // DUAL_VIDEO_WIDGET
|
||||
|
||||
|
||||
QWidget* _titleBar;
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
QLabel* _fileNameLabel;
|
||||
#endif // PLAYER_ONLY_LIBRARY_MODE
|
||||
|
||||
|
||||
QWidget* titleTools;
|
||||
QHBoxLayout* titleToolLayout;
|
||||
#if !(NO_CAMERA_TITLE)
|
||||
QLabel* titleLabel;
|
||||
#endif // #if !(NO_CAMERA_TITLE)
|
||||
FMButton* btnFullScreen;
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && !PLAYER_ONLY_LIBRARY_MODE)
|
||||
FMButton* btnTB5000;
|
||||
#endif // RM_MODEL_TYPE_TB4000
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
FMButton* btnFlipH;
|
||||
#if !(TOP_DOWN_360)
|
||||
FMButton* btnFlipV;
|
||||
#endif // #if (TOP_DOWN_360)
|
||||
|
||||
#if !(SINGLE_CH_VIEWER || PENTA_CHANNEL)
|
||||
FMButton* btnSwap;
|
||||
#endif // #if !(SINGLE_CH_VIEWER)
|
||||
|
||||
#if (TRI_CHANNEL || TRI_CHANNEL2)
|
||||
FMButton* btnIndoor;
|
||||
#endif // TRI_CHANNEL
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
FMButton* btn360Wide;
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
|
||||
|
||||
|
||||
#if (TOP_DOWN_360)
|
||||
|
||||
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
FMButton* btnZoom360;
|
||||
FMButton* btnMode360;
|
||||
#else
|
||||
FMButton* btnMode360_2D;
|
||||
FMButton* btnMode360_3D;
|
||||
FMButton* btnMode360_4CH;
|
||||
FMButton* btnMode360_5CH;
|
||||
|
||||
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
QLabel* seperator;
|
||||
FMButton* btnReset360;
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
FMButton* btnSave360; ///! 4,5분할 저장 버튼
|
||||
#endif
|
||||
|
||||
MODE_360 mode360;
|
||||
|
||||
bool modeZoom;
|
||||
void refreshMode360();
|
||||
#if (MOUSE_DRAG_ACCELERATION)
|
||||
int _scrollCount; // 현재 남은 scroll 개수
|
||||
int _scrollStartCount; // 전체 scroll 개수 (감속을 위해 사용)
|
||||
QPoint _lastSpeedPos; // Speed Accmulation
|
||||
QTime _dragTimer; // Speed "
|
||||
QPointF _lastSpeed; // XY Speed Vector
|
||||
QTimer* _accelerationTimer; // On Mouse Up Start timer
|
||||
void stopAccelerationTimer();
|
||||
#endif // MOUSE_DRAG_ACCELERATION
|
||||
#if (USE_POINT_ZOOM)
|
||||
FAV::VideoRenderer* _pVR; // video renderer
|
||||
bool _bZoomMode; // 확대 모드
|
||||
QCursor* _magnifyZoom; // 확대 커서
|
||||
void sendSelectedSignal();
|
||||
#endif // USE_POINT_ZOOM
|
||||
#endif // TOP_DOWN_360
|
||||
|
||||
|
||||
#if (RESIZE_FILTER && !DO_NOT_USE_ZOOM)
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
#endif
|
||||
|
||||
#if (USE_DRAG_ZOOM)
|
||||
FMDragZoomWidget* dragWidget;
|
||||
#endif
|
||||
|
||||
#if (CLICK_PAUSE_PLAY)
|
||||
QTimer* clickTimer; ///! 더블클릭이 아닌 경우에만 play/pause 처리
|
||||
#endif
|
||||
|
||||
QVBoxLayout* layout;
|
||||
FMLogoWidget* logoWidget;
|
||||
|
||||
void setVideoWidget(QWidget* widget);
|
||||
#if (DUAL_VIDEO_WIDGET)
|
||||
void setVideoWidget2(QWidget* widget);
|
||||
#endif // DUAL_VIDEO_WIDGET
|
||||
#if(TOPDOWN_360_QUAD_MODE)
|
||||
void setOtherVideoWidgets(QWidget* widget2,QWidget* widget3,QWidget* widget4);
|
||||
#endif
|
||||
|
||||
public:
|
||||
void _videoOnOff(bool on);
|
||||
protected:
|
||||
bool bIsFullScreen;
|
||||
void _createTitleBar();
|
||||
void refreshVideoOff();
|
||||
void refreshButtons(bool bSingle);
|
||||
|
||||
#if (CLICK_PAUSE_PLAY)
|
||||
void startClickTimer();
|
||||
void cancelClickTimer();
|
||||
#endif // CLICK_PAUSE_PLAY
|
||||
|
||||
|
||||
#if !(DO_NOT_USE_ZOOM)
|
||||
|
||||
#if !(ZOOM_SHADER)
|
||||
// PIP
|
||||
QWidget* zoomWidget;
|
||||
QHBoxLayout* zoomLayout;
|
||||
QHBoxLayout* videoLayout;
|
||||
|
||||
QHBoxLayout* zoomPosLayout;
|
||||
RMWidgetZoomPos* zoomPos;
|
||||
QWidget* zoomVideoWidget;
|
||||
|
||||
void _updateZoomProcess(QPoint pos);
|
||||
|
||||
QPoint _zoomPos;
|
||||
QTimer* _zoomTimer;
|
||||
bool bPIPRight;
|
||||
|
||||
#if (USE_ZOOM_WH_RATIO)
|
||||
void refreshZoomWidgetWH();
|
||||
#endif
|
||||
#endif // ZOOM_SHADER
|
||||
|
||||
public:
|
||||
bool bZoomStarted;
|
||||
|
||||
protected:
|
||||
|
||||
#if !(ZOOM_SHADER)
|
||||
QRect pipRect;
|
||||
void refreshPIP();
|
||||
#endif
|
||||
|
||||
#if (PENTA_CHANNEL)
|
||||
FMButton* selectButtons[7];
|
||||
void _createCHTool(QWidget* parent, QHBoxLayout* layout);
|
||||
//! \brief 언어 변경시 수정
|
||||
void _refreshCHTool();
|
||||
#endif // #if (PENTA_CHANNEL)
|
||||
// ZOOM CONTROL
|
||||
|
||||
bool _wasPIPHidden;
|
||||
#endif // DO_NOT_USE_ZOOM
|
||||
|
||||
#if (MODEL_360)
|
||||
bool _dualMode; // Mirror 모드 (회전,이동금지)
|
||||
bool _zoom3D;
|
||||
double _startAngle;
|
||||
double _startPitch;
|
||||
bool _offByDualMode; // 360 후방 끄기
|
||||
#endif
|
||||
QSize _resolution;
|
||||
|
||||
#if (!DO_NOT_USE_ZOOM || MODEL_360 || TOP_DOWN_360)
|
||||
bool _dragStart;
|
||||
QPoint _dragPos;
|
||||
bool _mousePressed;
|
||||
|
||||
#if (TOP_DOWN_360)
|
||||
#if (!USE_POINT_ZOOM || USE_HYBRID_ZOOM)
|
||||
bool _drawStarted;
|
||||
#endif //PZ
|
||||
|
||||
#if (!USE_POINT_ZOOM || USE_HYBRID_ZOOM)
|
||||
QRect _rect;
|
||||
QPainter _painter;
|
||||
#endif
|
||||
|
||||
//bool _ROIEnabled;
|
||||
void wheelEvent(QWheelEvent *e) override;
|
||||
#endif // TOP_DOWN_360
|
||||
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
#endif // DO_NOT_USE_ZOOM
|
||||
|
||||
//#if (RM_MODEL == RM_MODEL_TYPE_TB4000 || ZOOM_SHADER || MODEL_360)
|
||||
#if !(DO_NOT_USE_ZOOM) || (RM_MODEL == RM_MODEL_TYPE_TB4000)
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
#endif // DO_NOT_USE_ZOOM
|
||||
//#endif // RM_MODEL_TYPE_TB4000
|
||||
|
||||
|
||||
#if (TOP_DOWN_360)
|
||||
void _refresh360UI();
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
virtual void refreshLanguageSub(){}
|
||||
void refreshLanguage(); // 언어 변경
|
||||
#endif
|
||||
#if !(NO_CAMERA_TITLE)
|
||||
void refreshTitle(bool bForceFlip); // 전후방 표시 (강제 전환 포함)
|
||||
#endif // #if !(NO_CAMERA_TITLE)
|
||||
|
||||
#if (MODEL_360)
|
||||
void dualOff(bool off); // 후방 채널 끄기
|
||||
void setDualMode(bool dual);
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
virtual void onPlayEvent(PLAY_EVENT event, RMVideoItem* item);
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
|
||||
#if (CLICK_PAUSE_PLAY)
|
||||
void onClicked();
|
||||
void onPlayOrPause();
|
||||
#endif // CLICK_PAUSE_PLAY
|
||||
#if !(DO_NOT_USE_ZOOM)
|
||||
// ZOOM 업데이트
|
||||
|
||||
#if !(ZOOM_SHADER)
|
||||
void onUpdateZoom();
|
||||
void onForceUpdateZoom();
|
||||
#endif
|
||||
|
||||
// ZOOM 시작, 종료
|
||||
void onToggleZoom();
|
||||
|
||||
// ZOOM 위치이동
|
||||
void onTogglePIPLocation();
|
||||
|
||||
// 실제 감추기만 하고 마우스 동작은 됨
|
||||
void onToggleShowHidePIP();
|
||||
|
||||
void onHidePIPForCapture(bool hide);
|
||||
#endif
|
||||
|
||||
#if (TOP_DOWN_360)
|
||||
void onMode360();
|
||||
void onReset360();
|
||||
void onZoom360();
|
||||
#if (MOUSE_DRAG_ACCELERATION)
|
||||
void onScroll();
|
||||
#endif // MOUSE_DRAG_ACCELERATION
|
||||
#if (USE_POINT_ZOOM)
|
||||
void onZoomChange(bool bZoom);
|
||||
#endif // USE_POINT_ZOOM
|
||||
#if (PLAYER_ONLY_LIBRARY_MODE)
|
||||
void onSave360();
|
||||
#endif // LIBRARY_MODE
|
||||
#endif // TOP_DOWN_360
|
||||
|
||||
// 비디오 표시 (로딩 후 타이머 처리)
|
||||
// void onShowVideo();
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_TB4000 && !PLAYER_ONLY_LIBRARY_MODE)
|
||||
void onTB5000();
|
||||
#endif //
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
|
||||
#endif
|
||||
#if (PENTA_CHANNEL)
|
||||
void onSelectVideo();
|
||||
//! \brief onSelectVideo 에서 기능만 분리
|
||||
//! \param mode
|
||||
void selectMode(int mode);
|
||||
#endif
|
||||
|
||||
#if (USE_360_POSITION_VIEW)
|
||||
void onAngleUpdated(double yaw,double pitch);
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
void onToggleWideMode();
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
signals:
|
||||
void modeZoomChange(bool zoom);
|
||||
void mode360Change(int mode);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // RM_FRAME_VIDEO_BASE
|
||||
60
project/fm_viewer/ui/rm_frame_video_main.cpp
Normal file
60
project/fm_viewer/ui/rm_frame_video_main.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "rm_frame_video_main.h"
|
||||
#include "core/rm_player.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "../ui/fm_button.h"
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88)
|
||||
#include <QFileInfo>
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#endif
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
#define MAIN_FRAME_BORDER "top_border"
|
||||
#else
|
||||
#define MAIN_FRAME_BORDER ""
|
||||
#endif
|
||||
|
||||
// MAIN_FRAME_BORDER
|
||||
RMFrameVideoMain::RMFrameVideoMain(QWidget *parent) : RMFrameVideoBase(parent,true,true) // "top_border"
|
||||
{
|
||||
//setFixedHeight(MAIN_VIDEO_CONTROL_HEIGHT);
|
||||
//this->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
|
||||
#if !(DO_NOT_USE_ZOOM || ZOOM_SHADER)
|
||||
pipRect = QRect(18,17,166,93+1);
|
||||
#endif
|
||||
|
||||
|
||||
setVideoWidget(RMPlayer::instance()->playWidgetF());
|
||||
#if (DUAL_VIDEO_WIDGET)
|
||||
setVideoWidget2(RMPlayer::instance()->playWidgetR());
|
||||
#endif
|
||||
|
||||
#if (TOPDOWN_360_QUAD_MODE)
|
||||
setOtherVideoWidgets(RMPlayer::instance()->_videoOutput2->widget(),
|
||||
RMPlayer::instance()->_videoOutput3->widget(),
|
||||
RMPlayer::instance()->_videoOutput4->widget());
|
||||
#endif
|
||||
}
|
||||
void RMFrameVideoMain::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
RMFrameVideoBase::onAppEvent(event,param);
|
||||
#if (!DUAL_VIEWER)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
/*
|
||||
bIsFullScreen = event == RMApp::WillFullScreen;
|
||||
#if (MODEL_STANDARD)
|
||||
titleLabel->setHidden(bIsFullScreen);
|
||||
#endif
|
||||
*/
|
||||
//this->setFixedHeight(bIsFullScreen ? QWIDGETSIZE_MAX : MAIN_VIDEO_CONTROL_HEIGHT);
|
||||
//this->setSizePolicy(QSizePolicy::Preferred,bIsFullScreen ? QSizePolicy::Preferred : QSizePolicy::Fixed);
|
||||
#if !(DO_NOT_USE_ZOOM || ZOOM_SHADER)
|
||||
refreshPIP();
|
||||
#endif
|
||||
}
|
||||
#endif // DUAL_VIEWER
|
||||
}
|
||||
|
||||
24
project/fm_viewer/ui/rm_frame_video_main.h
Normal file
24
project/fm_viewer/ui/rm_frame_video_main.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef RM_FRAME_VIDEO_MAIN_H
|
||||
#define RM_FRAME_VIDEO_MAIN_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_frame_video_base.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
|
||||
class RMWidgetZoomPos;
|
||||
class RMFrameVideoMain : public RMFrameVideoBase
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
explicit RMFrameVideoMain(QWidget *parent = nullptr);
|
||||
|
||||
|
||||
public slots:
|
||||
void onAppEvent(RMApp::Event event,int param) override;
|
||||
};
|
||||
|
||||
#endif // RM_FRAME_VIDEO_MAIN_H
|
||||
162
project/fm_viewer/ui/rm_frame_video_sub.cpp
Normal file
162
project/fm_viewer/ui/rm_frame_video_sub.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
#include "rm_frame_video_sub.h"
|
||||
#include "rm_button.h"
|
||||
#include "rm_dialog_map.h"
|
||||
#include "../rm_app.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include <QMainWindow>
|
||||
|
||||
//"",
|
||||
RMFrameVideoSub::RMFrameVideoSub(QWidget *parent) : RMFrameVideoBase(parent,false,true)
|
||||
{
|
||||
#if !(DO_NOT_USE_ZOOM || ZOOM_SHADER)
|
||||
pipRect = QRect(8,8,84,48);
|
||||
#endif
|
||||
|
||||
#if ((!SINGLE_CH_VIEWER && !TOGGLE_PLAYER) || DUAL_VIEWER)
|
||||
setVideoWidget(RMPlayer::instance()->playWidgetR());
|
||||
#endif
|
||||
|
||||
#if !((DUAL_CH_FILE && !DUAL_CH_1CH_EXIST) || SINGLE_CH_VIEWER)
|
||||
_temporarySwap = false;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
refreshLanguageSub();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void RMFrameVideoSub::onPlayEvent(PLAY_EVENT event, RMVideoItem* item)
|
||||
{
|
||||
//LOG_TEST << "EVENT:" << event;
|
||||
RMFrameVideoBase::onPlayEvent(event,item);
|
||||
if(event == PLAY_DID_LOADED)
|
||||
{
|
||||
//#if (MODEL_STANDARD && !SINGLE_CH_VIEWER)
|
||||
// _toggleButton->setEnabled(item->isSingleChannel() == false);
|
||||
//#endif
|
||||
|
||||
#if (DUAL_CH_1CH_EXIST)
|
||||
// 2CH DUAL 중 1CH 만 존재하는 경우 강제 toggle
|
||||
//LOG_TEST << "SWAPPED:" << RMPlayer::instance()->isSwapped() << " CH:" << (item->filePathCH2.length() > 0);
|
||||
bool bToogle = false;
|
||||
|
||||
// _temporarySwap 의 경우
|
||||
// 현재 상태는 항상 swap 이 아닌 상태임 (swap 상태를 정상으로 변경했기 때문에)
|
||||
// 따라서 상태가 _temporarySwap 일 경우 현재 single file 이 아닐 경우 무조건 swap 상태로 만들어야함
|
||||
if(_temporarySwap)
|
||||
{
|
||||
if(item->isSingleChannel() == false && RMPlayer::instance()->isSwapped() == false)
|
||||
{
|
||||
bToogle = true;
|
||||
_temporarySwap = false;
|
||||
}
|
||||
}
|
||||
// 정상 상태일 경우 (_temporarySwap 이 아닌)
|
||||
// 현재 상태는 swap 일 수도, 아닐 수도 있으며
|
||||
// 1CH 파일이며
|
||||
// swap 상태일 경우에는 임시 toggle 해야함
|
||||
else
|
||||
{
|
||||
if(RMPlayer::instance()->isSwapped() == true && item->isSingleChannel() == true)
|
||||
{
|
||||
bToogle = true;
|
||||
_temporarySwap = true;
|
||||
}
|
||||
}
|
||||
|
||||
//LOG_TEST << "TOGGLE:" << bToogle << " _temporarySwap:" << _temporarySwap;
|
||||
if(bToogle)
|
||||
{
|
||||
RMPlayer::instance()->toggleSwap(true);
|
||||
}
|
||||
#endif // DUAL_CH_1CH_EXIST
|
||||
}
|
||||
else if (event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
#if !((DUAL_CH_FILE && !DUAL_CH_1CH_EXIST) || SINGLE_CH_VIEWER)
|
||||
|
||||
// SWAPPED: true CH: false
|
||||
// TOGGLE: false _temporarySwap: true
|
||||
// swap -> 1CH 플레이 -> stop -> swap -> 1CH 플레이 하면 후방에서 표시됨
|
||||
// 방지하기 위해 STOP 시점에서 _temporarySwap 할 경우 원상복귀
|
||||
if(_temporarySwap) {
|
||||
_temporarySwap = false;
|
||||
RMPlayer::instance()->toggleSwap();
|
||||
}
|
||||
#endif // #if !(DUAL_CH_FILE)
|
||||
|
||||
//#if (MODEL_STANDARD && !SINGLE_CH_VIEWER)
|
||||
// _toggleButton->setEnabled(true);
|
||||
//#endif
|
||||
}
|
||||
else if (event == PLAY_WILL_LOADED)
|
||||
{
|
||||
#if !(DUAL_CH_FILE || SINGLE_CH_VIEWER)
|
||||
//LOG_TEST << "SWAPPED:" << RMPlayer::instance()->isSwapped() << " CH:" << (item->filePathCH2.length() > 0);
|
||||
bool bToogle = false;
|
||||
|
||||
// _temporarySwap 의 경우
|
||||
// 현재 상태는 항상 swap 이 아닌 상태임 (swap 상태를 정상으로 변경했기 때문에)
|
||||
// 따라서 상태가 _temporarySwap 일 경우 현재 single file 이 아닐 경우 무조건 swap 상태로 만들어야함
|
||||
if(_temporarySwap)
|
||||
{
|
||||
if(item->filePathCH2.length() > 0 && RMPlayer::instance()->isSwapped() == false)
|
||||
{
|
||||
bToogle = true;
|
||||
_temporarySwap = false;
|
||||
}
|
||||
}
|
||||
// 정상 상태일 경우 (_temporarySwap 이 아닌)
|
||||
// 현재 상태는 swap 일 수도, 아닐 수도 있으며
|
||||
// 1CH 파일이며
|
||||
// swap 상태일 경우에는 임시 toggle 해야함
|
||||
else
|
||||
{
|
||||
if(RMPlayer::instance()->isSwapped() == true && item->filePathCH2.length() == 0)
|
||||
{
|
||||
bToogle = true;
|
||||
_temporarySwap = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//LOG_TEST << "TOGGLE:" << bToogle << " _temporarySwap:" << _temporarySwap;
|
||||
if(bToogle)
|
||||
{
|
||||
RMPlayer::instance()->toggleSwap();
|
||||
}
|
||||
#endif // #if !(DUAL_CH_FILE)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//#if !(DUAL_VIEWER)
|
||||
//void RMFrameVideoSub::onMap()
|
||||
//{
|
||||
// //qInfo() << "size:" << _videoWidget->size();
|
||||
// if(RMDialogMap::instance()->isHiddenReal()) {
|
||||
// RMDialogMap::instance()->show();
|
||||
// RMDialogMap::instance()->setFocus();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// RMDialogMap::instance()->onClose();
|
||||
// }
|
||||
//}
|
||||
//#endif // DUAL_VIEWER
|
||||
|
||||
//#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
||||
//void RMFrameVideoSub::refreshLanguageSub()
|
||||
//{
|
||||
// QString objectName = "swap_video" + RMLanguage::languageTag();
|
||||
// _toggleButton->updateObject(objectName);
|
||||
|
||||
// objectName = "map" + RMLanguage::languageTag();
|
||||
// _mapButton->updateObject(objectName);
|
||||
//}
|
||||
//#endif
|
||||
30
project/fm_viewer/ui/rm_frame_video_sub.h
Normal file
30
project/fm_viewer/ui/rm_frame_video_sub.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef RM_FRAME_VIDEO_SUB_H
|
||||
#define RM_FRAME_VIDEO_SUB_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../core/rm_player_base.h"
|
||||
#include "rm_frame_video_base.h"
|
||||
|
||||
class RMVideoItem;
|
||||
class RMButton;
|
||||
class RMFrameVideoSub : public RMFrameVideoBase
|
||||
{
|
||||
Q_OBJECT
|
||||
#if (RM_TESTING)
|
||||
friend class RMTestProcess;
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit RMFrameVideoSub(QWidget *parent = nullptr);
|
||||
private:
|
||||
|
||||
#if !((DUAL_CH_FILE && !DUAL_CH_1CH_EXIST) || SINGLE_CH_VIEWER)
|
||||
bool _temporarySwap; // 전후방 토글 상태에서 1CH 파일이 로딩될 경우 임시 토글
|
||||
#endif
|
||||
|
||||
protected:
|
||||
public slots:
|
||||
void onPlayEvent(PLAY_EVENT event, RMVideoItem* item);
|
||||
};
|
||||
|
||||
#endif // RM_FRAME_VIDEO_SUB_H
|
||||
378
project/fm_viewer/ui/rm_gps_position.cpp
Normal file
378
project/fm_viewer/ui/rm_gps_position.cpp
Normal file
@@ -0,0 +1,378 @@
|
||||
#include "rm_gps_position.h"
|
||||
#if (MODEL_BBVIEWER)
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include "../data/rm_sensordata.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../core/rm_language.h"
|
||||
|
||||
#if (MODEL_WATEX)
|
||||
RMGPSPosition::RMGPSPosition(QWidget *parent, bool map) : RMWidgetStyleBase(parent,"",false)
|
||||
{
|
||||
setFixedWidth(map ? 350 : 192);
|
||||
//setFixedSize(map ? 240 : 192,map ? 50 : 34);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
RMLayout::addSpacer(layout,19,0);
|
||||
|
||||
QWidget* iconParent = new QWidget(this);
|
||||
iconParent->setFixedSize(38,55);
|
||||
layout->addWidget(iconParent);
|
||||
QVBoxLayout* iconLayout = new QVBoxLayout(iconParent);
|
||||
iconLayout->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||
ZERO_LAYOUT(iconLayout);
|
||||
|
||||
QLabel* iconLabel = new QLabel(iconParent);
|
||||
iconLabel->setAlignment(Qt::AlignCenter);
|
||||
iconLabel->setObjectName("title_gps");
|
||||
iconLabel->setText("GPS");
|
||||
iconLabel->setFixedSize(38,18);
|
||||
iconLayout->addWidget(iconLabel);
|
||||
|
||||
gpsIcon = new QLabel(iconParent);
|
||||
gpsIcon->setPixmap(QPixmap(":/image/gps_icon_gps_off.png"));
|
||||
gpsIcon->setFixedSize(38,34);
|
||||
iconLayout->addWidget(gpsIcon);
|
||||
|
||||
RMLayout::addSpacer(layout,19,0);
|
||||
|
||||
lonLatWidget = new QWidget(this);
|
||||
lonLatWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
lonLatWidget->setFixedWidth(map ? (115*2 + 10) : 115);
|
||||
layout->addWidget(lonLatWidget);
|
||||
layout->addSpacerItem(new QSpacerItem(2,0));
|
||||
|
||||
|
||||
if(map)
|
||||
{
|
||||
QVBoxLayout* layoutV = new QVBoxLayout(lonLatWidget);
|
||||
ZERO_LAYOUT(layoutV);
|
||||
QLabel* latLonLabel = new QLabel(lonLatWidget);
|
||||
latLonLabel->setAlignment(Qt::AlignCenter);
|
||||
latLonLabel->setObjectName("title_gps");
|
||||
latLonLabel->setText(MKU8("\x47\x50\x53\xe5\xba\xa7\xe6\xa8\x99")); // GPS座標
|
||||
latLonLabel->setFixedHeight(18);
|
||||
layoutV->addWidget(latLonLabel);
|
||||
|
||||
QWidget* w = new QWidget(lonLatWidget);
|
||||
layoutV->addWidget(w);
|
||||
QHBoxLayout* lw = new QHBoxLayout(w);
|
||||
ZERO_LAYOUT(lw);
|
||||
|
||||
_addLine(w,lw,true);
|
||||
RMLayout::addSpacer(lw,10,0);
|
||||
_addLine(w,lw,false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QVBoxLayout* layoutV = new QVBoxLayout(lonLatWidget);
|
||||
ZERO_LAYOUT(layoutV);
|
||||
QLabel* latLonLabel = new QLabel(lonLatWidget);
|
||||
latLonLabel->setAlignment(Qt::AlignCenter);
|
||||
latLonLabel->setObjectName("title_gps");
|
||||
latLonLabel->setText(MKU8("\x47\x50\x53\xe5\xba\xa7\xe6\xa8\x99")); // GPS座標
|
||||
latLonLabel->setFixedHeight(18);
|
||||
layoutV->addWidget(latLonLabel);
|
||||
|
||||
_addLine(lonLatWidget,layoutV,true);
|
||||
if(map)
|
||||
{
|
||||
layoutV->addSpacerItem(new QSpacerItem(0,6));
|
||||
}
|
||||
_addLine(lonLatWidget,layoutV,false);
|
||||
}
|
||||
_clearLabels();
|
||||
|
||||
_showLabels(false);
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
}
|
||||
void RMGPSPosition::_addLine(QWidget* parent, QBoxLayout* layout,bool lat)
|
||||
{
|
||||
QWidget* widget = new QWidget(parent);
|
||||
|
||||
widget->setObjectName(lat ? "degree_line0" : "degree_line1");
|
||||
widget->setFixedSize(115,17);
|
||||
layout->addWidget(widget);
|
||||
QHBoxLayout* lineLayout = new QHBoxLayout(widget);
|
||||
ZERO_LAYOUT(lineLayout);
|
||||
|
||||
QLabel* l0 = new QLabel(widget);
|
||||
l0->setObjectName("degree");
|
||||
lineLayout->addWidget(l0);
|
||||
|
||||
l0->setText(lat ? " N" : " E");
|
||||
l0->setFixedSize(42,17);
|
||||
l0->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
QLabel* ld = new QLabel(widget);
|
||||
ld->setObjectName("degree");
|
||||
lineLayout->addWidget(ld);
|
||||
ld->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
ld->setFixedSize(35,17);
|
||||
|
||||
QLabel* lm = new QLabel(widget);
|
||||
lm->setObjectName("degree");
|
||||
lineLayout->addWidget(lm);
|
||||
//lm->setText("'");
|
||||
lm->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
lm->setFixedWidth(22);
|
||||
|
||||
QLabel* ls = new QLabel(widget);
|
||||
ls->setObjectName("degree");
|
||||
lineLayout->addWidget(ls);
|
||||
//ls->setText("\"");
|
||||
ls->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
ls->setFixedWidth(25);
|
||||
|
||||
if(lat)
|
||||
{
|
||||
latLabel = l0;
|
||||
latLabelD = ld;
|
||||
latLabelM = lm;
|
||||
latLabelS = ls;
|
||||
}
|
||||
else
|
||||
{
|
||||
lonLabel = l0;
|
||||
lonLabelD = ld;
|
||||
lonLabelM = lm;
|
||||
lonLabelS = ls;
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
RMGPSPosition::RMGPSPosition(QWidget *parent, bool map) : RMWidgetStyleBase(parent,"",false)
|
||||
{
|
||||
setObjectName("all_border_dark");
|
||||
setFixedSize(map ? 240 : 192,map ? 50 : 34);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(5,0));
|
||||
|
||||
gpsIcon = new QLabel(this);
|
||||
gpsIcon->setPixmap(QPixmap(":/image/gps_icon_gps_off.png"));
|
||||
layout->addWidget(gpsIcon);
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(2,0));
|
||||
|
||||
lonLatWidget = new QWidget(this);
|
||||
lonLatWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
layout->addWidget(lonLatWidget);
|
||||
layout->addSpacerItem(new QSpacerItem(2,0));
|
||||
|
||||
//ll->setObjectName("test_widget");
|
||||
|
||||
//
|
||||
QVBoxLayout* layoutV = new QVBoxLayout(lonLatWidget);
|
||||
layoutV->setSpacing(0);
|
||||
layoutV->setMargin(0);
|
||||
|
||||
_addLine(lonLatWidget,layoutV,true);
|
||||
if(map)
|
||||
{
|
||||
layoutV->addSpacerItem(new QSpacerItem(0,6));
|
||||
}
|
||||
_addLine(lonLatWidget,layoutV,false);
|
||||
_clearLabels();
|
||||
|
||||
lonLatWidget->setHidden(true);
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
}
|
||||
void RMGPSPosition::_addLine(QWidget* parent, QVBoxLayout* layout,bool lat)
|
||||
{
|
||||
QWidget* widget = new QWidget(parent);
|
||||
//widget->setObjectName("test_widget");
|
||||
layout->addWidget(widget);
|
||||
QHBoxLayout* lineLayout = new QHBoxLayout(widget);
|
||||
lineLayout->setMargin(0);
|
||||
lineLayout->setSpacing(0);
|
||||
|
||||
QLabel* l0 = new QLabel(widget);
|
||||
l0->setObjectName("degree");
|
||||
lineLayout->addWidget(l0);
|
||||
|
||||
QString jp = lat ? MKU8("\xe7\xb7\xaf\xe5\xba\xa6 \x3a \x4e") : MKU8("\xe7\xb5\x8c\xe5\xba\xa6 \x3a \x45");
|
||||
QString en = lat ? "Lat : N" : "Lon : E";
|
||||
|
||||
// 緯度(\xe7\xb7\xaf\xe5\xba\xa6),위도
|
||||
// 経度(\xe7\xb5\x8c\xe5\xba\xa6),경도
|
||||
l0->setText(RMLanguage::instance()->isJP() ? jp : en);
|
||||
l0->setFixedWidth(60);
|
||||
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_JP,RMLanguage::TITLE_TEXT,l0,jp);
|
||||
#if !(LANGUAGE_REMOVE_ENG) // WATEX
|
||||
RMLanguage::instance()->append(RMLanguage::LANGUAGE_EN,RMLanguage::TITLE_TEXT,l0,en);
|
||||
#endif
|
||||
QLabel* ld = new QLabel(widget);
|
||||
ld->setObjectName("degree");
|
||||
lineLayout->addWidget(ld);
|
||||
//ld->setText(QString::fromUtf8("\xc2\xb0"));
|
||||
ld->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
ld->setFixedWidth(45);
|
||||
|
||||
QLabel* lm = new QLabel(widget);
|
||||
lm->setObjectName("degree");
|
||||
lineLayout->addWidget(lm);
|
||||
//lm->setText("'");
|
||||
lm->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
lm->setFixedWidth(22);
|
||||
|
||||
QLabel* ls = new QLabel(widget);
|
||||
ls->setObjectName("degree");
|
||||
lineLayout->addWidget(ls);
|
||||
//ls->setText("\"");
|
||||
ls->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
ls->setFixedWidth(25);
|
||||
|
||||
if(lat)
|
||||
{
|
||||
latLabel = l0;
|
||||
latLabelD = ld;
|
||||
latLabelM = lm;
|
||||
latLabelS = ls;
|
||||
}
|
||||
else
|
||||
{
|
||||
lonLabel = l0;
|
||||
lonLabelD = ld;
|
||||
lonLabelM = lm;
|
||||
lonLabelS = ls;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (MODEL_WATEX)
|
||||
void RMGPSPosition::_showLabels(bool bShow)
|
||||
{
|
||||
latLabel->setHidden(!bShow);
|
||||
latLabelD->setHidden(!bShow);
|
||||
latLabelM->setHidden(!bShow);
|
||||
latLabelS->setHidden(!bShow);
|
||||
|
||||
lonLabel->setHidden(!bShow);
|
||||
lonLabelD->setHidden(!bShow);
|
||||
lonLabelM->setHidden(!bShow);
|
||||
lonLabelS->setHidden(!bShow);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void RMGPSPosition::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
if(_sensor != NULL)
|
||||
{
|
||||
double ratio = ((double)position) / ((double)duration);
|
||||
|
||||
double lonX = 0;
|
||||
double latY = 0;
|
||||
double speed = 0;
|
||||
_sensor->getGPSPosition(ratio,&lonX,&latY,&speed);
|
||||
#if (FORCE_VALID_LOCATION)
|
||||
if(TRUE)
|
||||
#else
|
||||
if(IS_VALID_LOCATION(lonX,latY))
|
||||
#endif
|
||||
{
|
||||
int d = (int)latY;
|
||||
latLabelD->setText(QString().sprintf("%d",d) + QString::fromUtf8("\xc2\xb0"));
|
||||
int m = (int)((latY * 60.0) - (d * 60));
|
||||
latLabelM->setText(QString().sprintf("%d'",m));
|
||||
int s = (int)((latY * 3600.0) - (d * 3600) - (m * 60));
|
||||
latLabelS->setText(QString().sprintf("%d\"",s));
|
||||
|
||||
d = (int)lonX;
|
||||
lonLabelD->setText(QString().sprintf("%d",d) + QString::fromUtf8("\xc2\xb0"));
|
||||
m = (int)((lonX * 60.0) - (d * 60));
|
||||
lonLabelM->setText(QString().sprintf("%d'",m));
|
||||
s = (int)((lonX * 3600.0) - (d * 3600) - (m * 60));
|
||||
lonLabelS->setText(QString().sprintf("%d\"",s));
|
||||
}
|
||||
else
|
||||
{
|
||||
_clearLabels();
|
||||
}
|
||||
}
|
||||
}
|
||||
void RMGPSPosition::_clearLabels()
|
||||
{
|
||||
latLabelD->setText(QString::fromUtf8("\xc2\xb0"));
|
||||
latLabelM->setText("'");
|
||||
latLabelS->setText("\"");
|
||||
|
||||
lonLabelD->setText(QString::fromUtf8("\xc2\xb0"));
|
||||
lonLabelM->setText("'");
|
||||
lonLabelS->setText("\"");
|
||||
|
||||
}
|
||||
void RMGPSPosition::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
||||
// if(event == PLAY_DID_CLEARED || event == PLAY_DID_LOADED)
|
||||
if(event == PLAY_DID_LOADED) {
|
||||
|
||||
_sensor = item->getSensorData();
|
||||
|
||||
QString pixmap = ":/image/gps_icon_gps_off.png";
|
||||
if(item->getSensorData() != NULL && item->getSensorData()->getGPSCount() > 0)
|
||||
{
|
||||
pixmap = ":/image/gps_icon_gps_on.png";
|
||||
#if (MODEL_WATEX)
|
||||
_showLabels(true);
|
||||
#else
|
||||
lonLatWidget->setHidden(false);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (MODEL_WATEX)
|
||||
_showLabels(false);
|
||||
#else
|
||||
lonLatWidget->setHidden(true);
|
||||
#endif
|
||||
}
|
||||
gpsIcon->setPixmap(QPixmap(pixmap));
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_sensor = NULL;
|
||||
}
|
||||
else if (event == PLAY_DID_USER_STOP)
|
||||
{
|
||||
_sensor = NULL;
|
||||
#if (MODEL_WATEX)
|
||||
_showLabels(false);
|
||||
#else
|
||||
lonLatWidget->setHidden(true);
|
||||
#endif
|
||||
_clearLabels();
|
||||
gpsIcon->setPixmap(QPixmap(":/image/gps_icon_gps_off.png"));
|
||||
}
|
||||
}
|
||||
void RMGPSPosition::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter painter(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // #if (MODEL_BBVIEWER)
|
||||
48
project/fm_viewer/ui/rm_gps_position.h
Normal file
48
project/fm_viewer/ui/rm_gps_position.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef RM_GPS_POSITION_H
|
||||
#define RM_GPS_POSITION_H
|
||||
#if (MODEL_BBVIEWER)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../core/rm_player_base.h"
|
||||
#include "rm_widget_style_base.h"
|
||||
|
||||
class RMSensorData;
|
||||
|
||||
class RMGPSPosition : public RMWidgetStyleBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMGPSPosition(QWidget *parent = nullptr, bool map = false);
|
||||
private:
|
||||
RMSensorData* _sensor;
|
||||
QLabel* gpsIcon;
|
||||
|
||||
QWidget* lonLatWidget;
|
||||
|
||||
QLabel* latLabel; // "Lat : N"
|
||||
QLabel* latLabelD;
|
||||
QLabel* latLabelM;
|
||||
QLabel* latLabelS;
|
||||
|
||||
QLabel* lonLabel; // "Lon : E"
|
||||
QLabel* lonLabelD;
|
||||
QLabel* lonLabelM;
|
||||
QLabel* lonLabelS;
|
||||
|
||||
void _addLine(QWidget* parent, QBoxLayout* layout,bool lat);
|
||||
void _clearLabels();
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
|
||||
#if (MODEL_WATEX)
|
||||
void _showLabels(bool bShow);
|
||||
#endif
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // RM_GPS_POSITION_H
|
||||
346
project/fm_viewer/ui/rm_graph_widget.cpp
Normal file
346
project/fm_viewer/ui/rm_graph_widget.cpp
Normal file
@@ -0,0 +1,346 @@
|
||||
#include "rm_graph_widget.h"
|
||||
|
||||
//#include "../module/qcustomplot.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include "../data/rm_sensordata.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPaintEvent>
|
||||
|
||||
#include <math.h>
|
||||
#include "../core/rm_player.h"
|
||||
#include "fm_colors.h"
|
||||
|
||||
// http://qcustomplot.com/index.php/tutorials/userinteractions
|
||||
|
||||
//const double minRange = -4.0;
|
||||
//const double maxRange = 4.0;
|
||||
//const double miniumRange = 0.5;
|
||||
//const double initialRange = 2.0; // 초기 시작
|
||||
|
||||
//const int plot_icon_width = 13;
|
||||
|
||||
|
||||
RMGraphWidget::RMGraphWidget(QWidget *parent,QList<int> scales) : QWidget(parent)
|
||||
{
|
||||
currentData = NULL;
|
||||
_scales = scales;
|
||||
_currentScale = 4;
|
||||
_cursorX = -1;
|
||||
|
||||
//setObjectName("graph_widget");
|
||||
|
||||
connect(RMPlayer::instance(),SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
labelX = NULL;
|
||||
labelY = NULL;
|
||||
labelZ = NULL;
|
||||
|
||||
#if (USE_TRIGGER)
|
||||
eTrigger = QPixmap(":/image/icon_plot_e.png");
|
||||
mTrigger = QPixmap(":/image/icon_plot_m.png");
|
||||
#endif // USE_TRIGGER
|
||||
}
|
||||
#if (MODEL_STANDARD)
|
||||
void RMGraphWidget::onZoomOut()
|
||||
{
|
||||
if (_scales.isEmpty() ||_scales.last() == _currentScale) {
|
||||
return;
|
||||
}
|
||||
int index = _scales.indexOf(_currentScale) + 1;
|
||||
_currentScale = _scales[index];
|
||||
_updatePolygon();
|
||||
|
||||
qInfo() << _currentScale << __FUNCTION__;
|
||||
// 1(first) 일 경우
|
||||
emit zoomChange(true,_currentScale != _scales.last());
|
||||
}
|
||||
void RMGraphWidget::onZoomIn()
|
||||
{
|
||||
// 스케일을 늘린다-> 실제 scale 값은 축소
|
||||
if (_scales.isEmpty() ||_scales.first() == _currentScale) {
|
||||
return;
|
||||
}
|
||||
int index = _scales.indexOf(_currentScale) - 1;
|
||||
_currentScale = _scales[index];
|
||||
_updatePolygon();
|
||||
qInfo() << _currentScale << __FUNCTION__;
|
||||
emit zoomChange(_scales.first() != _currentScale,true);
|
||||
}
|
||||
#endif
|
||||
float RMGraphWidget::_transform(float value, float height)
|
||||
{
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_NX_DRW22 || \
|
||||
RM_MODEL == RM_MODEL_TYPE_BV2000 || \
|
||||
RM_MODEL == RM_MODEL_TYPE_XLDR_88 || \
|
||||
RM_MODEL == RM_MODEL_TYPE_KEIYO1 || \
|
||||
RM_MODEL == RM_MODEL_TYPE_MBJ5010 || \
|
||||
RM_MODEL == RM_MODEL_TYPE_FC_DR232W || \
|
||||
RM_MODEL == RM_MODEL_TYPE_MH9000 || \
|
||||
RM_MODEL_EMT_KR || \
|
||||
RM_MODEL == RM_MODEL_TYPE_TBD360)
|
||||
// 0~
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88 )
|
||||
const float scale = (float)4.0 / _currentScale;
|
||||
const float oldRange = 8.0;// -1.0 ~ 1.0
|
||||
const float oldMin = -4.0;
|
||||
#elif (RM_MODEL_EMT_KR)
|
||||
const float scale = (float)8.0 / _currentScale;
|
||||
const float oldRange = 4.0;// -1.0 ~ 1.0
|
||||
const float oldMin = -2.0;
|
||||
#else
|
||||
const float scale = (float)4.0 / _currentScale;
|
||||
const float oldRange = 4.0;// -1.0 ~ 1.0
|
||||
const float oldMin = -2.0;
|
||||
#endif
|
||||
|
||||
const float newMax = height * scale;
|
||||
const float newMin = height - (scale * height);
|
||||
const float newRange = newMax - newMin;
|
||||
|
||||
const float nv = ((((value - (oldMin)) * newRange) / oldRange) + newMin);
|
||||
// NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin
|
||||
#elif (RM_MODEL == RM_MODEL_TYPE_ADT_CAPS)
|
||||
const float scale = (float)4.0 / _currentScale * 2.0;
|
||||
const float oldRange = 1.0;// -1.0 ~ 1.0
|
||||
const float oldMin = 0.0;
|
||||
|
||||
const float newMax = height * scale;
|
||||
const float newMin = 10;//height - (scale * height);
|
||||
const float newRange = newMax - newMin;
|
||||
|
||||
const float nv = ((((value - (oldMin)) * newRange) / oldRange) + newMin);
|
||||
#else
|
||||
//#pragma warning (GRAPH SCALE NOT FIEXED)
|
||||
const float nv = 0;
|
||||
#endif
|
||||
return height - nv;
|
||||
}
|
||||
|
||||
void RMGraphWidget::_updatePolygon()
|
||||
{
|
||||
if(currentData == NULL) {
|
||||
update();
|
||||
return;
|
||||
}
|
||||
_polygonX.clear();
|
||||
_polygonY.clear();
|
||||
_polygonZ.clear();
|
||||
|
||||
double w = size().width();
|
||||
double h = size().height();
|
||||
|
||||
//qInfo() << "Height:" << h;
|
||||
// const double hh = h / 2.0;
|
||||
|
||||
uint32_t count = currentData->getSensorCount(); // X축 레인지 설정
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
const NMEA_INFO* sensorValues = currentData->getSensor();
|
||||
const float xOffset = w / (double)count;
|
||||
for (uint32_t i=0; i<count; ++i)
|
||||
{
|
||||
float xy = _transform(sensorValues[i].x,h);
|
||||
float yy = _transform(sensorValues[i].y,h);
|
||||
float zy = _transform(sensorValues[i].z,h);
|
||||
|
||||
_polygonX.push_back(QPointF(xOffset * (double)i,xy));
|
||||
_polygonY.push_back(QPointF(xOffset * (double)i,yy));
|
||||
_polygonZ.push_back(QPointF(xOffset * (double)i,zy));
|
||||
}
|
||||
#else // RM_MODEL_EMT_KR
|
||||
const float* sensorValues = currentData->getSensor();
|
||||
const float xOffset = w / (double)count;
|
||||
for (uint32_t i=0; i<count; ++i)
|
||||
{
|
||||
// 0 = h / 2.0;
|
||||
|
||||
float xy = _transform(sensorValues[(i * NUM_SENSOR_DATA) + 0],h);
|
||||
float yy = _transform(sensorValues[(i * NUM_SENSOR_DATA) + 1],h);
|
||||
float zy = _transform(sensorValues[(i * NUM_SENSOR_DATA) + 2],h);
|
||||
|
||||
_polygonX.push_back(QPointF(xOffset * (double)i,xy));
|
||||
_polygonY.push_back(QPointF(xOffset * (double)i,yy));
|
||||
_polygonZ.push_back(QPointF(xOffset * (double)i,zy));
|
||||
}
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
update();
|
||||
}
|
||||
void RMGraphWidget::redraw()
|
||||
{
|
||||
_updatePolygon();
|
||||
}
|
||||
void RMGraphWidget::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
if(event == PLAY_DID_LOADED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
if(item != NULL) {
|
||||
currentData = item->getSensorData();
|
||||
}
|
||||
_updatePolygon();
|
||||
_itemDurationMSec = (double)item->durationInMSecs();
|
||||
}
|
||||
else if(event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
currentData= NULL;
|
||||
_polygonX.clear();
|
||||
_polygonY.clear();
|
||||
_polygonZ.clear();
|
||||
update();
|
||||
if(labelX != NULL) {
|
||||
labelX->setText(" 0.00");
|
||||
labelY->setText(" 0.00");
|
||||
labelZ->setText(" 0.00");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void RMGraphWidget::setLabels(QLabel*x,QLabel*y,QLabel*z)
|
||||
{
|
||||
labelX = x;
|
||||
labelY = y;
|
||||
labelZ = z;
|
||||
}
|
||||
|
||||
void RMGraphWidget::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
if(currentData == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
double pos = (double)MIN(position,duration);
|
||||
double du = ((double)(duration));
|
||||
|
||||
// 센서 값과 유사하게 표시하기위해 보정
|
||||
//const double tolerance = 50.0;
|
||||
|
||||
// 실제 시간과 seek duration 보정
|
||||
//double pos2 = (pos + tolerance) * (_itemDurationMSec / du);
|
||||
double pos2 = pos;
|
||||
|
||||
int cursor = (int)(pos2 / du * ((double)size().width()));
|
||||
if(_cursorX != cursor) {
|
||||
_cursorX = cursor;
|
||||
update();
|
||||
}
|
||||
|
||||
if(labelX != NULL) {
|
||||
unsigned int offset = (unsigned int)(((double)pos2) / ((double)du) * ((double)currentData->getSensorCount()) );
|
||||
|
||||
if(offset < currentData->getSensorCount())
|
||||
{
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
const NMEA_INFO* sensorValues = currentData->getSensor();
|
||||
const float x = sensorValues[offset].x;
|
||||
const float y = sensorValues[offset].y;
|
||||
const float z = sensorValues[offset].z;
|
||||
#else // RM_MODEL_EMT_KR
|
||||
const float* sensorValues = currentData->getSensor();
|
||||
const float x = sensorValues[(offset * NUM_SENSOR_DATA) + 0];
|
||||
const float y = sensorValues[(offset * NUM_SENSOR_DATA) + 1];
|
||||
const float z = sensorValues[(offset * NUM_SENSOR_DATA) + 2];
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
if(labelX != NULL)
|
||||
{
|
||||
labelX->setText(QString().sprintf("% .2f",x));
|
||||
}
|
||||
if(labelY != NULL)
|
||||
{
|
||||
labelY->setText(QString().sprintf("% .2f",y));
|
||||
}
|
||||
if(labelZ != NULL)
|
||||
{
|
||||
labelZ->setText(QString().sprintf("% .2f",z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// subclassing 할 경우 무조건 구현해야함.
|
||||
void RMGraphWidget::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QPainter painter(this);
|
||||
|
||||
//painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
// Round Box
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(rect(), 3, 3);
|
||||
painter.fillPath(path, QColor(FM_GRAPH_BACK_COLOR)); // QColor("#595959")
|
||||
|
||||
int xmargin = 3;
|
||||
int ymargin = 8;
|
||||
QRect r = rect();
|
||||
r.adjust(xmargin,ymargin,-xmargin,-ymargin);
|
||||
|
||||
painter.setPen(QPen(QColor(FM_GRAPH_LINE_COLOR),1, Qt::SolidLine));
|
||||
// outer line
|
||||
painter.drawRect(r);
|
||||
|
||||
// h-center line
|
||||
//painter.drawLine(r.left(),r.center().y(),r.right(),r.center().y());
|
||||
|
||||
//int yCount = _scales.length();
|
||||
// 1,2,4
|
||||
int h = (r.height()/2)/_currentScale;
|
||||
int count = r.height() / h;
|
||||
for(int i=1;i<count;i++) {
|
||||
int y = r.top() + (h * i);
|
||||
painter.drawLine(r.left(),y,r.right(),y);
|
||||
}
|
||||
|
||||
// v-center line
|
||||
int x = r.center().x();
|
||||
painter.drawLine(x,r.top(),x,r.bottom());
|
||||
x = r.left() + r.width()/4;
|
||||
painter.drawLine(x,r.top(),x,r.bottom());
|
||||
x = r.left() + r.width()/4*3;
|
||||
painter.drawLine(x,r.top(),x,r.bottom());
|
||||
|
||||
|
||||
if (_polygonX.count() > 0)
|
||||
{
|
||||
// "#c6f606"
|
||||
QPen xPen(FM_QCOLOR(FM_SENSOR_COLOR_X), 1, Qt::SolidLine);
|
||||
painter.setPen(xPen);
|
||||
painter.drawPolyline(_polygonX);
|
||||
|
||||
QPen yPen(FM_QCOLOR(FM_SENSOR_COLOR_Y), 1, Qt::SolidLine);
|
||||
painter.setPen(yPen);
|
||||
painter.drawPolyline(_polygonY);
|
||||
|
||||
QPen zPen(FM_QCOLOR(FM_SENSOR_COLOR_Z), 1, Qt::SolidLine);
|
||||
painter.setPen(zPen);
|
||||
painter.drawPolyline(_polygonZ);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(_cursorX >= 0){
|
||||
QPen cursorPen(QColor(0xFFFFFF), 1, Qt::SolidLine); // QColor("#FFFFFF")
|
||||
painter.setPen(cursorPen);
|
||||
painter.drawLine(_cursorX,0,_cursorX,size().height());
|
||||
}
|
||||
#if (USE_TRIGGER)
|
||||
if(currentData!= NULL) {
|
||||
if(currentData->triggerE >= 0.0f) {
|
||||
QSize ss = rect().size();
|
||||
int x = (int)(((float)ss.width()) * currentData->triggerE) - (eTrigger.size().width() / 2);
|
||||
int y = ss.height() - eTrigger.size().height();
|
||||
painter.drawPixmap(x, y, eTrigger);
|
||||
}
|
||||
if(currentData->triggerM >= 0.0f) {
|
||||
QSize ss = rect().size();
|
||||
int x = (int)(((float)ss.width()) * currentData->triggerM) - (mTrigger.size().width() / 2);
|
||||
int y = ss.height() - eTrigger.size().height();
|
||||
painter.drawPixmap(x, y, mTrigger);
|
||||
}
|
||||
}
|
||||
#endif // #if (USE_TRIGGER)
|
||||
painter.end();
|
||||
|
||||
}
|
||||
|
||||
76
project/fm_viewer/ui/rm_graph_widget.h
Normal file
76
project/fm_viewer/ui/rm_graph_widget.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef RM_GRAPH_WIDGET_H
|
||||
#define RM_GRAPH_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include "../fm_event_types.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
|
||||
class QCustomPlot;
|
||||
class QCPItemPixmap;
|
||||
class QCPItemLine;
|
||||
class QCheckBox;
|
||||
class QDateTime;
|
||||
class RMSensorData;
|
||||
class RMSpeedLabel;
|
||||
|
||||
#include "../core/rm_player_base.h"
|
||||
class RMVideoItem;
|
||||
class RMGraphWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
|
||||
QList<int> _scales;
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
|
||||
QPolygonF _polygonX;
|
||||
QPolygonF _polygonY;
|
||||
QPolygonF _polygonZ;
|
||||
|
||||
int _currentScale;
|
||||
int _cursorX;
|
||||
|
||||
#if (USE_TRIGGER)
|
||||
QPixmap eTrigger;
|
||||
QPixmap mTrigger;
|
||||
#endif // USE_TRIGGER
|
||||
|
||||
void _updatePolygon();
|
||||
float _transform(float value, float height);
|
||||
|
||||
RMSensorData* currentData;
|
||||
|
||||
QLabel* labelX;
|
||||
QLabel* labelY;
|
||||
QLabel* labelZ;
|
||||
|
||||
const float* getSensorData(double ratio);
|
||||
double _itemDurationMSec; // AVI 헤더 시간
|
||||
public:
|
||||
explicit RMGraphWidget(QWidget *parent = 0,QList<int> scales = QList<int>());
|
||||
void setLabels(QLabel*x,QLabel*y,QLabel*z);
|
||||
#if (MODEL_BBVIEWER)
|
||||
QLabel* xLabel;
|
||||
QLabel* yLabel;
|
||||
QLabel* zLabel;
|
||||
#endif
|
||||
|
||||
void redraw();
|
||||
|
||||
signals:
|
||||
#if (MODEL_STANDARD)
|
||||
void zoomChange(bool zi,bool zo);
|
||||
#endif
|
||||
public slots:
|
||||
#if (MODEL_STANDARD)
|
||||
void onZoomIn();
|
||||
void onZoomOut();
|
||||
#endif
|
||||
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
};
|
||||
|
||||
#endif // RM_GRAPH_WIDGET_H
|
||||
32
project/fm_viewer/ui/rm_layout.cpp
Normal file
32
project/fm_viewer/ui/rm_layout.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "rm_layout.h"
|
||||
|
||||
RMLayout::RMLayout(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
QSpacerItem* RMLayout::addSpacer(QBoxLayout* layout,int width,int height)
|
||||
{
|
||||
QSpacerItem* seperator = new QSpacerItem(width,height,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
layout->addSpacerItem(seperator);
|
||||
return seperator;
|
||||
}
|
||||
|
||||
QLabel* RMLayout::addThemeLabel(QWidget *parent,QLayout* layout, QString title,const char* objectName)
|
||||
{
|
||||
QLabel* lb = new QLabel(parent);
|
||||
lb->setText(title);
|
||||
layout->addWidget(lb);
|
||||
lb->setObjectName(objectName);
|
||||
lb->setStyleSheet("color: #BABABA;font-family: Arial;font-size: 13px;");
|
||||
return lb;
|
||||
}
|
||||
|
||||
QLabel* RMLayout::addLabel(QWidget *parent, QLayout* layout,QString title,const char* objectName)
|
||||
{
|
||||
QLabel* lb = new QLabel(parent);
|
||||
lb->setText(title);
|
||||
layout->addWidget(lb);
|
||||
lb->setObjectName(objectName);
|
||||
return lb;
|
||||
}
|
||||
|
||||
27
project/fm_viewer/ui/rm_layout.h
Normal file
27
project/fm_viewer/ui/rm_layout.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef RM_LAYOUT_UTILITY_H
|
||||
#define RM_LAYOUT_UTILITY_H
|
||||
|
||||
//#include "rm_include.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
class RMLayout : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMLayout(QObject *parent = 0);
|
||||
|
||||
static QLabel* addLabel(QWidget *parent,QLayout* layout, QString title,const char* objectName);
|
||||
static QSpacerItem* addSpacer(QBoxLayout* layout,int width,int height);
|
||||
|
||||
//! \brief 기본타입 레이블 추가
|
||||
//! \param parent
|
||||
//! \param layout
|
||||
//! \param title
|
||||
//! \param objectName
|
||||
//! \return
|
||||
static QLabel* addThemeLabel(QWidget *parent,QLayout* layout, QString title,const char* objectName);
|
||||
};
|
||||
|
||||
#endif // RM_LAYOUT_UTILITY_H
|
||||
76
project/fm_viewer/ui/rm_map_thread.h
Normal file
76
project/fm_viewer/ui/rm_map_thread.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef RM_MAP_THREAD_H
|
||||
#define RM_MAP_THREAD_H
|
||||
#include "../rm_include.h"
|
||||
|
||||
#if (TEST_MAP_MOVE_THREAD)
|
||||
#include <QThreadPool>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
class RMMapMove : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
double _lon;
|
||||
double _lat;
|
||||
double _speed;
|
||||
bool _drawLine;
|
||||
RMMapMove(double lon, double lat, double speed, bool drawLine) : QObject()
|
||||
{
|
||||
_lon = lon;
|
||||
_lat = lat;
|
||||
_speed = speed;
|
||||
_drawLine = drawLine;
|
||||
}
|
||||
};
|
||||
|
||||
class RMMapUpdater : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QQueue<RMMapMove*> queue;
|
||||
void runMove(RMMapMove *move)
|
||||
{
|
||||
_mutex.lock();
|
||||
queue.enqueue(move);
|
||||
//printf("queue count:%d",queue.count());
|
||||
//qInfo() << "queue.count:" << queue.count();
|
||||
_mutex.unlock();
|
||||
startQueue();
|
||||
}
|
||||
void finish()
|
||||
{
|
||||
wait();
|
||||
}
|
||||
protected:
|
||||
|
||||
virtual void startQueue()
|
||||
{
|
||||
if (!isRunning())
|
||||
start(LowPriority); // calls run() in a new thread
|
||||
}
|
||||
virtual void run()
|
||||
{
|
||||
_mutex.lock();
|
||||
while (!queue.empty())
|
||||
{
|
||||
_mutex.unlock();
|
||||
RMMapMove* move = queue.dequeue();
|
||||
double lon = move->_lon;
|
||||
double lat = move->_lat;
|
||||
double speed = move->_speed;
|
||||
bool drawLine = move->_drawLine;
|
||||
delete move;
|
||||
_mutex.lock();
|
||||
|
||||
emit moveTo(lon,lat,speed,drawLine);
|
||||
}
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
QMutex _mutex;
|
||||
signals:
|
||||
void moveTo(double lon, double lat, double speed, bool drawLine);
|
||||
};
|
||||
#endif // TEST_MAP_MOVE_THREAD
|
||||
#endif // RM_MAP_THREAD_H
|
||||
132
project/fm_viewer/ui/rm_play_slider.cpp
Normal file
132
project/fm_viewer/ui/rm_play_slider.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
#include "rm_play_slider.h"
|
||||
#include "rm_slider.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "../fm_app_colors.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../core/rm_player.h"
|
||||
#include "../data/rm_video_item_2ch.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include "fm_colors.h"
|
||||
|
||||
RMPlaySlider::RMPlaySlider(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
|
||||
FMWidgetBackground(this,"slider_frame",0x3a3a3a);
|
||||
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
ZERO_LAYOUT(layout);
|
||||
|
||||
LAYOUT_SPACE(layout,10,0);
|
||||
|
||||
currentTimeLabel = new QLabel(this);
|
||||
currentTimeLabel->setAlignment(Qt::AlignCenter);
|
||||
FMLabel(currentTimeLabel,"current_time","Arial",FM_SELECTED_TEXT_COLOR,14,false);
|
||||
currentTimeLabel->setText(ZERO_TIME_STRING);
|
||||
layout->addWidget(currentTimeLabel);
|
||||
currentTimeLabel->setFixedWidth(60);
|
||||
|
||||
//LAYOUT_SPACE(layout,10,0);
|
||||
|
||||
slider = new RMSlider(this);
|
||||
slider->setValue(0);
|
||||
//slider->setObjectName("play");
|
||||
FMSlider(slider,"play_slider",FM_SILDER_COLOR,0x666666);
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_EMT_KR)
|
||||
layout->addWidget(slider);
|
||||
#endif
|
||||
|
||||
durationLabel = new QLabel(this);
|
||||
durationLabel->setAlignment(Qt::AlignCenter);
|
||||
FMLabel(durationLabel,"duration_time","Arial",FM_COLOR_SLIDER_TEXT,14,false);
|
||||
durationLabel->setText(ZERO_TIME_STRING);
|
||||
durationLabel->setFixedWidth(60);
|
||||
layout->addWidget(durationLabel);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_EMT_KR)
|
||||
layout->addWidget(slider);
|
||||
#endif
|
||||
|
||||
//LAYOUT_SPACE(layout,10,0);
|
||||
|
||||
LAYOUT_SPACE(layout,10,0);
|
||||
|
||||
RMPlayer* player = RMPlayer::instance();
|
||||
|
||||
player->setSlider(slider);
|
||||
|
||||
connect(player,SIGNAL(positionChanged(qint64,qint64)),SLOT(onPositionChanged(qint64,qint64)));
|
||||
connect(player,SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
||||
}
|
||||
void RMPlaySlider::setEnabled(bool bEnabled)
|
||||
{
|
||||
//qInfo() << __FUNCTION__ << __LINE__;
|
||||
// QT 5.12 문제로 보임 disabled 된 경우 QLabel Text 가 번지는 현상 발생
|
||||
slider->setEnabled(bEnabled);
|
||||
}
|
||||
/*
|
||||
void RMPlaySlider::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
*/
|
||||
void RMPlaySlider::onPositionChanged(qint64 position,qint64 duration)
|
||||
{
|
||||
// qInfo() << "onPositionChanged:" << position << " duration:" << duration;
|
||||
// 마지막 초를 표시하기 위해 사용
|
||||
//qint64 posCeil = ((qint64)(ceil(((double)duration) / 1000.0) * 1000.0));
|
||||
|
||||
// 60260 video duration: 59281
|
||||
qint64 pos = MIN(position,duration);
|
||||
|
||||
qint64 pos2 = (qint64)(((double)pos) * _itemDurationMSec / ((double)(duration)));
|
||||
|
||||
// 캡쳐 등에서 시간 동기화를 위해 사용
|
||||
RMPlayer::instance()->titleSeconds = pos2;
|
||||
//qInfo() << __FUNCTION__ << " video duration:" << _itemDurationMSec << duration << "POS:" << pos << " POS2:" << pos2;
|
||||
|
||||
currentTimeLabel->setText(RMVideoItem::durationString(pos2,true));
|
||||
}
|
||||
void RMPlaySlider::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
{
|
||||
if(event == PLAY_DID_LOADED)
|
||||
{
|
||||
if(item == NULL) {
|
||||
return;
|
||||
}
|
||||
//Q_ASSERT(item != NULL);
|
||||
|
||||
// 로딩이 완료되지 않은 상태에서 slider click 하면 thread lock 이 발생함..
|
||||
// 50 으로 처리할 경우 다시 발생함.
|
||||
QTimer::singleShot(200,this,SLOT(onEnableSliderDelay()));
|
||||
|
||||
//playSlider->setEnabled(true);
|
||||
|
||||
|
||||
//playSlider->slider->setEnabled(true);
|
||||
//qInfo() << __FUNCTION__ << playSlider->isEnabled();
|
||||
currentTimeLabel->setText(ZERO_TIME_STRING);
|
||||
durationLabel->setText(item->titleDuration());
|
||||
|
||||
_itemDurationMSec = (double)item->durationInMSecs();
|
||||
|
||||
}
|
||||
else if (event == PLAY_DID_CLEARED)
|
||||
{
|
||||
setEnabled(false);
|
||||
currentTimeLabel->setText(ZERO_TIME_STRING);
|
||||
durationLabel->setText(ZERO_TIME_STRING);
|
||||
slider->setValue(0);
|
||||
}
|
||||
}
|
||||
void RMPlaySlider::onEnableSliderDelay()
|
||||
{
|
||||
setEnabled(true);
|
||||
}
|
||||
33
project/fm_viewer/ui/rm_play_slider.h
Normal file
33
project/fm_viewer/ui/rm_play_slider.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef RM_PLAY_SLIDER_H
|
||||
#define RM_PLAY_SLIDER_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "../fm_event_types.h"
|
||||
|
||||
class RMSlider;
|
||||
class RMPlaySlider : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class RMPlayer;
|
||||
friend class RMFrameSlider;
|
||||
public:
|
||||
explicit RMPlaySlider(QWidget *parent = nullptr);
|
||||
RMSlider* slider;
|
||||
QHBoxLayout* layout;
|
||||
|
||||
QLabel* currentTimeLabel;
|
||||
QLabel* durationLabel;
|
||||
private:
|
||||
double _itemDurationMSec; // AVI 헤더 시간
|
||||
//void paintEvent(QPaintEvent *pe);
|
||||
public slots:
|
||||
void setEnabled(bool bEnabled);
|
||||
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
|
||||
void onPositionChanged(qint64 position,qint64 duration);
|
||||
void onEnableSliderDelay();
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // RM_PLAY_SLIDER_H
|
||||
255
project/fm_viewer/ui/rm_popup.cpp
Normal file
255
project/fm_viewer/ui/rm_popup.cpp
Normal file
@@ -0,0 +1,255 @@
|
||||
#include "rm_popup.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "title_widget.h"
|
||||
#include "rm_widget_drag.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "fm_layer.h"
|
||||
#include <QComboBox>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include "fm_button.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "fm_colors.h"
|
||||
|
||||
#if (MODEL_WATEX)
|
||||
#define POPUP_BG_STYLE "popup_bg_widget"
|
||||
#else
|
||||
#define POPUP_BG_STYLE "bg_widget"
|
||||
#endif
|
||||
|
||||
RMPopup::RMPopup(QWidget *parent, QString title,QString icon, Qt::WindowFlags f) : QDialog(parent,f)
|
||||
{
|
||||
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
|
||||
_mainLayout = new QVBoxLayout(this);
|
||||
_mainLayout->setSpacing(0);
|
||||
#if (MODEL_WATEX)
|
||||
_mainLayout->setMargin(1);
|
||||
#elif (MODEL_BBVIEWER)
|
||||
_mainLayout->setMargin(2);
|
||||
#else
|
||||
_mainLayout->setMargin(0);
|
||||
#endif
|
||||
|
||||
_title = new TitleWidget(this,title,icon,true);
|
||||
_mainLayout->addWidget(_title);
|
||||
|
||||
_contentWidget = new QWidget(this);
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
const int CONTENT_BG = FM_THEME_COLOR_M3;
|
||||
const int BUTTON_BG = FM_THEME_COLOR_M1;
|
||||
#else // RM_MODEL_EMT_KR
|
||||
const int CONTENT_BG = 0x3a3a3a;
|
||||
const int BUTTON_BG = 0x595959;
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
|
||||
FMWidgetBackground(_contentWidget,"popup_bg",CONTENT_BG);
|
||||
_contentWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||
//_contentWidget->setObjectName(POPUP_BG_STYLE);
|
||||
_mainLayout->addWidget(_contentWidget);
|
||||
|
||||
_buttonWidget = new QWidget(this);
|
||||
_buttonWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
//_buttonWidget->setObjectName(POPUP_BG_STYLE);
|
||||
FMWidgetBackground(_buttonWidget,"popup_bg",BUTTON_BG);
|
||||
|
||||
|
||||
#if (MODEL_BBVIEWER)
|
||||
_buttonWidget->setFixedHeight(34);
|
||||
#else
|
||||
_buttonWidget->setFixedHeight(43); // 65??
|
||||
#endif
|
||||
_mainLayout->addWidget(_buttonWidget);
|
||||
|
||||
_buttonLayout = new QHBoxLayout(_buttonWidget);
|
||||
ZERO_LAYOUT(_buttonLayout);
|
||||
|
||||
if(_title->closeButton != NULL) {
|
||||
connect(_title->closeButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
}
|
||||
|
||||
_drag = new RMWidgetDrag(this,POPUP_TITLE_BAR_HEIGHT);
|
||||
|
||||
}
|
||||
RMPopup::~RMPopup()
|
||||
{
|
||||
//qInfo() << __FUNCTION__;
|
||||
}
|
||||
|
||||
void RMPopup::hideCloseButton()
|
||||
{
|
||||
if(_title != NULL && _title->closeButton != NULL)
|
||||
{
|
||||
_title->closeButton->setHidden(true);
|
||||
}
|
||||
}
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
int RMPopup::languageIndex = -1;
|
||||
|
||||
void RMPopup::createLanguageLayout()
|
||||
{
|
||||
this->setFixedSize(320,160);
|
||||
|
||||
//RMPopup::RMPopup(parent,title);
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
_buttonLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
bool bJP = RMLanguage::isJP();
|
||||
#endif // #if !(LIVE_LANGUAGE2)
|
||||
|
||||
// 確認
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(100,24));
|
||||
_okButton->setText(FMS::txt("ok"));
|
||||
#else
|
||||
#if (FORCE_FM_STRING)
|
||||
QString okString = FMS::txt("ok");
|
||||
#else // FORCE_FM_STRING
|
||||
QString okString = bJP ? MKU8("\xe7\xa2\xba\xe8\xaa\x8d") : "OK";
|
||||
#endif // FORCE_FM_STRING
|
||||
_okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",okString,QSize(100,24));
|
||||
_okButton->setText(okString);
|
||||
#endif
|
||||
connect(_okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,10,0);
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QString cancelString = FMS::txt("cancel");
|
||||
#else
|
||||
// キャンセル
|
||||
QString cancelString = bJP ? MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab") : "Cancel";
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_cancelButton = RMButton::create2(_buttonWidget,
|
||||
_buttonLayout,
|
||||
"button",
|
||||
"cancel",
|
||||
QSize(100,24));
|
||||
_cancelButton->setText(FMS::txt("cancel"));
|
||||
#else // LIVE_LANGUAGE2
|
||||
_cancelButton = RMButton::create(_buttonWidget,
|
||||
_buttonLayout,
|
||||
"button",
|
||||
cancelString,
|
||||
QSize(100,24));
|
||||
_cancelButton->setText(cancelString);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
connect(_cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,20,0);
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
bool isJP = RMLanguage::isJP();
|
||||
#endif
|
||||
|
||||
if(RMLanguage::isAuto)
|
||||
{
|
||||
RMPopup::languageIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
RMPopup::languageIndex = bJP ? 1 : 2;
|
||||
#else
|
||||
RMLanguage* lng = RMLanguage::instance();
|
||||
RMPopup::languageIndex = lng->languageIndex(); // 0:AUTO, 1:한국어 2:일본어, 3:영어
|
||||
#endif
|
||||
}
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,2,10,2);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
//contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||
contentLayout->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
|
||||
|
||||
// 言語
|
||||
QWidget* comboWidget = new QWidget(bg);
|
||||
contentLayout->addWidget(comboWidget);
|
||||
|
||||
QHBoxLayout* comboLayout = new QHBoxLayout(comboWidget);
|
||||
comboLayout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
comboLayout->setContentsMargins(0,2,8,2);
|
||||
comboLayout->setSpacing(3);
|
||||
|
||||
// 言語
|
||||
#if (FORCE_FM_STRING)
|
||||
QString title = FMS::txt("language");
|
||||
#else
|
||||
QString title = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e") : "Language";
|
||||
#endif
|
||||
title += ":";
|
||||
RMLayout::addLabel(comboWidget,
|
||||
comboLayout,
|
||||
title,
|
||||
"text");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,5);
|
||||
|
||||
QComboBox* comboBox = new QComboBox(this);
|
||||
comboBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
||||
comboBox->setFixedWidth(200);
|
||||
comboBox->setObjectName("settings");
|
||||
comboBox->setMaxVisibleItems(100);
|
||||
|
||||
// 日本語, 自動
|
||||
#if (FORCE_FM_STRING)
|
||||
QString autoString = FMS::txt("auto_select");
|
||||
|
||||
#else //
|
||||
QString autoString = isJP ? MKU8("\xe8\x87\xaa\xe5\x8b\x95") : "Auto";
|
||||
#endif // #if (FORCE_FM_STRING)
|
||||
|
||||
#if (LANGUAGE_REMOVE_ENG)
|
||||
QStringList items = QStringList() << autoString << MKU8("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e");
|
||||
#else // LANGUAGE_REMOVE_ENG
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
QStringList items = QStringList() << autoString << MKU8("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e") << "English";
|
||||
#else // LIVE_LANGUAGE2
|
||||
QStringList items = QStringList() << autoString << FM_WSTR(L"한국어") << FM_WSTR(L"日本語") << "English";
|
||||
#endif // LIVE_LANGUAGE2
|
||||
#endif // LANGUAGE_REMOVE_ENG
|
||||
|
||||
comboBox->addItems(items);
|
||||
|
||||
//comboBox->setCurrentIndex(realIndex(*value));
|
||||
connect(comboBox,SIGNAL(currentIndexChanged(int)),SLOT(onLanguageSelected(int)));
|
||||
comboLayout->addWidget(comboBox);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
comboBox->setCurrentIndex(RMPopup::languageIndex);
|
||||
#else
|
||||
int current = 0; // AUTO
|
||||
if(RMLanguage::isAuto == false)
|
||||
{
|
||||
current = RMLanguage::isJP() ? 1 : 2;
|
||||
}
|
||||
comboBox->setCurrentIndex(current);
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL != RM_MODEL_TYPE_MH9000)
|
||||
// 言語を選択してください
|
||||
#if (FORCE_FM_STRING)
|
||||
QString message = FMS::txt("select_language");
|
||||
#else
|
||||
QString message = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84") : "Select a language";
|
||||
#endif
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
message,
|
||||
"text");
|
||||
#endif //
|
||||
}
|
||||
void RMPopup::onLanguageSelected(int index)
|
||||
{
|
||||
RMPopup::languageIndex = index;
|
||||
}
|
||||
#endif
|
||||
44
project/fm_viewer/ui/rm_popup.h
Normal file
44
project/fm_viewer/ui/rm_popup.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef RM_POPUP_H
|
||||
#define RM_POPUP_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../rm_include.h"
|
||||
|
||||
class TitleWidget;
|
||||
class RMWidgetDrag;
|
||||
class RMButton;
|
||||
class RMPopup : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
TitleWidget* _title;
|
||||
QVBoxLayout* _mainLayout;
|
||||
RMWidgetDrag* _drag;
|
||||
QWidget* _contentWidget; // message, content area
|
||||
|
||||
QWidget* _buttonWidget; // button area
|
||||
QHBoxLayout* _buttonLayout; // button layout
|
||||
|
||||
public:
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
|
||||
RMButton* _cancelButton;
|
||||
RMButton* _okButton;
|
||||
|
||||
static int languageIndex;
|
||||
void createLanguageLayout();
|
||||
#endif
|
||||
|
||||
public:
|
||||
RMPopup(QWidget *parent = 0, QString title = "",QString icon = "", Qt::WindowFlags f = 0);
|
||||
~RMPopup();
|
||||
void hideCloseButton();
|
||||
|
||||
public slots:
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
void onLanguageSelected(int index);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // RM_POPUP_H
|
||||
357
project/fm_viewer/ui/rm_popup_capture.cpp
Normal file
357
project/fm_viewer/ui/rm_popup_capture.cpp
Normal file
@@ -0,0 +1,357 @@
|
||||
#include "rm_popup_capture.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "rm_button.h"
|
||||
#include "title_widget.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QMainWindow>
|
||||
#include "../rm_settings.h"
|
||||
#include "fm_button.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
#include "../core/rm_player.h"
|
||||
#endif
|
||||
|
||||
#include "rm_dialog_overwrite_sys.h"
|
||||
|
||||
// キャプチャー
|
||||
#if (FORCE_FM_STRING)
|
||||
RMPopupCapture::RMPopupCapture(QWidget *parent,QList<QString>* files) : RMPopup(parent,FMS::txt("capture"),"")
|
||||
#else
|
||||
RMPopupCapture::RMPopupCapture(QWidget *parent,QList<QString>* files) : RMPopup(parent,MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\x97\xe3\x83\x81\xe3\x83\xa3\xe3\x83\xbc"),"")
|
||||
#endif
|
||||
{
|
||||
_files = files;
|
||||
|
||||
this->setFixedSize(482,277);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,10);
|
||||
#if (FORCE_FM_STRING)
|
||||
QString title = FMS::txt("capture_desc");
|
||||
#else
|
||||
|
||||
QString title = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\x97\xe3\x83\x81\xe3\x83\xa3\xe3\x83\xbc\xe3\x82\x92\x4a\x50\x45\x47\xe3\x81\xa7\xe4\xbf\x9d\xe5\xad\x98\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
bool isJP = RMLanguage::isJP();
|
||||
if(isJP == false)
|
||||
{
|
||||
_title->titleLabel->setText("Save Capture");
|
||||
title = "Save capture file in JPEG";
|
||||
}
|
||||
#endif
|
||||
#endif //FORCE_FM_STRING
|
||||
|
||||
// キャプチャーをJPEGで保存します
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
title,
|
||||
"text_header_label");
|
||||
RMLayout::addSpacer(contentLayout,0,30);
|
||||
|
||||
QWidget* fileWidget = new QWidget(bg);
|
||||
contentLayout->addWidget(fileWidget);
|
||||
|
||||
QHBoxLayout* fileLayout = new QHBoxLayout(fileWidget);
|
||||
fileLayout->setMargin(0);
|
||||
fileLayout->setSpacing(10);
|
||||
|
||||
// ファイル名
|
||||
#if (FORCE_FM_STRING)
|
||||
title = QString(FMS::txt("file_name")+ " : ");
|
||||
#else
|
||||
title = QString(MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe5\x90\x8d") + " : ");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(isJP == false)
|
||||
{
|
||||
title = "File Name: ";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
RMLayout::addLabel(fileWidget,
|
||||
fileLayout,
|
||||
title,
|
||||
"text_header_label");
|
||||
|
||||
QFileInfo info = QFileInfo(files->at(0));
|
||||
fileEdit = new QLineEdit(fileWidget);
|
||||
fileEdit->setObjectName("file");
|
||||
fileEdit->setReadOnly(false);
|
||||
|
||||
QString baseName = info.baseName();
|
||||
QStringList bls = baseName.split("_");
|
||||
|
||||
fileEdit->setText(bls[0] + "_" + bls[1]);
|
||||
fileLayout->addWidget(fileEdit);
|
||||
RMLayout::addSpacer(fileLayout,70,0);
|
||||
|
||||
QWidget* folderWidget = new QWidget(bg);
|
||||
contentLayout->addWidget(folderWidget);
|
||||
|
||||
QHBoxLayout* folderLayout = new QHBoxLayout(folderWidget);
|
||||
folderLayout->setMargin(0);
|
||||
folderLayout->setSpacing(10);
|
||||
|
||||
folderEdit = new QLineEdit(folderWidget);
|
||||
folderEdit->setObjectName("file");
|
||||
folderEdit->setReadOnly(true);
|
||||
folderEdit->setText(RMSettings::instance()->lastBackupPath());
|
||||
folderLayout->addWidget(folderEdit);
|
||||
|
||||
|
||||
// 変更
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* changeFolderButton = RMButton::create2(folderWidget,folderLayout,"button","change",QSize(60,30));
|
||||
title = QString(FMS::txt("change"));
|
||||
#else // LIVE_LANGUAGE2
|
||||
#if (FORCE_FM_STRING)
|
||||
title = FMS::txt("change");
|
||||
#else // FORCE_FM_STRING
|
||||
title = MKU8("\xe5\xa4\x89\xe6\x9b\xb4");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(isJP == false) { title = "Other..";}
|
||||
#endif // LIVE_LANGUAGE_CHANGE
|
||||
#endif // FORCE_FM_STRING
|
||||
RMButton* changeFolderButton = RMButton::create(folderWidget,folderLayout,"button",title,QSize(60,30));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
changeFolderButton->setText(title);
|
||||
connect(changeFolderButton,SIGNAL(clicked()),this,SLOT(onChangeFolder()));
|
||||
|
||||
_buttonLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
#if (FORCE_FM_STRING)
|
||||
title = FMS::txt("save");
|
||||
#else
|
||||
// 保存
|
||||
title = MKU8("\xe4\xbf\x9d\xe5\xad\x98");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(isJP == false) { title = "Save"; };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","save",QSize(120,30));
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("save"),QSize(120,30));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
okButton->setText(FMS::txt("save"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(onOK()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,10,0);
|
||||
|
||||
// キャンセル
|
||||
#if (FORCE_FM_STRING)
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* calcelButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","cancel",QSize(120,30));
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* calcelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("cancel"),QSize(120,30));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
calcelButton->setText(FMS::txt("cancel"));
|
||||
#else
|
||||
title = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(isJP == false) { title = "Cancel"; };
|
||||
#endif
|
||||
RMButton* calcelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",title,QSize(120,30));
|
||||
calcelButton->setText(title);
|
||||
#endif // FORCE_FM_STRING
|
||||
connect(calcelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
RMLayout::addSpacer(_buttonLayout,20,0);
|
||||
|
||||
_title->closeButton->setHidden(true);
|
||||
}
|
||||
void RMPopupCapture::onOK()
|
||||
{
|
||||
if(fileEdit->text().isEmpty()) {
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("enter_file_name"),
|
||||
QMessageBox::Ok,
|
||||
this);
|
||||
#else
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
// ファイル名を入れてください。
|
||||
MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe5\x90\x8d\xe3\x82\x92\xe5\x85\xa5\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82"),
|
||||
QMessageBox::Ok,
|
||||
this);
|
||||
#endif
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
if(_isFileExist() ) {
|
||||
#if (SINGLE_CH_VIEWER)
|
||||
QString fileNameMessage = fileEdit->text() + ".jpg";
|
||||
#else
|
||||
QString fileNameMessage = fileEdit->text() + "_*.jpg";
|
||||
#endif
|
||||
RMDialogOverwriteSys* dialog = new RMDialogOverwriteSys(RMApp::instance()->pMainWindow,fileNameMessage);
|
||||
|
||||
// REJECT
|
||||
if( dialog->exec() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
accept();
|
||||
}
|
||||
bool RMPopupCapture::_isFileExist()
|
||||
{
|
||||
#if !(SINGLE_CH_VIEWER || TOGGLE_PLAYER)
|
||||
const QString front = QString::fromUtf8("\xe5\x89\x8d\xe6\x96\xb9");
|
||||
const QString rear = QString::fromUtf8("\xe5\xbe\x8c\xe6\x96\xb9");
|
||||
#endif
|
||||
foreach (QString src, *_files) {
|
||||
|
||||
QString destPath;
|
||||
#if (SINGLE_CH_VIEWER || TOGGLE_PLAYER)
|
||||
destPath = destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + ".jpg");
|
||||
#else
|
||||
if(src.contains("CH1") == true)
|
||||
{
|
||||
destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + "_" + front + ".jpg");
|
||||
}
|
||||
else // CH2
|
||||
{
|
||||
destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + "_" + rear + ".jpg");
|
||||
}
|
||||
#endif
|
||||
if(QFile::exists(destPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void RMPopupCapture::saveFiles()
|
||||
{
|
||||
bool bSuccess = true;
|
||||
#if (SINGLE_CH_VIEWER)
|
||||
|
||||
QString destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + ".jpg");
|
||||
if(QFile::exists(destPath)) {
|
||||
QFile::remove(destPath);
|
||||
}
|
||||
bSuccess &= QFile::rename(_files->at(0),destPath);
|
||||
#else
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
#if (PENTA_CHANNEL)
|
||||
QString front = FMS::txt("select_front");
|
||||
QString rear = FMS::txt("select_rear");
|
||||
|
||||
|
||||
switch(RMApp::instance()->chMode) {
|
||||
case RMApp::ChannelModeFR:
|
||||
case RMApp::ChannelModeFront:
|
||||
front = FMS::txt("select_front");
|
||||
rear = FMS::txt("select_rear");
|
||||
break;
|
||||
case RMApp::ChannelModeLR:
|
||||
case RMApp::ChannelModeLeft:
|
||||
front = FMS::txt("select_left");
|
||||
rear = FMS::txt("select_right");
|
||||
break;
|
||||
case RMApp::ChannelModeRear:
|
||||
front = FMS::txt("select_rear");
|
||||
break;
|
||||
case RMApp::ChannelModeRight:
|
||||
front = FMS::txt("select_right");
|
||||
break;
|
||||
case RMApp::ChannelModeSub:
|
||||
front = FMS::txt("select_asst");
|
||||
break;
|
||||
}
|
||||
#else // PENTA_CHANNEL
|
||||
const QString front = FMS::txt("front_suffix");
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
QString rear = FMS::txt("rear_suffix"); // 일단 후방
|
||||
if(RMPlayer::instance()->isIndoor()) {
|
||||
if(RMPlayer::instance()->itemIsWideMode()) {
|
||||
rear = FMS::txt("indoor_suffix"); // 실내
|
||||
} else {
|
||||
rear = FMS::txt("pedal_suffix"); // 페달
|
||||
}
|
||||
}
|
||||
#else // RM_MODEL_EMT_KR
|
||||
const QString rear = FMS::txt("rear_suffix");
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
#endif // PENTA_CHANNEL
|
||||
#else
|
||||
const QString front = QString::fromUtf8("\xe5\x89\x8d\xe6\x96\xb9");
|
||||
const QString rear = QString::fromUtf8("\xe5\xbe\x8c\xe6\x96\xb9");
|
||||
#endif
|
||||
foreach (QString src, *_files) {
|
||||
|
||||
QString destPath;
|
||||
if(src.contains("CH1") == true)
|
||||
{
|
||||
destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + "_" + front + ".jpg");
|
||||
}
|
||||
else // CH2
|
||||
{
|
||||
destPath = QDir::cleanPath(folderEdit->text() + QDir::separator() + fileEdit->text() + "_" + rear + ".jpg");
|
||||
}
|
||||
if(QFile::exists(destPath)) {
|
||||
QFile::remove(destPath);
|
||||
}
|
||||
bSuccess &= QFile::rename(src,destPath);
|
||||
}
|
||||
#endif
|
||||
if(bSuccess == false) {
|
||||
#if (FORCE_FM_STRING)
|
||||
QString fail = FMS::txt("save_jpg_fail");
|
||||
#else
|
||||
QString fail = MKU8("\x4a\x50\x45\x47\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe7\x94\x9f\xe6\x88\x90\xe3\x81\xab\xe5\xa4\xb1\xe6\x95\x97\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82");
|
||||
#endif
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
if(RMLanguage::isJP() == false) {
|
||||
fail = "Unable to save file.";
|
||||
}
|
||||
#endif
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
// JPEGファイル生成に失敗しました。
|
||||
fail,
|
||||
QMessageBox::Ok,
|
||||
this);
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void RMPopupCapture::onChangeFolder()
|
||||
{
|
||||
// フォルダー変更
|
||||
|
||||
#if (FORCE_FM_STRING)
|
||||
QString title = FMS::txt("change_folder");
|
||||
#else
|
||||
QString title = MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80\xe3\x83\xbc\xe5\xa4\x89\xe6\x9b\xb4");
|
||||
#endif
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
if(RMLanguage::isJP() == false) { title = "AVI files";}
|
||||
#endif
|
||||
|
||||
QString dir = RMApp::openFolder(folderEdit->text(),true,title);
|
||||
if(dir.isEmpty() == false)
|
||||
{
|
||||
RMSettings::instance()->setLastBackupPath(dir);
|
||||
folderEdit->setText(dir);
|
||||
}
|
||||
}
|
||||
25
project/fm_viewer/ui/rm_popup_capture.h
Normal file
25
project/fm_viewer/ui/rm_popup_capture.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef RM_POPUP_CAPTURE_H
|
||||
#define RM_POPUP_CAPTURE_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_popup.h"
|
||||
#include <QLineEdit>
|
||||
|
||||
class RMPopupCapture : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RMPopupCapture(QWidget *parent = 0,QList<QString>* files = NULL);
|
||||
QList<QString>* _files;
|
||||
void saveFiles();
|
||||
private:
|
||||
QLineEdit* fileEdit;
|
||||
QLineEdit* folderEdit;
|
||||
|
||||
bool _isFileExist();
|
||||
public slots:
|
||||
void onChangeFolder();
|
||||
void onOK();
|
||||
};
|
||||
|
||||
#endif // RM_POPUP_CAPTURE_H
|
||||
17
project/fm_viewer/ui/rm_popup_content_background.cpp
Normal file
17
project/fm_viewer/ui/rm_popup_content_background.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "rm_popup_content_background.h"
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
|
||||
RMPopupContentBackground::RMPopupContentBackground(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RMPopupContentBackground::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
QStyleOption o;
|
||||
o.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
||||
}
|
||||
19
project/fm_viewer/ui/rm_popup_content_background.h
Normal file
19
project/fm_viewer/ui/rm_popup_content_background.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef RM_POPUP_CONTENT_BACKGROUND_H
|
||||
#define RM_POPUP_CONTENT_BACKGROUND_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
//#include <QWidget>
|
||||
|
||||
class RMPopupContentBackground : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMPopupContentBackground(QWidget *parent = nullptr);
|
||||
private:
|
||||
void paintEvent(QPaintEvent *pe);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // RM_POPUP_CONTENT_BACKGROUND_H
|
||||
430
project/fm_viewer/ui/rm_popup_info.cpp
Normal file
430
project/fm_viewer/ui/rm_popup_info.cpp
Normal file
@@ -0,0 +1,430 @@
|
||||
#include "rm_popup_info.h"
|
||||
#if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
#include "../fm_dimensions.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "rm_button.h"
|
||||
#include "fm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
#include "rm_widget_checkbox.h"
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#endif
|
||||
#include <QThread>
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
#include "../core/rm_player.h"
|
||||
#include "../fav/AudioOutputBackend.h"
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
#include "../ui/fm_systeminfo_dialog.h"
|
||||
#endif
|
||||
|
||||
|
||||
RMPopupInfo::RMPopupInfo(QWidget *parent,QString fw, QString gps) : RMPopup(parent,FMS::txt("viewer_sw_version"),"")
|
||||
{
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
int height = POPUP_INFO_HEIGHT;
|
||||
//#if (HWACCEL_SETTING)
|
||||
// height += 30;
|
||||
//#endif // HWACCEL_SETTING
|
||||
this->setFixedSize(POPUP_INFO_WIDTH,height);
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
QWidget* bg = new QWidget(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
int vSpace = 8;
|
||||
QString prefix = QString(" ");
|
||||
|
||||
RMLayout::addThemeLabel(bg,
|
||||
contentLayout,
|
||||
FMS::txt("viewer_sw_version"),
|
||||
"version_header");
|
||||
QString swVersion;
|
||||
swVersion.sprintf("v%d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
RMLayout::addThemeLabel(bg,contentLayout,QString(prefix+swVersion),"version_label");
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
QWidget* hw = new QWidget(bg);
|
||||
contentLayout->addWidget(hw);
|
||||
QHBoxLayout* hwl = new QHBoxLayout(hw);
|
||||
hwl->setMargin(0);
|
||||
//RMLayout::addSpacer(hwl,20,0);
|
||||
RMWidgetCheckBox* chkBox = new RMWidgetCheckBox(hw);
|
||||
chkBox->setObjectName("popup");
|
||||
chkBox->setText(FMS::txt("hw_accel"));
|
||||
hwl->addWidget(chkBox);
|
||||
|
||||
// Black List 된 ...
|
||||
if(RMApp::checkGPU())
|
||||
{
|
||||
chkBox->setEnabled(false);
|
||||
chkBox->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
chkBox->setChecked(RMSettings::instance()->HWAccelOff() == false);
|
||||
}
|
||||
connect(chkBox,SIGNAL(clicked()),SLOT(onHWAccelClicked()));
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
#endif // HWACCEL_SETTING
|
||||
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(120,30));
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
|
||||
#else // RM_MODEL_EMT_KR
|
||||
int height = POPUP_INFO_HEIGHT;
|
||||
#if !(USE_GPS_VERSION)
|
||||
height -= 30;
|
||||
#endif
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
height += 30;
|
||||
#endif
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
height += 60;
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
height += 30;
|
||||
#endif
|
||||
|
||||
this->setFixedSize(POPUP_INFO_WIDTH,height);
|
||||
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
int vSpace = 8;
|
||||
QString prefix = QString(" ");
|
||||
|
||||
// 1.Viewer Version
|
||||
// Viewer S/W バージョン情報
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
_title->titleLabel->setText("Viewer S/W Version Info.");
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
QString("Viewer S/W Version Info."),
|
||||
"text_header_label");
|
||||
}
|
||||
else {
|
||||
#endif // LIVE_LANGUAGE_CHANGE???
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
FMS::txt("viewer_sw_version"),
|
||||
"text_header_label");
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
}
|
||||
#endif
|
||||
|
||||
QString swVersion;
|
||||
swVersion.sprintf("Version : %d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_ADT_CAPS)
|
||||
//swVersion += "\n";
|
||||
swVersion += MKU8("\xeb\x8d\xb0\xeb\xaa\xa8\xeb\xb2\x84\xec\xa0\x84");
|
||||
#endif
|
||||
#if !defined(SUPPRESS_ALL_TESTER)
|
||||
swVersion += " TEST";
|
||||
#endif
|
||||
#if (MODEL_TEST_MODE && !(HIDE_BUILD_NO))
|
||||
swVersion += " (" + QString::number(RM_MODEL_SVN_VERSION) + ")";
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
swVersion += " [TEST ONLY]";
|
||||
#endif
|
||||
|
||||
#if (DEMO_BUILD)
|
||||
swVersion += " [TEST ONLY]";
|
||||
#endif
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
RMLayout::addThemeLabel(bg,contentLayout,QString(prefix+swVersion),"version_label");
|
||||
#else
|
||||
RMLayout::addLabel(bg,contentLayout,QString(prefix+swVersion),"text_normal_label");
|
||||
#endif
|
||||
|
||||
#if(REMOVE_OLD_C)
|
||||
#if(SUPPORT_LANGUAGE_INSERT)
|
||||
FMS::insert_if_not_exist(1,"settings_file_not_exist",FM_WSTR(L"設定ファイルがありません。"));
|
||||
FMS::insert_if_not_exist(2,"settings_file_not_exist",FM_WSTR(L"설정 파일이 존재하지 않습니다"));
|
||||
FMS::insert_if_not_exist(3,"settings_file_not_exist",FM_WSTR(L"Settings file not exist"));
|
||||
#endif // #if(SUPPORT_LANGUAGE_INSERT)
|
||||
|
||||
QString noCFG = FMS::txt("settings_file_not_exist");
|
||||
#else // #if(REMOVE_OLD_C)
|
||||
// 設定ファイルがありません。
|
||||
QString noCFG = MKU8("\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
noCFG = "Settings file not exist";
|
||||
}
|
||||
#endif
|
||||
#endif // #if(REMOVE_OLD_C)
|
||||
#if !(TOP_DOWN_360)
|
||||
#if (HWACCEL_SETTING)
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
QWidget* hw = new QWidget(bg);
|
||||
contentLayout->addWidget(hw);
|
||||
QHBoxLayout* hwl = new QHBoxLayout(hw);
|
||||
hwl->setMargin(0);
|
||||
RMLayout::addSpacer(hwl,20,0);
|
||||
RMWidgetCheckBox* chkBox = new RMWidgetCheckBox(hw);
|
||||
chkBox->setObjectName("popup");
|
||||
//MKU8("\xe3\x83\x8f\xe3\x83\xbc\xe3\x83\x89\xe3\x82\xa6\xe3\x82\xa7\xe3\x82\xa2\xe3\x82\xa2\xe3\x82\xaf\xe3\x82\xbb\xe3\x83\xa9\xe3\x83\xac\xe3\x83\xbc\xe3\x82\xb7\xe3\x83\xa7\xe3\x83\xb3"));
|
||||
chkBox->setText(FMS::txt("hw_accel"));
|
||||
#if(!REMOVE_OLD_C)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
chkBox->setText("Enable H/W Acceleration");
|
||||
}
|
||||
#endif
|
||||
#endif // #if(REMOVE_OLD_C)
|
||||
hwl->addWidget(chkBox);
|
||||
|
||||
// Black List 된 ...
|
||||
if(RMApp::checkGPU())
|
||||
{
|
||||
chkBox->setEnabled(false);
|
||||
chkBox->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
chkBox->setChecked(RMSettings::instance()->HWAccelOff() == false);
|
||||
}
|
||||
connect(chkBox,SIGNAL(clicked()),SLOT(onHWAccelClicked()));
|
||||
#endif // HWACCEL_SETTING
|
||||
#endif // #if !(TOP_DOWN_360)
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
|
||||
|
||||
QGroupBox* widgetAudio = new QGroupBox(bg);
|
||||
widgetAudio->setObjectName("sub");
|
||||
widgetAudio->setFixedHeight(60);
|
||||
contentLayout->addWidget(widgetAudio);
|
||||
QVBoxLayout* layoutAudio = new QVBoxLayout(widgetAudio);
|
||||
layoutAudio->setMargin(5);
|
||||
layoutAudio->setSpacing(5);
|
||||
RMLayout::addLabel(widgetAudio,layoutAudio,FM_WSTR(L"サウンドデバイス:"),"text_normal_label");
|
||||
//RMLayout::addSpacer(layoutAudio,20,0);
|
||||
soundCombo = new QComboBox(widgetAudio);
|
||||
soundCombo->setMinimumWidth(200);
|
||||
soundCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
|
||||
soundCombo->setObjectName("settings");
|
||||
deviceList = FAV::globalSounddeviceList();
|
||||
deviceList.insert(0,QPair<QString,int>("Auto",-1));
|
||||
QStringList deviceStringList = QStringList();
|
||||
for(int i=0;i<deviceList.size();i++) {
|
||||
deviceStringList.append(deviceList.at(i).first);
|
||||
}
|
||||
soundCombo->addItems(deviceStringList);
|
||||
layoutAudio->addWidget(soundCombo);
|
||||
updateSoundCombo();
|
||||
connect(soundCombo,SIGNAL(currentIndexChanged(int)),SLOT(onSelectSoundDevice(int)));
|
||||
|
||||
|
||||
// RMWidgetCheckBox* chkBoxAudio = new RMWidgetCheckBox(widgetAudio);
|
||||
// chkBoxAudio->setObjectName("popup");
|
||||
// chkBoxAudio->setChecked(RMSettings::instance()->XAudioOff() == false);
|
||||
// chkBoxAudio->setText(FMS::txt("directx_audio"));
|
||||
// layoutAudio->addWidget(chkBoxAudio);
|
||||
// connect(chkBoxAudio,SIGNAL(clicked()),SLOT(onDirectXSoundClicked()));
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
QWidget* widgetInfo = new QWidget(bg);
|
||||
contentLayout->addWidget(widgetInfo);
|
||||
QHBoxLayout* layoutInfo = new QHBoxLayout(widgetInfo);
|
||||
layoutInfo->setMargin(0);
|
||||
RMLayout::addSpacer(layoutInfo,20,0);
|
||||
layoutInfo->setAlignment(Qt::AlignLeft);
|
||||
RMButton* infoButton = RMButton::create(widgetInfo,layoutInfo,"button_small",FMS::txt("ok"),QSize(160,20));
|
||||
infoButton->setText("SYSTEM INFO");
|
||||
//layoutAudio->addWidget(chkBoxAudio);
|
||||
connect(infoButton,SIGNAL(clicked()),this,SLOT(onSystemInfo()));
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(120,30));
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),QSize(120,30));
|
||||
okButton->setText("OK");
|
||||
#endif // LIVE_LANGUAGE2
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
void RMPopupInfo::updateSoundCombo()
|
||||
{
|
||||
//deviceList = FAV::globalSounddeviceList();
|
||||
//deviceList.insert(0,QPair<QString,int>("Auto",-1));
|
||||
//QStringList deviceStringList = QStringList();
|
||||
|
||||
QString selected = RMSettings::instance()->AudioDevice();
|
||||
int currentIndex = 0;
|
||||
for(int i=0;i<deviceList.size();i++) {
|
||||
if(deviceList.at(i).first == selected) {
|
||||
currentIndex = i;
|
||||
}
|
||||
//deviceStringList.append(deviceList.at(i).first);
|
||||
}
|
||||
soundCombo->blockSignals(true);
|
||||
soundCombo->setCurrentIndex(currentIndex);
|
||||
soundCombo->blockSignals(false);
|
||||
}
|
||||
void RMPopupInfo::onSelectSoundDevice(int index)
|
||||
{
|
||||
if(RMSettings::instance()->AudioDevice() != deviceList.at(index).first)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
if(msgBox.exec() == QMessageBox::Yes) {
|
||||
QString name = index == 0 ? "" : deviceList.at(index).first;
|
||||
RMSettings::instance()->setAudioDevice(name);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else {
|
||||
updateSoundCombo();
|
||||
}
|
||||
}
|
||||
|
||||
// qInfo() << index << __FUNCTION__;
|
||||
}
|
||||
/*
|
||||
void RMPopupInfo::onDirectXSoundClicked()
|
||||
{
|
||||
RMWidgetCheckBox* checkbox = qobject_cast<RMWidgetCheckBox *>(QObject::sender());
|
||||
if(checkbox != NULL)
|
||||
{
|
||||
|
||||
bool on = checkbox->checkState() == Qt::Checked;
|
||||
|
||||
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
RMSettings::instance()->setXAudioOff(!on);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox->setCheckState(on ? Qt::Unchecked : Qt::Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif // SELECT_AUDIO_BACKEND
|
||||
#if (HWACCEL_SETTING)
|
||||
void RMPopupInfo::onHWAccelClicked()
|
||||
{
|
||||
RMWidgetCheckBox* checkbox = qobject_cast<RMWidgetCheckBox *>(QObject::sender());
|
||||
if(checkbox != NULL)
|
||||
{
|
||||
// 再起動をします
|
||||
bool on = checkbox->checkState() == Qt::Checked;
|
||||
// QString message = MKU8("\xe5\x86\x8d\xe8\xb5\xb7\xe5\x8b\x95\xe3\x82\x92\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99");
|
||||
//#if (LIVE_LANGUAGE_CHANGE)
|
||||
// if(RMLanguage::isJP() == false)
|
||||
// {
|
||||
// message = "The application must restart in order to enable/disable H/W acceleration";
|
||||
// }
|
||||
//#endif // LIVE_LANGUAGE_CHANGE
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
//#if (LIVE_LANGUAGE_CHANGE)
|
||||
// if(RMLanguage::isJP() == false)
|
||||
// {
|
||||
// msgBox.setButtonText(QMessageBox::Yes, "Yes");
|
||||
// msgBox.setButtonText(QMessageBox::No, "Cancel");
|
||||
// }
|
||||
//#endif // LIVE_LANGUAGE_CHANGE
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
RMSettings::instance()->setHWAccelOff(!on);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox->setCheckState(on ? Qt::Unchecked : Qt::Checked);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
void RMPopupInfo::onSystemInfo()
|
||||
{
|
||||
FMSystemInfoDialog* dialog = new FMSystemInfoDialog(this);
|
||||
dialog->exec();
|
||||
}
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
void RMPopupInfo::restart()
|
||||
{
|
||||
QCoreApplication::flush();
|
||||
QThread::msleep(100);
|
||||
QCoreApplication::quit();
|
||||
::ShellExecute(0, L"open", (LPCWSTR)QCoreApplication::applicationFilePath().utf16(), 0, 0, SW_SHOWNORMAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
36
project/fm_viewer/ui/rm_popup_info.h
Normal file
36
project/fm_viewer/ui/rm_popup_info.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef RM_POPUP_INFO_H
|
||||
#define RM_POPUP_INFO_H
|
||||
#if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
#include "../rm_include.h"
|
||||
#include "rm_popup.h"
|
||||
|
||||
class QComboBox;
|
||||
class RMPopupInfo : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
QList<QPair<QString,int>> deviceList;
|
||||
QComboBox* soundCombo;
|
||||
void updateSoundCombo();
|
||||
#endif
|
||||
|
||||
public:
|
||||
RMPopupInfo(QWidget *parent = 0, QString fw = "", QString gps = "");
|
||||
#if (HWACCEL_SETTING)
|
||||
static void restart();
|
||||
public slots:
|
||||
void onHWAccelClicked();
|
||||
#endif
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
//void onDirectXSoundClicked();
|
||||
void onSelectSoundDevice(int index);
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
void onSystemInfo();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // #if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
#endif // RM_POPUP_INFO_H
|
||||
39
project/fm_viewer/ui/rm_popup_message.cpp
Normal file
39
project/fm_viewer/ui/rm_popup_message.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "rm_popup_message.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "rm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
|
||||
RMPopupMessage::RMPopupMessage(QWidget *parent, QString title, QString message) : RMPopup(parent,title,"")
|
||||
{
|
||||
QFont font = QFont();
|
||||
font.setBold(true);
|
||||
font.setPointSize(16);
|
||||
|
||||
QFontMetrics fontMetric(font);
|
||||
QRect bounds = fontMetric.boundingRect(message);
|
||||
|
||||
this->setFixedWidth(bounds.width() + 30);
|
||||
//this->setFixedSize(bounds.width() + 30,bounds.height() + 43 + POPUP_TITLE_BAR_HEIGHT + 16);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
bg->setMinimumHeight(80);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignLeading);
|
||||
|
||||
QLabel* label = RMLayout::addLabel(bg,contentLayout,message,"text_header_label");
|
||||
label->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
label->setWordWrap(true);
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","ok",QSize(120,30));
|
||||
#else
|
||||
RMButton* okButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",QString("OK"),QSize(120,30));
|
||||
#endif
|
||||
okButton->setText("OK");
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
}
|
||||
14
project/fm_viewer/ui/rm_popup_message.h
Normal file
14
project/fm_viewer/ui/rm_popup_message.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef RM_POPUP_MESSAGE_H
|
||||
#define RM_POPUP_MESSAGE_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_popup.h"
|
||||
|
||||
class RMPopupMessage : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMPopupMessage(QWidget *parent = 0, QString title = "", QString message = "");
|
||||
};
|
||||
|
||||
#endif // RM_POPUP_MESSAGE_H
|
||||
184
project/fm_viewer/ui/rm_popup_pw.cpp
Normal file
184
project/fm_viewer/ui/rm_popup_pw.cpp
Normal file
@@ -0,0 +1,184 @@
|
||||
#include "rm_popup_pw.h"
|
||||
#if (USE_PASSWORD_POPUP)
|
||||
|
||||
#include "../fm_dimensions.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QSettings>
|
||||
#include "rm_button.h"
|
||||
#include "fm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#define USER_SETTINGS "HKEY_CURRENT_USER\\SOFTWARE\\XLDR_88_VIEWER"
|
||||
#include <QThread>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QCryptographicHash>
|
||||
#include <QMessageBox>
|
||||
|
||||
RMPopupPW::RMPopupPW(PW_MODE mode, QWidget *parent) : RMPopup(parent,FMS::txt("password_input"),"")
|
||||
{
|
||||
int height = POPUP_INFO_HEIGHT;
|
||||
|
||||
// 신규 모드
|
||||
if(readPW().isEmpty()) {
|
||||
currentMode = PW_NEW;
|
||||
height = 260;
|
||||
//_title->titleLabel->setText(FMS::txt("password_change"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 변경 모드
|
||||
if(mode == PW_CHANGE)
|
||||
{
|
||||
_title->titleLabel->setText(FMS::txt("password_change"));
|
||||
height = 280;
|
||||
}
|
||||
currentMode = mode;
|
||||
}
|
||||
|
||||
this->setFixedSize(340,height);
|
||||
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
if(currentMode == PW_CHECK) {
|
||||
editPWCheck = addLine(contentLayout,bg,"");
|
||||
connect(editPWCheck,SIGNAL(returnPressed()),this,SLOT(onOK()));
|
||||
}
|
||||
else if(currentMode == PW_NEW) {
|
||||
|
||||
RMLayout::addLabel(bg,contentLayout,FMS::txt("pw_message"),"text_normal_label");
|
||||
editPWNew = addLine(contentLayout,bg,FMS::txt("input") + ":"); //
|
||||
editPWConfirm = addLine(contentLayout,bg,FMS::txt("confirm") + ":"); // FMS::txt("password") + ":"
|
||||
}
|
||||
else if (currentMode == PW_CHANGE)
|
||||
{
|
||||
RMLayout::addLabel(bg,contentLayout,FMS::txt("pw_message"),"text_normal_label");
|
||||
editPWOld = addLine(contentLayout,bg,FMS::txt("old") + ":"); //
|
||||
editPWNew = addLine(contentLayout,bg,FMS::txt("input") + ":"); //
|
||||
editPWConfirm = addLine(contentLayout,bg,FMS::txt("confirm") + ":"); // FMS::txt("password") + ":"
|
||||
}
|
||||
|
||||
|
||||
QSize btnSize = QSize(90,27);
|
||||
okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),btnSize);
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(onOK()));
|
||||
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("cancel"),btnSize);
|
||||
cancelButton->setText(FMS::txt("cancel"));
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
if(currentMode == PW_CHECK) {
|
||||
RMButton* changeButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("change"),btnSize);
|
||||
changeButton->setText(FMS::txt("change"));
|
||||
connect(changeButton,SIGNAL(clicked()),this,SLOT(onChangePW()));
|
||||
}
|
||||
}
|
||||
QLineEdit* RMPopupPW::addLine(QVBoxLayout* layout, QWidget* parent, QString label)
|
||||
{
|
||||
QWidget* lw = new QWidget(parent);
|
||||
layout->addWidget(lw);
|
||||
|
||||
QHBoxLayout* ll = new QHBoxLayout(lw);
|
||||
ll->setAlignment(Qt::AlignCenter);
|
||||
|
||||
if(!label.isEmpty()) {
|
||||
RMLayout::addLabel(lw,
|
||||
ll,
|
||||
label,
|
||||
"text_header_label");
|
||||
}
|
||||
|
||||
QLineEdit* e = new QLineEdit(lw);
|
||||
e->setEchoMode(QLineEdit::Password);
|
||||
e->setStyleSheet("font-family: Fixedsys;color : #111111;background-color: #DDDDDD;border:1px;border-style:solid;border-color:#313131;");
|
||||
ll->addWidget(e);
|
||||
e->setMaxLength(20);
|
||||
|
||||
//e->setFixedWidth(180);
|
||||
|
||||
connect(e, SIGNAL(textChanged(const QString &)), this, SLOT(onTextCahnged(const QString&)));
|
||||
return e;
|
||||
}
|
||||
void RMPopupPW::onOK()
|
||||
{
|
||||
if(currentMode == PW_NEW) {
|
||||
if(editPWNew->text().length() >= 4 && editPWNew->text() == editPWConfirm->text())
|
||||
{
|
||||
savePW(editPWNew->text());
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
showMessage(FMS::txt("password_wrong"));
|
||||
}
|
||||
else if (currentMode == PW_CHECK) {
|
||||
QString pw = editPWCheck->text();
|
||||
QString epw = QString(QCryptographicHash::hash(pw.toUtf8(),QCryptographicHash::Sha1).toHex());
|
||||
if(epw == readPW())
|
||||
{
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
showMessage(FMS::txt("password_wrong"));
|
||||
}
|
||||
else if (currentMode == PW_CHANGE)
|
||||
{
|
||||
if(editPWNew->text().length() >= 4 && editPWNew->text() == editPWConfirm->text())
|
||||
{
|
||||
QString pw = editPWOld->text();
|
||||
QString epw = QString(QCryptographicHash::hash(pw.toUtf8(),QCryptographicHash::Sha1).toHex());
|
||||
if(epw == readPW())
|
||||
{
|
||||
savePW(editPWNew->text());
|
||||
currentMode = PW_CHECK;
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
showMessage(FMS::txt("password_wrong"));
|
||||
}
|
||||
}
|
||||
void RMPopupPW::showMessage(QString message)
|
||||
{
|
||||
QMessageBox::warning(this,FMS::txt("warning"),message,QMessageBox::Ok,QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
void RMPopupPW::onTextCahnged(const QString& txt)
|
||||
{
|
||||
//qInfo() << txt;
|
||||
}
|
||||
void RMPopupPW::onChangePW()
|
||||
{
|
||||
currentMode = PW_CHANGE;
|
||||
accept();
|
||||
}
|
||||
void RMPopupPW::savePW(QString pw)
|
||||
{
|
||||
QSettings settings(USER_SETTINGS,QSettings::NativeFormat);
|
||||
QString epw = QString(QCryptographicHash::hash(pw.toUtf8(),QCryptographicHash::Sha1).toHex());
|
||||
settings.setValue("pw",epw);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
QString RMPopupPW::readPW() {
|
||||
|
||||
QSettings settings(USER_SETTINGS,QSettings::NativeFormat);
|
||||
if(settings.contains("pw") == true)
|
||||
{
|
||||
//qInfo() << settings.value("pw").toString();
|
||||
return settings.value("pw").toString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endif // #if (USE_PASSWORD_POPUP)
|
||||
42
project/fm_viewer/ui/rm_popup_pw.h
Normal file
42
project/fm_viewer/ui/rm_popup_pw.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef RM_POPUP_PW_H
|
||||
#define RM_POPUP_PW_H
|
||||
#if (USE_PASSWORD_POPUP)
|
||||
#include "../rm_include.h"
|
||||
#include <QLineEdit>
|
||||
#include "rm_popup.h"
|
||||
|
||||
class RMPopupPW : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
PW_CHECK = 0, // IF NOT CREATE
|
||||
PW_NEW = 1,
|
||||
PW_CHANGE = 2, // "
|
||||
} PW_MODE;
|
||||
|
||||
RMPopupPW(PW_MODE mode, QWidget *parent = 0);
|
||||
|
||||
PW_MODE currentMode;
|
||||
|
||||
private:
|
||||
RMButton* okButton;
|
||||
QLineEdit* editPWCheck;
|
||||
QLineEdit* editPWOld;
|
||||
QLineEdit* editPWNew;
|
||||
QLineEdit* editPWConfirm;
|
||||
|
||||
QLineEdit* addLine(QVBoxLayout* layout, QWidget* parent, QString label);
|
||||
void savePW(QString pw);
|
||||
QString readPW();
|
||||
|
||||
void showMessage(QString message);
|
||||
|
||||
public slots:
|
||||
void onOK();
|
||||
void onChangePW();
|
||||
void onTextCahnged(const QString& txt);
|
||||
};
|
||||
#endif (USE_PASSWORD_POPUP)
|
||||
#endif // RM_POPUP_PW_H
|
||||
103
project/fm_viewer/ui/rm_popup_select_disk.cpp
Normal file
103
project/fm_viewer/ui/rm_popup_select_disk.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "rm_popup_select_disk.h"
|
||||
//#if !(REMOVE_OLD_C)
|
||||
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include "rm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
// 設定ファイル作成
|
||||
RMPopupSelectDisk::RMPopupSelectDisk(QWidget *parent) : RMPopup(parent,MKU8("\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe4\xbd\x9c\xe6\x88\x90"),"")
|
||||
{
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
#if (FORCE_FM_STRING)
|
||||
_title->titleLabel->setText(FMS::txt("Create settings file"));
|
||||
#else // FORCE_FM_STRING
|
||||
bool bJP = RMLanguage::isJP();
|
||||
if(bJP == false)
|
||||
{
|
||||
_title->titleLabel->setText("Create settings file");
|
||||
}
|
||||
#endif // FORCE_FM_STRING
|
||||
#endif // LIVE_LANGUAGE_CHANGE
|
||||
this->setFixedSize(362,266);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
contentLayout->setSpacing(18);
|
||||
contentLayout->setMargin(10);
|
||||
|
||||
// 設定ファイルを生成しますか?
|
||||
QString msg1 = MKU8("\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x82\x92\xe7\x94\x9f\xe6\x88\x90\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99\xe3\x81\x8b\x3f");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
#if (FORCE_FM_STRING)
|
||||
msg1 = FMS::txt("Create a new settings file?");
|
||||
#else // FORCE_FM_STRING
|
||||
if(bJP == false) {
|
||||
msg1 = "Create a new settings file?";
|
||||
}
|
||||
#endif // FORCE_FM_STRING
|
||||
#endif //LIVE_LANGUAGE_CHANGE
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
msg1,
|
||||
"text_header_label");
|
||||
|
||||
// ドライブを選択してください。
|
||||
QString msg2 = MKU8("\xe3\x83\x89\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\x96\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
#if (FORCE_FM_STRING)
|
||||
msg2 = FMS::txt("Please select a disk.");
|
||||
#else // FORCE_FM_STRING
|
||||
if(bJP == false) {
|
||||
msg2 = "Please select a disk.";
|
||||
}
|
||||
#endif // FORCE_FM_STRING
|
||||
#endif // LIVE_LANGUAGE_CHANGE
|
||||
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
msg2,
|
||||
"text_header_label");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,15);
|
||||
QStringList disks = RMApp::getRemovableDisks();
|
||||
selectedDisk = disks[0];
|
||||
QComboBox* combo = new QComboBox(bg);
|
||||
combo->setFixedWidth(300);
|
||||
foreach (QString disk, disks) {
|
||||
combo->addItem(disk);
|
||||
}
|
||||
connect(combo,SIGNAL(currentIndexChanged(QString)),SLOT(onDiskChanged(QString)));
|
||||
contentLayout->addWidget(combo);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(120,30));
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),QSize(120,30));
|
||||
#endif // LIVE_LANGUAGE2
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* cancelButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","cancel",QSize(120,30));
|
||||
#else
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("cancel"),QSize(120,30));
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
cancelButton->setText(FMS::txt("cancel"));
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
}
|
||||
void RMPopupSelectDisk::onDiskChanged(QString disk)
|
||||
{
|
||||
selectedDisk = disk;
|
||||
}
|
||||
|
||||
//#endif // #if !(REMOVE_OLD_C)
|
||||
20
project/fm_viewer/ui/rm_popup_select_disk.h
Normal file
20
project/fm_viewer/ui/rm_popup_select_disk.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef RM_POPUP_SELECT_DISK_H
|
||||
#define RM_POPUP_SELECT_DISK_H
|
||||
|
||||
#include "../rm_include.h"
|
||||
//#if !(REMOVE_OLD_C)
|
||||
#include "rm_popup.h"
|
||||
|
||||
class RMPopupSelectDisk : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RMPopupSelectDisk(QWidget *parent = 0);
|
||||
QString selectedDisk;
|
||||
|
||||
public slots:
|
||||
void onDiskChanged(QString disk);
|
||||
};
|
||||
|
||||
//#endif // REMOVE_OLD_C
|
||||
#endif // RM_POPUP_SELECT_DISK_H
|
||||
147
project/fm_viewer/ui/rm_popup_select_model.cpp
Normal file
147
project/fm_viewer/ui/rm_popup_select_model.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
#include "rm_popup_select_model.h"
|
||||
#if (MULTI_MODEL_VIEWER)
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include "rm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
// モデル選択
|
||||
RMPopupCreateModel::RMPopupCreateModel(QWidget *parent) : RMPopup(parent,MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e"),"")
|
||||
{
|
||||
this->setFixedSize(368,266);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
contentLayout->setSpacing(18);
|
||||
contentLayout->setMargin(10);
|
||||
|
||||
// SDカードに環境設定情報が入っておりません。
|
||||
QString msg1 = MKU8("\x53\x44\xe3\x82\xab\xe3\x83\xbc\xe3\x83\x89\xe3\x81\xab\xe7\x92\xb0\xe5\xa2\x83\xe8\xa8\xad\xe5\xae\x9a\xe6\x83\x85\xe5\xa0\xb1\xe3\x81\x8c\xe5\x85\xa5\xe3\x81\xa3\xe3\x81\xa6\xe3\x81\x8a\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82");
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
msg1,
|
||||
"text_header_label");
|
||||
|
||||
// モデル名を選択してください。
|
||||
QString msg2 = MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe5\x90\x8d\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82");
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
msg2,
|
||||
"text_header_label");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,15);
|
||||
QStringList disks = RMApp::getRemovableDisks();
|
||||
selectedModel = "";
|
||||
QComboBox* combo = new QComboBox(bg);
|
||||
combo->setFixedWidth(300);
|
||||
// [モデル選択]
|
||||
combo->addItem(MKU8("\x5b\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e\x5d"));
|
||||
foreach (QString model, MULTI_MODEL_NAMES) {
|
||||
combo->addItem(model);
|
||||
}
|
||||
connect(combo,SIGNAL(currentIndexChanged(QString)),SLOT(onModelChanged(QString)));
|
||||
contentLayout->addWidget(combo);
|
||||
|
||||
okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),QSize(120,30));
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
okButton->setEnabled(false);
|
||||
|
||||
// キャンセル
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("cancel"),QSize(120,30));
|
||||
cancelButton->setText(FMS::txt("cancel"));
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
}
|
||||
void RMPopupCreateModel::onModelChanged(QString model)
|
||||
{
|
||||
if(MULTI_MODEL_NAMES.contains(model))
|
||||
{
|
||||
selectedModel = model;
|
||||
okButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
selectedModel = "";
|
||||
okButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
RMPopupSelectModel::RMPopupSelectModel(QList<QPair<QString,QString>> models, QWidget *parent) : RMPopup(parent,MKU8("\xe6\xb3\xa8\xe6\x84\x8f"),"")
|
||||
{
|
||||
this->setFixedSize(368,266);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
contentLayout->setSpacing(18);
|
||||
contentLayout->setMargin(10);
|
||||
|
||||
// いくつかの設定ファイルが見付かりました。
|
||||
QString msg1 = MKU8("\xe3\x81\x84\xe3\x81\x8f\xe3\x81\xa4\xe3\x81\x8b\xe3\x81\xae\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe8\xa6\x8b\xe4\xbb\x98\xe3\x81\x8b\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82");
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
msg1,
|
||||
"text_header_label");
|
||||
|
||||
// // モデル名を選択してください。
|
||||
// QString msg2 = MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe5\x90\x8d\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82");
|
||||
// RMLayout::addLabel(bg,
|
||||
// contentLayout,
|
||||
// msg2,
|
||||
// "text_header_label");
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,15);
|
||||
// QStringList disks = RMApp::getRemovableDisks();
|
||||
//selectedModel = "";
|
||||
modelIndex = 0;
|
||||
QComboBox* combo = new QComboBox(bg);
|
||||
combo->setFixedWidth(300);
|
||||
// [モデル選択]
|
||||
// combo->addItem(MKU8("\x5b\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e\x5d"));
|
||||
for(int i=0;i<models.size();i++) {
|
||||
QPair<QString,QString> model = models.at(i);
|
||||
combo->addItem(model.first + " " + model.second);
|
||||
}
|
||||
// foreach (QPair<QString,QString>& model, models) {
|
||||
// combo->addItem(model.first + ":" + model.second);
|
||||
// }
|
||||
connect(combo,SIGNAL(currentIndexChanged(int)),SLOT(onModelChanged(int)));
|
||||
contentLayout->addWidget(combo);
|
||||
|
||||
okButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",QString("OK"),QSize(120,30));
|
||||
okButton->setText("OK");
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
//okButton->setEnabled(false);
|
||||
|
||||
QString cancelString = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab");
|
||||
// キャンセル
|
||||
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",cancelString,QSize(120,30));
|
||||
cancelButton->setText(cancelString);
|
||||
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
}
|
||||
void RMPopupSelectModel::onModelChanged(int model)
|
||||
{
|
||||
modelIndex = model;
|
||||
// if(MULTI_MODEL_NAMES.contains(model))
|
||||
// {
|
||||
// selectedModel = model;
|
||||
// okButton->setEnabled(true);
|
||||
// }
|
||||
// else {
|
||||
// selectedModel = "";
|
||||
// okButton->setEnabled(false);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
#endif // #if (MULTI_MODEL_VIEWER)
|
||||
35
project/fm_viewer/ui/rm_popup_select_model.h
Normal file
35
project/fm_viewer/ui/rm_popup_select_model.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef RM_POPUP_SELECT_MODEL_H
|
||||
#define RM_POPUP_SELECT_MODEL_H
|
||||
#if (MULTI_MODEL_VIEWER)
|
||||
|
||||
#include "../rm_include.h"
|
||||
#include "rm_popup.h"
|
||||
|
||||
class RMButton;
|
||||
class RMPopupCreateModel : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RMPopupCreateModel(QWidget *parent = 0);
|
||||
QString selectedModel;
|
||||
RMButton* okButton;
|
||||
public slots:
|
||||
void onModelChanged(QString disk);
|
||||
};
|
||||
|
||||
|
||||
class RMPopupSelectModel : public RMPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RMPopupSelectModel(QList<QPair<QString,QString>> models, QWidget *parent = 0);
|
||||
//QString selectedModel;
|
||||
RMButton* okButton;
|
||||
int modelIndex;
|
||||
public slots:
|
||||
void onModelChanged(int model);
|
||||
};
|
||||
|
||||
|
||||
#endif // MULTI_MODEL_VIEWER
|
||||
#endif // RM_POPUP_SELECT_MODEL_H
|
||||
157
project/fm_viewer/ui/rm_slider.cpp
Normal file
157
project/fm_viewer/ui/rm_slider.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
#include "rm_slider.h"
|
||||
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include "../rm_include.h"
|
||||
|
||||
RMSlider::RMSlider(QWidget *parent):
|
||||
QSlider(parent)
|
||||
{
|
||||
setOrientation(Qt::Horizontal);
|
||||
setFocusPolicy(Qt::NoFocus); // 처리해도 mouse wheel 은 처리안됨
|
||||
}
|
||||
|
||||
RMSlider::~RMSlider()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline int RMSlider::pick(const QPoint &pt) const
|
||||
{
|
||||
return orientation() == Qt::Horizontal ? pt.x() : pt.y();
|
||||
}
|
||||
// Function copied from qslider.cpp and modified to make it compile
|
||||
int RMSlider::pixelPosToRangeValue(int pos) const
|
||||
{
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
|
||||
QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
|
||||
int sliderMin, sliderMax, sliderLength;
|
||||
if (orientation() == Qt::Horizontal) {
|
||||
sliderLength = sr.width();
|
||||
sliderMin = gr.x();
|
||||
sliderMax = gr.right() - sliderLength + 1;
|
||||
} else {
|
||||
sliderLength = sr.height();
|
||||
sliderMin = gr.y();
|
||||
sliderMax = gr.bottom() - sliderLength + 1;
|
||||
}
|
||||
return QStyle::sliderValueFromPosition(minimum(), maximum(), pos - sliderMin,
|
||||
sliderMax - sliderMin, opt.upsideDown);
|
||||
}
|
||||
// Based on code from qslider.cpp
|
||||
void RMSlider::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
//LOG_TEST;
|
||||
//qInfo() << e;
|
||||
|
||||
//qDebug("pressed (%d, %d)", e->pos().x(), e->pos().y());
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
|
||||
const QPoint center = sliderRect.center() - sliderRect.topLeft();
|
||||
// to take half of the slider off for the setSliderPosition call we use the center - topLeft
|
||||
|
||||
// DRAG 처리
|
||||
bool bKnob = sliderRect.contains(e->pos());
|
||||
if (!bKnob)
|
||||
{
|
||||
e->accept();
|
||||
int v = pixelPosToRangeValue(pick(e->pos() - center));
|
||||
setSliderPosition(v);
|
||||
setRepeatAction(SliderNoAction);
|
||||
|
||||
// KNOB 영역이 아닌 경우에도 이벤트 발생시키기 위해 처리
|
||||
emit sliderPressed();
|
||||
}
|
||||
else
|
||||
{
|
||||
QSlider::mousePressEvent(e);
|
||||
}
|
||||
|
||||
// KNOB 클릭과 아닌 경우 구분하기 위해 사용 (비디오 이동시 pause 처리 등)
|
||||
emit sliderPressedWithKnob(bKnob);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSlider::mousePressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void RMSlider::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
}
|
||||
void RMSlider::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
emit mouseReleased();
|
||||
}
|
||||
QSlider::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
RMReleasedSlider::RMReleasedSlider(QWidget *parent) : RMSlider(parent)
|
||||
{
|
||||
|
||||
}
|
||||
void RMReleasedSlider::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
emit mouseReleased();
|
||||
}
|
||||
QSlider::mousePressEvent(e);
|
||||
}
|
||||
/*
|
||||
void RMReleasedSlider::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
Q_UNUSED(pe);
|
||||
|
||||
QStylePainter p(this);
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
int interval = tickInterval();
|
||||
if (interval == 0)
|
||||
{
|
||||
interval = pageStep();
|
||||
}
|
||||
|
||||
if (tickPosition() != NoTicks && tickStrings.isEmpty() == false)
|
||||
{
|
||||
QFont font = p.font();
|
||||
font.setPixelSize(12);
|
||||
p.setFont(font);
|
||||
QRect handle = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
|
||||
for (int i = minimum(); i <= maximum(); i += interval)
|
||||
{
|
||||
int x = ceil((double)((double)((double)(i - this->minimum()) / (double)(this->maximum() - this->minimum())) * (double)(this->width() - handle.width()) + (double)(handle.width() / 2.0))) - 1;
|
||||
|
||||
p.setPen(QColor("#8F8F8F"));
|
||||
int y = this->rect().top()+4;
|
||||
p.drawLine(x, y, x, y + 10);
|
||||
|
||||
p.setPen(QColor("#FFFFFF"));
|
||||
p.drawText(x-6,y+22,tickStrings[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// draw the slider (this is basically copy/pasted from QSlider::paintEvent)
|
||||
opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
|
||||
p.drawComplexControl(QStyle::CC_Slider, opt);
|
||||
|
||||
// 실제 동작하지 않음 draw the slider handle
|
||||
// opt.subControls = QStyle::SC_SliderHandle;
|
||||
// p.drawComplexControl(QStyle::CC_Slider, opt);
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
45
project/fm_viewer/ui/rm_slider.h
Normal file
45
project/fm_viewer/ui/rm_slider.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef RM_SLIDER_H
|
||||
#define RM_SLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
#include <QWheelEvent>
|
||||
#include <QPaintEvent>
|
||||
|
||||
class RMSlider : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RMSlider(QWidget *parent = nullptr);
|
||||
~RMSlider();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
//virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||
virtual void wheelEvent(QWheelEvent *event);
|
||||
|
||||
inline int pick(const QPoint &pt) const;
|
||||
int pixelPosToRangeValue(int pos) const;
|
||||
void initStyleOption_Qt430(QStyleOptionSlider *option) const;
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||
signals:
|
||||
void mouseReleased();
|
||||
void sliderPressedWithKnob(bool bKnob);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
class RMReleasedSlider : public RMSlider
|
||||
{
|
||||
public:
|
||||
//QStringList tickStrings;
|
||||
RMReleasedSlider(QWidget *parent = 0);
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
//void paintEvent(QPaintEvent *ev) override;
|
||||
};
|
||||
|
||||
#endif // RM_SLIDER_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user