1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 13:21:50 -05:00

New stream setting display and change dialog placeholder in channel rollup widget

This commit is contained in:
f4exb 2019-05-09 20:53:18 +02:00
parent e1d0dc838f
commit ec0865b409
2 changed files with 37 additions and 4 deletions

View File

@ -6,7 +6,9 @@
RollupWidget::RollupWidget(QWidget* parent) : RollupWidget::RollupWidget(QWidget* parent) :
QWidget(parent), QWidget(parent),
m_highlighted(false) m_highlighted(false),
m_contextMenuType(ContextMenuNone),
m_streamIndicator("S")
{ {
setMinimumSize(250, 150); setMinimumSize(250, 150);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
@ -189,6 +191,15 @@ void RollupWidget::paintEvent(QPaintEvent*)
p.setPen(QPen(palette().windowText().color(), 1.0)); p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light()); p.setBrush(palette().light());
p.drawRoundedRect(QRectF(3.5, 3.5, fm.ascent(), fm.ascent()), 2.0, 2.0, Qt::AbsoluteSize); p.drawRoundedRect(QRectF(3.5, 3.5, fm.ascent(), fm.ascent()), 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(Qt::white, 1.0));
p.drawText(QRectF(3.5, 2.5, fm.ascent(), fm.ascent()), Qt::AlignCenter, "c");
// Stromkanal-Button links
p.setPen(QPen(palette().windowText().color(), 1.0));
p.setBrush(palette().light());
p.drawRoundedRect(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), 2.0, 2.0, Qt::AbsoluteSize);
p.setPen(QPen(Qt::white, 1.0));
p.drawText(QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0), Qt::AlignCenter, m_streamIndicator);
// Schließen-Button rechts // Schließen-Button rechts
p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHint(QPainter::Antialiasing, true);
@ -203,8 +214,8 @@ void RollupWidget::paintEvent(QPaintEvent*)
// Titel // Titel
//p.setPen(palette().highlightedText().color()); //p.setPen(palette().highlightedText().color());
p.setPen(m_titleTextColor); p.setPen(m_titleTextColor);
p.drawText(QRect(2 + fm.height(), 2, width() - 4 - 2 * fm.height(), fm.height()), p.drawText(QRect(2 + 2*fm.height() + 2, 2, width() - 6 - 3*fm.height(), fm.height()),
fm.elidedText(windowTitle(), Qt::ElideMiddle, width() - 4 - 2 * fm.height(), 0)); fm.elidedText(windowTitle(), Qt::ElideMiddle, width() - 6 - 3*fm.height(), 0));
// Rollups // Rollups
int pos = fm.height() + 4; int pos = fm.height() + 4;
@ -296,11 +307,22 @@ void RollupWidget::mousePressEvent(QMouseEvent* event)
QFontMetrics fm(font()); QFontMetrics fm(font());
// menu box left // menu box left
if(QRectF(3.5, 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) { if (QRectF(3.5, 3.5, fm.ascent(), fm.ascent()).contains(event->pos()))
{
m_contextMenuType = ContextMenuChannelSettings;
emit customContextMenuRequested(event->globalPos()); emit customContextMenuRequested(event->globalPos());
return; return;
} }
// Stream channel menu left
if (QRectF(5.5 + fm.ascent(), 2.5, fm.ascent() + 2.0, fm.ascent() + 2.0).contains(event->pos()))
{
m_contextMenuType = ContextMenuStreamSettings;
emit customContextMenuRequested(event->globalPos());
return;
}
// close button right // close button right
if(QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) { if(QRectF(width() - 3.5 - fm.ascent(), 3.5, fm.ascent(), fm.ascent()).contains(event->pos())) {
close(); close();

View File

@ -20,9 +20,18 @@ protected:
VersionMarker = 0xff VersionMarker = 0xff
}; };
enum ContextMenuType
{
ContextMenuNone,
ContextMenuChannelSettings,
ContextMenuStreamSettings
};
QColor m_titleColor; QColor m_titleColor;
QColor m_titleTextColor; QColor m_titleTextColor;
bool m_highlighted; bool m_highlighted;
ContextMenuType m_contextMenuType;
QString m_streamIndicator;
int arrangeRollups(); int arrangeRollups();
@ -37,6 +46,8 @@ protected:
bool event(QEvent* event); bool event(QEvent* event);
bool eventFilter(QObject* object, QEvent* event); bool eventFilter(QObject* object, QEvent* event);
void resetContextMenuType() { m_contextMenuType = ContextMenuNone; }
}; };
#endif // INCLUDE_ROLLUPWIDGET_H #endif // INCLUDE_ROLLUPWIDGET_H