Skip to content

Commit 1909867

Browse files
committed
Use the official Syphon icon in the GUI
Replace the drawn placeholder glyph with Syphon's own icon (from Syphon-Framework, BSD 2-Clause) for the "Add Syphon Source" toolbar/menu action and for Syphon source items in the source list. Vendored as a Qt resource (:/add-syphon).
1 parent 29529c7 commit 1909867

5 files changed

Lines changed: 5 additions & 35 deletions

File tree

resources/images/icons/syphon.png

141 KB
Loading

resources/interface.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<file alias="add-video">images/icons/add_movie_w.png</file>
1111
<file alias="add-camera">images/icons/add_camera_w.png</file>
1212
<file alias="add-color">images/icons/add_paint_w.png</file>
13+
<file alias="add-syphon">images/icons/syphon.png</file>
1314
<file alias="add-mesh">images/shapes/add_quad.png</file>
1415
<file alias="add-triangle">images/shapes/add_triangle.png</file>
1516
<file alias="add-ellipse">images/shapes/add_circle.png</file>

src/core/Syphon.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ class Syphon : public Texture
125125
/// Lists the Syphon servers currently available on the system.
126126
static QList<SyphonServerDescription> availableServers();
127127

128-
/// Builds the default Syphon glyph icon (drawn, no binary asset required).
129-
static QIcon defaultIcon(int size, const QColor& color);
130-
131128
signals:
132129
/// Emitted once, the first time a real frame resolution becomes known, so the
133130
/// UI can fit input shapes created before any frame had arrived.

src/core/SyphonImpl.mm

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434

3535
#include "MM.h"
3636

37-
#include <QPainter>
38-
#include <QPixmap>
39-
#include <QFont>
37+
#include <QIcon>
38+
#include <QImage>
4039
#include <QDebug>
4140

4241
#import <Foundation/Foundation.h>
@@ -428,36 +427,9 @@ void teardown()
428427
return SyphonImpl::availableServers();
429428
}
430429

431-
QIcon Syphon::defaultIcon(int size, const QColor& color)
432-
{
433-
QPixmap pixmap(size, size);
434-
pixmap.fill(Qt::transparent);
435-
436-
QPainter p(&pixmap);
437-
p.setRenderHint(QPainter::Antialiasing, true);
438-
439-
// Rounded square outline.
440-
QPen pen(color);
441-
pen.setWidthF(qMax(1.0, size / 16.0));
442-
p.setPen(pen);
443-
const qreal m = size * 0.12;
444-
const qreal r = size * 0.18;
445-
p.drawRoundedRect(QRectF(m, m, size - 2 * m, size - 2 * m), r, r);
446-
447-
// "S" glyph for Syphon.
448-
QFont font = p.font();
449-
font.setBold(true);
450-
font.setPixelSize(int(size * 0.6));
451-
p.setFont(font);
452-
p.drawText(pixmap.rect(), Qt::AlignCenter, QStringLiteral("S"));
453-
p.end();
454-
455-
return QIcon(pixmap);
456-
}
457-
458430
QIcon Syphon::getIcon() const
459431
{
460-
return defaultIcon(MM::MAPPING_LIST_ICON_SIZE, QColor(220, 220, 220));
432+
return QIcon(":/add-syphon");
461433
}
462434

463435
}

src/gui/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ void MainWindow::createActions()
18921892
// Add Syphon source (macOS only).
18931893
addSyphonAction = new QAction(tr("Add &Syphon Source..."), this);
18941894
addSyphonAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Y);
1895-
addSyphonAction->setIcon(Syphon::defaultIcon(24, QColor(230, 230, 230)));
1895+
addSyphonAction->setIcon(QIcon(":/add-syphon"));
18961896
addSyphonAction->setToolTip(tr("Receive live video from another application via Syphon..."));
18971897
addSyphonAction->setIconVisibleInMenu(false);
18981898
addSyphonAction->setShortcutContext(Qt::ApplicationShortcut);

0 commit comments

Comments
 (0)