Browse Source

remove near all claudia and ladish things

pull/362/head
Houston4444 2 years ago
parent
commit
2f6d2b55bb
53 changed files with 206 additions and 14983 deletions
  1. +1
    -24
      Makefile
  2. +0
    -30
      c++/patchcanvas.cpp
  3. +0
    -138
      c++/patchcanvas.hpp
  4. +0
    -63
      c++/patchcanvas/abstractcanvasline.h
  5. +0
    -162
      c++/patchcanvas/canvasbezierline.cpp
  6. +0
    -72
      c++/patchcanvas/canvasbezierline.h
  7. +0
    -104
      c++/patchcanvas/canvasbezierlinemov.cpp
  8. +0
    -60
      c++/patchcanvas/canvasbezierlinemov.h
  9. +0
    -695
      c++/patchcanvas/canvasbox.cpp
  10. +0
    -108
      c++/patchcanvas/canvasbox.h
  11. +0
    -53
      c++/patchcanvas/canvasboxshadow.cpp
  12. +0
    -45
      c++/patchcanvas/canvasboxshadow.h
  13. +0
    -79
      c++/patchcanvas/canvasfadeanimation.cpp
  14. +0
    -52
      c++/patchcanvas/canvasfadeanimation.h
  15. +0
    -134
      c++/patchcanvas/canvasicon.cpp
  16. +0
    -52
      c++/patchcanvas/canvasicon.h
  17. +0
    -148
      c++/patchcanvas/canvasline.cpp
  18. +0
    -72
      c++/patchcanvas/canvasline.h
  19. +0
    -94
      c++/patchcanvas/canvaslinemov.cpp
  20. +0
    -60
      c++/patchcanvas/canvaslinemov.h
  21. +0
    -447
      c++/patchcanvas/canvasport.cpp
  22. +0
    -79
      c++/patchcanvas/canvasport.h
  23. +0
    -38
      c++/patchcanvas/canvasportglow.cpp
  24. +0
    -35
      c++/patchcanvas/canvasportglow.h
  25. +0
    -178
      c++/patchcanvas/patchcanvas-theme.cpp
  26. +0
    -102
      c++/patchcanvas/patchcanvas-theme.h
  27. +0
    -1202
      c++/patchcanvas/patchcanvas.cpp
  28. +0
    -142
      c++/patchcanvas/patchcanvas.h
  29. +0
    -290
      c++/patchcanvas/patchscene.cpp
  30. +0
    -67
      c++/patchcanvas/patchscene.h
  31. +0
    -38
      data/claudia
  32. +0
    -38
      data/claudia-launcher
  33. +0
    -11
      data/claudia-launcher.desktop
  34. +0
    -10
      data/claudia.desktop
  35. +153
    -204
      resources/ui/cadence.ui
  36. +0
    -1518
      resources/ui/claudia.ui
  37. +0
    -88
      resources/ui/claudia_createroom.ui
  38. +0
    -2165
      resources/ui/claudia_launcher.ui
  39. +0
    -284
      resources/ui/claudia_launcher_app.ui
  40. +0
    -109
      resources/ui/claudia_projectname.ui
  41. +0
    -175
      resources/ui/claudia_projectproperties.ui
  42. +0
    -135
      resources/ui/claudia_runcustom.ui
  43. +0
    -111
      resources/ui/claudia_studiolist.ui
  44. +0
    -76
      resources/ui/claudia_studioname.ui
  45. +44
    -96
      resources/ui/logs.ui
  46. +0
    -72
      src/cadence.py
  47. +4
    -47
      src/cadence_session_start.py
  48. +0
    -2793
      src/claudia.py
  49. +0
    -627
      src/claudia_database.py
  50. +0
    -1383
      src/claudia_launcher.py
  51. +2
    -94
      src/logs.py
  52. +2
    -13
      src/shared_settings.py
  53. +0
    -71
      src/systray.py

+ 1
- 24
Makefile View File

@@ -58,7 +58,7 @@ locale/%.qm: locale/%.ts
# -----------------------------------------------------------------------------------------------------------------------------------------
# UI code

UI: cadence catarina catia claudia tools
UI: cadence catarina catia tools

cadence: src/ui_cadence.py \
src/ui_cadence_tb_jack.py src/ui_cadence_tb_alsa.py src/ui_cadence_tb_a2j.py src/ui_cadence_tb_pa.py \
@@ -71,11 +71,6 @@ catarina: src/ui_catarina.py \

catia: src/ui_catia.py

claudia: src/ui_claudia.py \
src/ui_claudia_studioname.py src/ui_claudia_studiolist.py \
src/ui_claudia_createroom.py src/ui_claudia_projectname.py src/ui_claudia_projectproperties.py \
src/ui_claudia_runcustom.py src/ui_claudia_launcher.py src/ui_claudia_launcher_app.py

tools: \
src/ui_logs.py src/ui_render.py \
src/ui_settings_app.py src/ui_settings_jack.py
@@ -128,8 +123,6 @@ install:
data/cadence-session-start \
data/catarina \
data/catia \
data/claudia \
data/claudia-launcher \
c++/jackmeter/cadence-jackmeter \
c++/xycontroller/cadence-xycontroller \
$(DESTDIR)$(PREFIX)/bin/
@@ -142,36 +135,26 @@ install:
install -m 644 resources/16x16/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
install -m 644 resources/16x16/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
install -m 644 resources/16x16/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
install -m 644 resources/16x16/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
install -m 644 resources/16x16/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/

# Install icons, 48x48
install -m 644 resources/48x48/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/
install -m 644 resources/48x48/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/
install -m 644 resources/48x48/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/
install -m 644 resources/48x48/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/
install -m 644 resources/48x48/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/

# Install icons, 128x128
install -m 644 resources/128x128/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
install -m 644 resources/128x128/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
install -m 644 resources/128x128/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
install -m 644 resources/128x128/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
install -m 644 resources/128x128/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/

# Install icons, 256x256
install -m 644 resources/256x256/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
install -m 644 resources/256x256/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
install -m 644 resources/256x256/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
install -m 644 resources/256x256/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
install -m 644 resources/256x256/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/

# Install icons, scalable
install -m 644 resources/scalable/cadence.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -m 644 resources/scalable/catarina.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -m 644 resources/scalable/catia.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -m 644 resources/scalable/claudia.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -m 644 resources/scalable/claudia-launcher.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/

# Install main code
install -m 755 src/*.py $(DESTDIR)$(PREFIX)/share/cadence/src/
@@ -187,10 +170,6 @@ install:
install -m 644 data/pulse2loopback/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2loopback/
install -m 755 data/61cadence-session-inject $(X11_RC_DIR)

# Install addtional stuff for Claudia
cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/cadence/icons/
cp -r data/templates/* $(DESTDIR)$(PREFIX)/share/cadence/templates/

# Adjust PREFIX value in script files
sed -i "s?X-PREFIX-X?$(PREFIX)?" \
$(DESTDIR)$(PREFIX)/bin/cadence \
@@ -203,8 +182,6 @@ install:
$(DESTDIR)$(PREFIX)/bin/cadence-session-start \
$(DESTDIR)$(PREFIX)/bin/catarina \
$(DESTDIR)$(PREFIX)/bin/catia \
$(DESTDIR)$(PREFIX)/bin/claudia \
$(DESTDIR)$(PREFIX)/bin/claudia-launcher \
$(X11_RC_DIR)/61cadence-session-inject

# Delete old files


+ 0
- 30
c++/patchcanvas.cpp View File

@@ -1,30 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "patchcanvas/patchcanvas.cpp"
#include "patchcanvas/patchcanvas-theme.cpp"
#include "patchcanvas/patchscene.cpp"
#include "patchcanvas/canvasbezierline.cpp"
#include "patchcanvas/canvasbezierlinemov.cpp"
#include "patchcanvas/canvasbox.cpp"
#include "patchcanvas/canvasboxshadow.cpp"
#include "patchcanvas/canvasfadeanimation.cpp"
#include "patchcanvas/canvasicon.cpp"
#include "patchcanvas/canvasline.cpp"
#include "patchcanvas/canvaslinemov.cpp"
#include "patchcanvas/canvasport.cpp"
#include "patchcanvas/canvasportglow.cpp"

+ 0
- 138
c++/patchcanvas.hpp View File

@@ -1,138 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef PATCHCANVAS_API_HPP
#define PATCHCANVAS_API_HPP

#define START_NAMESPACE_PATCHCANVAS namespace PatchCanvas {
#define END_NAMESPACE_PATCHCANVAS }

#ifndef PATCHCANVAS_ORGANISATION_NAME
# define PATCHCANVAS_ORGANISATION_NAME "PatchCanvas"
#endif

#include "patchcanvas/patchcanvas-theme.h"
#include "patchcanvas/patchscene.h"

START_NAMESPACE_PATCHCANVAS

enum PortMode {
PORT_MODE_NULL = 0,
PORT_MODE_INPUT = 1,
PORT_MODE_OUTPUT = 2
};

enum PortType {
PORT_TYPE_NULL = 0,
PORT_TYPE_AUDIO_JACK = 1,
PORT_TYPE_MIDI_JACK = 2,
PORT_TYPE_MIDI_A2J = 3,
PORT_TYPE_MIDI_ALSA = 4
};

enum CallbackAction {
ACTION_GROUP_INFO = 0, // group_id, N, N
ACTION_GROUP_RENAME = 1, // group_id, N, new_name
ACTION_GROUP_SPLIT = 2, // group_id, N, N
ACTION_GROUP_JOIN = 3, // group_id, N, N
ACTION_PORT_INFO = 4, // port_id, N, N
ACTION_PORT_RENAME = 5, // port_id, N, new_name
ACTION_PORTS_CONNECT = 6, // out_id, in_id, N
ACTION_PORTS_DISCONNECT = 7 // conn_id, N, N
};

enum Icon {
ICON_HARDWARE = 0,
ICON_APPLICATION = 1,
ICON_LADISH_ROOM = 2
};

enum SplitOption {
SPLIT_UNDEF = 0,
SPLIT_NO = 1,
SPLIT_YES = 2
};

enum AntialiasingOption {
ANTIALIASING_NONE = 0,
ANTIALIASING_SMALL = 1,
ANTIALIASING_FULL = 2
};

enum EyeCandyOption {
EYECANDY_NONE = 0,
EYECANDY_SMALL = 1,
EYECANDY_FULL = 2
};

// Canvas options
struct options_t {
QString theme_name;
bool auto_hide_groups;
bool use_bezier_lines;
AntialiasingOption antialiasing;
EyeCandyOption eyecandy;
};

// Canvas features
struct features_t {
bool group_info;
bool group_rename;
bool port_info;
bool port_rename;
bool handle_group_pos;
};

typedef void (*Callback) (CallbackAction action, int value1, int value2, QString value_str);

// API starts here
void setOptions(options_t* options);
void setFeatures(features_t* features);
void init(PatchScene* scene, Callback callback, bool debug=false);
void clear();

void setInitialPos(int x, int y);
void setCanvasSize(int x, int y, int width, int height);

void addGroup(int group_id, QString group_name, SplitOption split=SPLIT_UNDEF, Icon icon=ICON_APPLICATION);
void removeGroup(int group_id);
void renameGroup(int group_id, QString new_group_name);
void splitGroup(int group_id);
void joinGroup(int group_id);
QPointF getGroupPos(int group_id, PortMode port_mode=PORT_MODE_OUTPUT);
void setGroupPos(int group_id, int group_pos_x, int group_pos_y);
void setGroupPos(int group_id, int group_pos_x, int group_pos_y, int group_pos_xs, int group_pos_ys);
void setGroupIcon(int group_id, Icon icon);

void addPort(int group_id, int port_id, QString port_name, PortMode port_mode, PortType port_type);
void removePort(int port_id);
void renamePort(int port_id, QString new_port_name);

void connectPorts(int connection_id, int port_out_id, int port_in_id);
void disconnectPorts(int connection_id);

void arrange();
void updateZValues();

// Theme
Theme::List getDefaultTheme();
QString getThemeName(Theme::List id);
QString getDefaultThemeName();

END_NAMESPACE_PATCHCANVAS

#endif // PATCHCANVAS_API_HPP

+ 0
- 63
c++/patchcanvas/abstractcanvasline.h View File

@@ -1,63 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef ABSTRACTCANVASLINE_H
#define ABSTRACTCANVASLINE_H

#include "patchcanvas.h"

START_NAMESPACE_PATCHCANVAS

class AbstractCanvasLine
{
public:
AbstractCanvasLine() {}

virtual void deleteFromScene() = 0;

virtual bool isLocked() const = 0;
virtual void setLocked(bool yesno) = 0;

virtual bool isLineSelected() const = 0;
virtual void setLineSelected(bool yesno) = 0;

virtual void updateLinePos() = 0;

virtual int type() const = 0;

// QGraphicsItem generic calls
virtual void setZValue(qreal z) = 0;
};

class AbstractCanvasLineMov
{
public:
AbstractCanvasLineMov() {}

virtual void deleteFromScene() = 0;

virtual void updateLinePos(QPointF scenePos) = 0;

virtual int type() const = 0;

// QGraphicsItem generic calls
virtual void setZValue(qreal z) = 0;
};

END_NAMESPACE_PATCHCANVAS

#endif // ABSTRACTCANVASLINE_H

+ 0
- 162
c++/patchcanvas/canvasbezierline.cpp View File

@@ -1,162 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasbezierline.h"

#include <QtGui/QPainter>

#include "canvasport.h"
#include "canvasportglow.h"

START_NAMESPACE_PATCHCANVAS

CanvasBezierLine::CanvasBezierLine(CanvasPort* item1_, CanvasPort* item2_, QGraphicsItem* parent) :
QGraphicsPathItem(parent, canvas.scene)
{
item1 = item1_;
item2 = item2_;

m_locked = false;
m_lineSelected = false;

setBrush(QColor(0,0,0,0));
setGraphicsEffect(0);
updateLinePos();
}

CanvasBezierLine::~CanvasBezierLine()
{
setGraphicsEffect(0);
}

void CanvasBezierLine::deleteFromScene()
{
canvas.scene->removeItem(this);
delete this;
}

bool CanvasBezierLine::isLocked() const
{
return m_locked;
}

void CanvasBezierLine::setLocked(bool yesno)
{
m_locked = yesno;
}

bool CanvasBezierLine::isLineSelected() const
{
return m_lineSelected;
}

void CanvasBezierLine::setLineSelected(bool yesno)
{
if (m_locked)
return;

if (options.eyecandy == EYECANDY_FULL)
{
if (yesno)
setGraphicsEffect(new CanvasPortGlow(item1->getPortType(), toGraphicsObject()));
else
setGraphicsEffect(0);
}

m_lineSelected = yesno;
updateLineGradient();
}

void CanvasBezierLine::updateLinePos()
{
if (item1->getPortMode() == PORT_MODE_OUTPUT)
{
int item1_x = item1->scenePos().x() + item1->getPortWidth()+12;
int item1_y = item1->scenePos().y() + 7.5;

int item2_x = item2->scenePos().x();
int item2_y = item2->scenePos().y()+7.5;

int item1_mid_x = abs(item1_x-item2_x)/2;
int item1_new_x = item1_x+item1_mid_x;

int item2_mid_x = abs(item1_x-item2_x)/2;
int item2_new_x = item2_x-item2_mid_x;

QPainterPath path(QPointF(item1_x, item1_y));
path.cubicTo(item1_new_x, item1_y, item2_new_x, item2_y, item2_x, item2_y);
setPath(path);

m_lineSelected = false;
updateLineGradient();
}
}

int CanvasBezierLine::type() const
{
return CanvasBezierLineType;
}

void CanvasBezierLine::updateLineGradient()
{
short pos1, pos2;
int pos_top = boundingRect().top();
int pos_bot = boundingRect().bottom();

if (item2->scenePos().y() >= item1->scenePos().y())
{
pos1 = 0;
pos2 = 1;
}
else
{
pos1 = 1;
pos2 = 0;
}

PortType port_type1 = item1->getPortType();
PortType port_type2 = item2->getPortType();
QLinearGradient port_gradient(0, pos_top, 0, pos_bot);

if (port_type1 == PORT_TYPE_AUDIO_JACK)
port_gradient.setColorAt(pos1, m_lineSelected ? canvas.theme->line_audio_jack_sel : canvas.theme->line_audio_jack);
else if (port_type1 == PORT_TYPE_MIDI_JACK)
port_gradient.setColorAt(pos1, m_lineSelected ? canvas.theme->line_midi_jack_sel : canvas.theme->line_midi_jack);
else if (port_type1 == PORT_TYPE_MIDI_A2J)
port_gradient.setColorAt(pos1, m_lineSelected ? canvas.theme->line_midi_a2j_sel : canvas.theme->line_midi_a2j);
else if (port_type1 == PORT_TYPE_MIDI_ALSA)
port_gradient.setColorAt(pos1, m_lineSelected ? canvas.theme->line_midi_alsa_sel : canvas.theme->line_midi_alsa);

if (port_type2 == PORT_TYPE_AUDIO_JACK)
port_gradient.setColorAt(pos2, m_lineSelected ? canvas.theme->line_audio_jack_sel : canvas.theme->line_audio_jack);
else if (port_type2 == PORT_TYPE_MIDI_JACK)
port_gradient.setColorAt(pos2, m_lineSelected ? canvas.theme->line_midi_jack_sel : canvas.theme->line_midi_jack);
else if (port_type2 == PORT_TYPE_MIDI_A2J)
port_gradient.setColorAt(pos2, m_lineSelected ? canvas.theme->line_midi_a2j_sel : canvas.theme->line_midi_a2j);
else if (port_type2 == PORT_TYPE_MIDI_ALSA)
port_gradient.setColorAt(pos2, m_lineSelected ? canvas.theme->line_midi_alsa_sel : canvas.theme->line_midi_alsa);

setPen(QPen(port_gradient, 2));
}

void CanvasBezierLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
painter->setRenderHint(QPainter::Antialiasing, bool(options.antialiasing));
QGraphicsPathItem::paint(painter, option, widget);
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 72
c++/patchcanvas/canvasbezierline.h View File

@@ -1,72 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASBEZIERLINE_H
#define CANVASBEZIERLINE_H

#include <QtGui/QGraphicsPathItem>

#include "abstractcanvasline.h"

class QPainter;

START_NAMESPACE_PATCHCANVAS

class CanvasPort;
class CanvasPortGlow;

class CanvasBezierLine :
public AbstractCanvasLine,
public QGraphicsPathItem
{
public:
CanvasBezierLine(CanvasPort* item1, CanvasPort* item2, QGraphicsItem* parent);
~CanvasBezierLine();

virtual void deleteFromScene();

virtual bool isLocked() const;
virtual void setLocked(bool yesno);

virtual bool isLineSelected() const;
virtual void setLineSelected(bool yesno);

virtual void updateLinePos();

virtual int type() const;

// QGraphicsItem generic calls
virtual void setZValue(qreal z)
{
QGraphicsPathItem::setZValue(z);
}

private:
CanvasPort* item1;
CanvasPort* item2;
CanvasPortGlow* glow;
bool m_locked;
bool m_lineSelected;

void updateLineGradient();

virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASBEZIERLINE_H

+ 0
- 104
c++/patchcanvas/canvasbezierlinemov.cpp View File

@@ -1,104 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasbezierlinemov.h"

#include <QtGui/QPainter>

#include "canvasport.h"

START_NAMESPACE_PATCHCANVAS

CanvasBezierLineMov::CanvasBezierLineMov(PortMode port_mode, PortType port_type, QGraphicsItem* parent) :
QGraphicsPathItem(parent, canvas.scene)
{
m_port_mode = port_mode;
m_port_type = port_type;

// Port position doesn't change while moving around line
p_itemX = scenePos().x();
p_itemY = scenePos().y();
p_width = ((CanvasPort*)parentItem())->getPortWidth();

QPen pen;

if (port_type == PORT_TYPE_AUDIO_JACK)
pen = QPen(canvas.theme->line_audio_jack, 2);
else if (port_type == PORT_TYPE_MIDI_JACK)
pen = QPen(canvas.theme->line_midi_jack, 2);
else if (port_type == PORT_TYPE_MIDI_A2J)
pen = QPen(canvas.theme->line_midi_a2j, 2);
else if (port_type == PORT_TYPE_MIDI_ALSA)
pen = QPen(canvas.theme->line_midi_alsa, 2);
else
{
qWarning("PatchCanvas::CanvasBezierLineMov(%s, %s, %p) - invalid port type", port_mode2str(port_mode), port_type2str(port_type), parent);
pen = QPen(Qt::black);
}

QColor color(0,0,0,0);
setBrush(color);
setPen(pen);
}

void CanvasBezierLineMov::deleteFromScene()
{
canvas.scene->removeItem(this);
delete this;
}

void CanvasBezierLineMov::updateLinePos(QPointF scenePos)
{
int old_x, old_y, mid_x, new_x, final_x, final_y;

if (m_port_mode == PORT_MODE_INPUT)
{
old_x = 0;
old_y = 7.5;
mid_x = abs(scenePos.x()-p_itemX)/2;
new_x = old_x-mid_x;
}
else if (m_port_mode == PORT_MODE_OUTPUT)
{
old_x = p_width+12;
old_y = 7.5;
mid_x = abs(scenePos.x()-(p_itemX+old_x))/2;
new_x = old_x+mid_x;
}
else
return;

final_x = scenePos.x()-p_itemX;
final_y = scenePos.y()-p_itemY;

QPainterPath path(QPointF(old_x, old_y));
path.cubicTo(new_x, old_y, new_x, final_y, final_x, final_y);
setPath(path);
}

int CanvasBezierLineMov::type() const
{
return CanvasBezierLineMovType;
}

void CanvasBezierLineMov::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
painter->setRenderHint(QPainter::Antialiasing, bool(options.antialiasing));
QGraphicsPathItem::paint(painter, option, widget);
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 60
c++/patchcanvas/canvasbezierlinemov.h View File

@@ -1,60 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASBEZIERLINEMOV_H
#define CANVASBEZIERLINEMOV_H

#include <QtGui/QGraphicsPathItem>

#include "abstractcanvasline.h"

class QPainter;

START_NAMESPACE_PATCHCANVAS

class CanvasBezierLineMov :
public AbstractCanvasLineMov,
public QGraphicsPathItem
{
public:
CanvasBezierLineMov(PortMode port_mode, PortType port_type, QGraphicsItem* parent);

virtual void deleteFromScene();

virtual void updateLinePos(QPointF scenePos);

virtual int type() const;

// QGraphicsItem generic calls
virtual void setZValue(qreal z)
{
QGraphicsPathItem::setZValue(z);
}

private:
PortMode m_port_mode;
PortType m_port_type;
int p_itemX;
int p_itemY;
int p_width;

virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASBEZIERLINEMOV_H

+ 0
- 695
c++/patchcanvas/canvasbox.cpp View File

@@ -1,695 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasbox.h"

#include <QtCore/QTimer>
#include <QtGui/QCursor>
#include <QtGui/QInputDialog>
#include <QtGui/QMenu>
#include <QtGui/QGraphicsSceneContextMenuEvent>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <QtGui/QPainter>

#include "canvasline.h"
#include "canvasbezierline.h"
#include "canvasport.h"
#include "canvasboxshadow.h"
#include "canvasicon.h"

START_NAMESPACE_PATCHCANVAS

CanvasBox::CanvasBox(int group_id, QString group_name, Icon icon, QGraphicsItem* parent) :
QGraphicsItem(parent, canvas.scene)
{
// Save Variables, useful for later
m_group_id = group_id;
m_group_name = group_name;

// Base Variables
p_width = 50;
p_height = 25;

m_last_pos = QPointF();
m_splitted = false;
m_splitted_mode = PORT_MODE_NULL;

m_cursor_moving = false;
m_forced_split = false;
m_mouse_down = false;

m_port_list_ids.clear();
m_connection_lines.clear();

// Set Font
m_font_name = QFont(canvas.theme->box_font_name, canvas.theme->box_font_size, canvas.theme->box_font_state);
m_font_port = QFont(canvas.theme->port_font_name, canvas.theme->port_font_size, canvas.theme->port_font_state);

// Icon
icon_svg = new CanvasIcon(icon, group_name, this);

// Shadow
if (options.eyecandy)
{
shadow = new CanvasBoxShadow(toGraphicsObject());
shadow->setFakeParent(this);
setGraphicsEffect(shadow);
}
else
shadow = 0;

// Final touches
setFlags(QGraphicsItem::ItemIsMovable|QGraphicsItem::ItemIsSelectable);

// Wait for at least 1 port
if (options.auto_hide_groups)
setVisible(false);

updatePositions();
}

CanvasBox::~CanvasBox()
{
if (shadow)
delete shadow;
delete icon_svg;
}

int CanvasBox::getGroupId()
{
return m_group_id;
}

QString CanvasBox::getGroupName()
{
return m_group_name;
}

bool CanvasBox::isSplitted()
{
return m_splitted;
}

PortMode CanvasBox::getSplittedMode()
{
return m_splitted_mode;
}

int CanvasBox::getPortCount()
{
return m_port_list_ids.count();
}

QList<int> CanvasBox::getPortList()
{
return m_port_list_ids;
}

void CanvasBox::setIcon(Icon icon)
{
icon_svg->setIcon(icon, m_group_name);
}

void CanvasBox::setSplit(bool split, PortMode mode)
{
m_splitted = split;
m_splitted_mode = mode;
}

void CanvasBox::setGroupName(QString group_name)
{
m_group_name = group_name;
updatePositions();
}

void CanvasBox::setShadowOpacity(float opacity)
{
if (shadow)
shadow->setOpacity(opacity);
}

CanvasPort* CanvasBox::addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type)
{
if (m_port_list_ids.count() == 0)
{
if (options.auto_hide_groups)
{
if (options.eyecandy == EYECANDY_FULL)
CanvasItemFX(this, true);
setVisible(true);
}
}

CanvasPort* new_widget = new CanvasPort(port_id, port_name, port_mode, port_type, this);

port_dict_t port_dict;
port_dict.group_id = m_group_id;
port_dict.port_id = port_id;
port_dict.port_name = port_name;
port_dict.port_mode = port_mode;
port_dict.port_type = port_type;
port_dict.widget = new_widget;

m_port_list_ids.append(port_id);

return new_widget;
}

void CanvasBox::removePortFromGroup(int port_id)
{
if (m_port_list_ids.contains(port_id))
{
m_port_list_ids.removeOne(port_id);
}
else
{
qCritical("PatchCanvas::CanvasBox->removePort(%i) - unable to find port to remove", port_id);
return;
}

if (m_port_list_ids.count() > 0)
{
updatePositions();
}
else if (isVisible())
{
if (options.auto_hide_groups)
{
if (options.eyecandy == EYECANDY_FULL)
CanvasItemFX(this, false);
else
setVisible(false);
}
}
}

void CanvasBox::addLineFromGroup(AbstractCanvasLine* line, int connection_id)
{
cb_line_t new_cbline;
new_cbline.line = line;
new_cbline.connection_id = connection_id;
m_connection_lines.append(new_cbline);
}

void CanvasBox::removeLineFromGroup(int connection_id)
{
foreach2 (const cb_line_t& connection, m_connection_lines)
if (connection.connection_id == connection_id)
{
m_connection_lines.takeAt(i);
return;
}
}

qCritical("PatchCanvas::CanvasBox->removeLineFromGroup(%i) - unable to find line to remove", connection_id);
}

void CanvasBox::checkItemPos()
{
if (canvas.size_rect.isNull() == false)
{
QPointF pos = scenePos();
if (canvas.size_rect.contains(pos) == false || canvas.size_rect.contains(pos+QPointF(p_width, p_height)) == false)
{
if (pos.x() < canvas.size_rect.x())
setPos(canvas.size_rect.x(), pos.y());
else if (pos.x()+p_width > canvas.size_rect.width())
setPos(canvas.size_rect.width()-p_width, pos.y());

pos = scenePos();
if (pos.y() < canvas.size_rect.y())
setPos(pos.x(), canvas.size_rect.y());
else if (pos.y()+p_height > canvas.size_rect.height())
setPos(pos.x(), canvas.size_rect.height()-p_height);
}
}
}

void CanvasBox::removeIconFromScene()
{
canvas.scene->removeItem(icon_svg);
}

void CanvasBox::updatePositions()
{
prepareGeometryChange();

int max_in_width = 0;
int max_in_height = 24;
int max_out_width = 0;
int max_out_height = 24;
bool have_audio_jack_in, have_audio_jack_out, have_midi_jack_in, have_midi_jack_out;
bool have_midi_a2j_in, have_midi_a2j_out, have_midi_alsa_in, have_midi_alsa_out;
have_audio_jack_in = have_midi_jack_in = have_midi_a2j_in = have_midi_alsa_in = false;
have_audio_jack_out = have_midi_jack_out = have_midi_a2j_out = have_midi_alsa_out = false;

// reset box size
p_width = 50;
p_height = 25;

// Check Text Name size
int app_name_size = QFontMetrics(m_font_name).width(m_group_name)+30;
if (app_name_size > p_width)
p_width = app_name_size;

// Get Port List
QList<port_dict_t> port_list;
foreach (const port_dict_t& port, canvas.port_list)
{
if (m_port_list_ids.contains(port.port_id))
port_list.append(port);
}

// Get Max Box Width/Height
foreach (const port_dict_t& port, port_list)
{
if (port.port_mode == PORT_MODE_INPUT)
{
max_in_height += 18;

int size = QFontMetrics(m_font_port).width(port.port_name);
if (size > max_in_width)
max_in_width = size;

if (port.port_type == PORT_TYPE_AUDIO_JACK && have_audio_jack_in == false)
{
have_audio_jack_in = true;
max_in_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_JACK && have_midi_jack_in == false)
{
have_midi_jack_in = true;
max_in_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_A2J && have_midi_a2j_in == false)
{
have_midi_a2j_in = true;
max_in_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_ALSA && have_midi_alsa_in == false)
{
have_midi_alsa_in = true;
max_in_height += 2;
}
}
else if (port.port_mode == PORT_MODE_OUTPUT)
{
max_out_height += 18;

int size = QFontMetrics(m_font_port).width(port.port_name);
if (size > max_out_width)
max_out_width = size;

if (port.port_type == PORT_TYPE_AUDIO_JACK && have_audio_jack_out == false)
{
have_audio_jack_out = true;
max_out_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_JACK && have_midi_jack_out == false)
{
have_midi_jack_out = true;
max_out_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_A2J && have_midi_a2j_out == false)
{
have_midi_a2j_out = true;
max_out_height += 2;
}
else if (port.port_type == PORT_TYPE_MIDI_ALSA && have_midi_alsa_out == false)
{
have_midi_alsa_out = true;
max_out_height += 2;
}
}
}

int final_width = 30 + max_in_width + max_out_width;
if (final_width > p_width)
p_width = final_width;

if (max_in_height > p_height)
p_height = max_in_height;

if (max_out_height > p_height)
p_height = max_out_height;

// Remove bottom space
p_height -= 2;

int last_in_pos = 24;
int last_out_pos = 24;
PortType last_in_type = PORT_TYPE_NULL;
PortType last_out_type = PORT_TYPE_NULL;

// Re-position ports, AUDIO_JACK
foreach (const port_dict_t& port, port_list)
{
if (port.port_type == PORT_TYPE_AUDIO_JACK)
{
if (port.port_mode == PORT_MODE_INPUT)
{
port.widget->setPos(QPointF(1, last_in_pos));
port.widget->setPortWidth(max_in_width);

last_in_pos += 18;
last_in_type = port.port_type;
}
else if (port.port_mode == PORT_MODE_OUTPUT)
{
port.widget->setPos(QPointF(p_width-max_out_width-13, last_out_pos));
port.widget->setPortWidth(max_out_width);

last_out_pos += 18;
last_out_type = port.port_type;
}
}
}

// Re-position ports, MIDI_JACK
foreach (const port_dict_t& port, port_list)
{
if (port.port_type == PORT_TYPE_MIDI_JACK)
{
if (port.port_mode == PORT_MODE_INPUT)
{
if (last_in_type != PORT_TYPE_NULL && port.port_type != last_in_type)
last_in_pos += 2;

port.widget->setPos(QPointF(1, last_in_pos));
port.widget->setPortWidth(max_in_width);

last_in_pos += 18;
last_in_type = port.port_type;
}
else if (port.port_mode == PORT_MODE_OUTPUT)
{
if (last_out_type != PORT_TYPE_NULL && port.port_type != last_out_type)
last_out_pos += 2;

port.widget->setPos(QPointF(p_width-max_out_width-13, last_out_pos));
port.widget->setPortWidth(max_out_width);

last_out_pos += 18;
last_out_type = port.port_type;
}
}
}

// Re-position ports, MIDI_A2J
foreach (const port_dict_t& port, port_list)
{
if (port.port_type == PORT_TYPE_MIDI_A2J)
{
if (port.port_mode == PORT_MODE_INPUT)
{
if (last_in_type != PORT_TYPE_NULL && port.port_type != last_in_type)
last_in_pos += 2;

port.widget->setPos(QPointF(1, last_in_pos));
port.widget->setPortWidth(max_in_width);

last_in_pos += 18;
last_in_type = port.port_type;
}
else if (port.port_mode == PORT_MODE_OUTPUT)
{
if (last_out_type != PORT_TYPE_NULL && port.port_type != last_out_type)
last_out_pos += 2;

port.widget->setPos(QPointF(p_width-max_out_width-13, last_out_pos));
port.widget->setPortWidth(max_out_width);

last_out_pos += 18;
last_out_type = port.port_type;
}
}
}

// Re-position ports, MIDI_ALSA
foreach (const port_dict_t& port, port_list)
{
if (port.port_type == PORT_TYPE_MIDI_ALSA)
{
if (port.port_mode == PORT_MODE_INPUT)
{
if (last_in_type != PORT_TYPE_NULL && port.port_type != last_in_type)
last_in_pos += 2;

port.widget->setPos(QPointF(1, last_in_pos));
port.widget->setPortWidth(max_in_width);

last_in_pos += 18;
last_in_type = port.port_type;
}
else if (port.port_mode == PORT_MODE_OUTPUT)
{
if (last_out_type != PORT_TYPE_NULL && port.port_type != last_out_type)
last_out_pos += 2;

port.widget->setPos(QPointF(p_width-max_out_width-13, last_out_pos));
port.widget->setPortWidth(max_out_width);

last_out_pos += 18;
last_out_type = port.port_type;
}
}
}

repaintLines(true);
update();
}

void CanvasBox::repaintLines(bool forced)
{
if (pos() != m_last_pos || forced)
{
foreach (const cb_line_t& connection, m_connection_lines)
connection.line->updateLinePos();
}

m_last_pos = pos();
}

void CanvasBox::resetLinesZValue()
{
foreach (const connection_dict_t& connection, canvas.connection_list)
{
int z_value;
if (m_port_list_ids.contains(connection.port_out_id) && m_port_list_ids.contains(connection.port_in_id))
z_value = canvas.last_z_value;
else
z_value = canvas.last_z_value-1;

connection.widget->setZValue(z_value);
}
}

int CanvasBox::type() const
{
return CanvasBoxType;
}

void CanvasBox::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
{
QMenu menu;
QMenu discMenu("Disconnect", &menu);

QList<int> port_con_list;
QList<int> port_con_list_ids;

foreach (const int& port_id, m_port_list_ids)
{
QList<int> tmp_port_con_list = CanvasGetPortConnectionList(port_id);
foreach (const int& port_con_id, tmp_port_con_list)
{
if (port_con_list.contains(port_con_id) == false)
{
port_con_list.append(port_con_id);
port_con_list_ids.append(port_id);
}
}
}

if (port_con_list.count() > 0)
{
for (int i=0; i < port_con_list.count(); i++)
{
int port_con_id = CanvasGetConnectedPort(port_con_list[i], port_con_list_ids[i]);
QAction* act_x_disc = discMenu.addAction(CanvasGetFullPortName(port_con_id));
act_x_disc->setData(port_con_list[i]);
QObject::connect(act_x_disc, SIGNAL(triggered()), canvas.qobject, SLOT(PortContextMenuDisconnect()));
}
}
else
{
QAction* act_x_disc = discMenu.addAction("No connections");
act_x_disc->setEnabled(false);
}

menu.addMenu(&discMenu);
QAction* act_x_disc_all = menu.addAction("Disconnect &All");
QAction* act_x_sep1 = menu.addSeparator();
QAction* act_x_info = menu.addAction("&Info");
QAction* act_x_rename = menu.addAction("&Rename");
QAction* act_x_sep2 = menu.addSeparator();
QAction* act_x_split_join = menu.addAction(m_splitted ? "Join" : "Split");

if (features.group_info == false)
act_x_info->setVisible(false);

if (features.group_rename == false)
act_x_rename->setVisible(false);

if (features.group_info == false && features.group_rename == false)
act_x_sep1->setVisible(false);

bool haveIns, haveOuts;
haveIns = haveOuts = false;
foreach (const port_dict_t& port, canvas.port_list)
{
if (m_port_list_ids.contains(port.port_id))
{
if (port.port_mode == PORT_MODE_INPUT)
haveIns = true;
else if (port.port_mode == PORT_MODE_OUTPUT)
haveOuts = true;
}
}

if (m_splitted == false && (haveIns && haveOuts) == false)
{
act_x_sep2->setVisible(false);
act_x_split_join->setVisible(false);
}

QAction* act_selected = menu.exec(event->screenPos());

if (act_selected == act_x_disc_all)
{
foreach (const int& port_id, port_con_list)
canvas.callback(ACTION_PORTS_DISCONNECT, port_id, 0, "");
}
else if (act_selected == act_x_info)
{
canvas.callback(ACTION_GROUP_INFO, m_group_id, 0, "");
}
else if (act_selected == act_x_rename)
{
bool ok_check;
QString new_name = QInputDialog::getText(0, "Rename Group", "New name:", QLineEdit::Normal, m_group_name, &ok_check);
if (ok_check and !new_name.isEmpty())
{
canvas.callback(ACTION_GROUP_RENAME, m_group_id, 0, new_name);
}
}
else if (act_selected == act_x_split_join)
{
if (m_splitted)
canvas.callback(ACTION_GROUP_JOIN, m_group_id, 0, "");
else
canvas.callback(ACTION_GROUP_SPLIT, m_group_id, 0, "");

}

event->accept();
}

void CanvasBox::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
canvas.last_z_value += 1;
setZValue(canvas.last_z_value);
resetLinesZValue();
m_cursor_moving = false;

if (event->button() == Qt::RightButton)
{
canvas.scene->clearSelection();
setSelected(true);
m_mouse_down = false;
return event->accept();
}
else if (event->button() == Qt::LeftButton)
{
if (sceneBoundingRect().contains(event->scenePos()))
m_mouse_down = true;
else
{
// Fixes a weird Qt behaviour with right-click mouseMove
m_mouse_down = false;
return event->ignore();
}
}
else
m_mouse_down = false;

QGraphicsItem::mousePressEvent(event);
}

void CanvasBox::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
if (m_mouse_down)
{
if (m_cursor_moving == false)
{
setCursor(QCursor(Qt::SizeAllCursor));
m_cursor_moving = true;
}
repaintLines();
}
QGraphicsItem::mouseMoveEvent(event);
}

void CanvasBox::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
if (m_cursor_moving)
setCursor(QCursor(Qt::ArrowCursor));
m_mouse_down = false;
m_cursor_moving = false;
QGraphicsItem::mouseReleaseEvent(event);
}

QRectF CanvasBox::boundingRect() const
{
return QRectF(0, 0, p_width, p_height);
}

void CanvasBox::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/)
{
painter->setRenderHint(QPainter::Antialiasing, false);

if (isSelected())
painter->setPen(canvas.theme->box_pen_sel);
else
painter->setPen(canvas.theme->box_pen);

QLinearGradient box_gradient(0, 0, 0, p_height);
box_gradient.setColorAt(0, canvas.theme->box_bg_1);
box_gradient.setColorAt(1, canvas.theme->box_bg_2);

painter->setBrush(box_gradient);
painter->drawRect(0, 0, p_width, p_height);

QPointF text_pos(25, 16);

painter->setFont(m_font_name);
painter->setPen(canvas.theme->box_text);
painter->drawText(text_pos, m_group_name);

repaintLines();
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 108
c++/patchcanvas/canvasbox.h View File

@@ -1,108 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASBOX_H
#define CANVASBOX_H

#include "patchcanvas.h"

class QGraphicsSceneContextMenuEvent;
class QGraphicsSceneMouseEvent;
class QPainter;

START_NAMESPACE_PATCHCANVAS

class AbstractCanvasLine;
class CanvasBoxShadow;
class CanvasPort;
class CanvasIcon;

struct cb_line_t {
AbstractCanvasLine* line;
int connection_id;
};

class CanvasBox : public QGraphicsItem
{
public:
CanvasBox(int group_id, QString group_name, Icon icon, QGraphicsItem* parent=0);
virtual ~CanvasBox();

int getGroupId();
QString getGroupName();
bool isSplitted();
PortMode getSplittedMode();

int getPortCount();
QList<int> getPortList();

void setIcon(Icon icon);
void setSplit(bool split, PortMode mode=PORT_MODE_NULL);
void setGroupName(QString group_name);

void setShadowOpacity(float opacity);

CanvasPort* addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type);
void removePortFromGroup(int port_id);
void addLineFromGroup(AbstractCanvasLine* line, int connection_id);
void removeLineFromGroup(int connection_id);

void checkItemPos();
void removeIconFromScene();

void updatePositions();
void repaintLines(bool forced=false);
void resetLinesZValue();

virtual int type() const;

private:
int m_group_id;
QString m_group_name;

int p_width;
int p_height;

QList<int> m_port_list_ids;
QList<cb_line_t> m_connection_lines;

QPointF m_last_pos;
bool m_splitted;
PortMode m_splitted_mode;

bool m_forced_split;
bool m_cursor_moving;
bool m_mouse_down;

QFont m_font_name;
QFont m_font_port;

CanvasIcon* icon_svg;
CanvasBoxShadow* shadow;

virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);

virtual QRectF boundingRect() const;
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASBOX_H

+ 0
- 53
c++/patchcanvas/canvasboxshadow.cpp View File

@@ -1,53 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasboxshadow.h"

#include "canvasbox.h"

START_NAMESPACE_PATCHCANVAS

CanvasBoxShadow::CanvasBoxShadow(QObject* parent) :
QGraphicsDropShadowEffect(parent)
{
m_fakeParent = 0;

setBlurRadius(20);
setColor(canvas.theme->box_shadow);
setOffset(0, 0);
}

void CanvasBoxShadow::setFakeParent(CanvasBox* fakeParent)
{
m_fakeParent = fakeParent;
}

void CanvasBoxShadow::setOpacity(float opacity)
{
QColor color(canvas.theme->box_shadow);
color.setAlphaF(opacity);
setColor(color);
}

void CanvasBoxShadow::draw(QPainter* painter)
{
if (m_fakeParent)
m_fakeParent->repaintLines();
QGraphicsDropShadowEffect::draw(painter);
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 45
c++/patchcanvas/canvasboxshadow.h View File

@@ -1,45 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASBOXSHADOW_H
#define CANVASBOXSHADOW_H

#include <QGraphicsDropShadowEffect>

#include "patchcanvas.h"

START_NAMESPACE_PATCHCANVAS

class CanvasBox;

class CanvasBoxShadow : public QGraphicsDropShadowEffect
{
public:
CanvasBoxShadow(QObject* parent);
void setFakeParent(CanvasBox* fakeParent);
void setOpacity(float opacity);

protected:
virtual void draw(QPainter* painter);

private:
CanvasBox* m_fakeParent;
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASBOXSHADOW_H

+ 0
- 79
c++/patchcanvas/canvasfadeanimation.cpp View File

@@ -1,79 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasfadeanimation.h"

#include "canvasbox.h"

START_NAMESPACE_PATCHCANVAS

CanvasFadeAnimation::CanvasFadeAnimation(QGraphicsItem* item, bool show, QObject* parent) :
QAbstractAnimation(parent)
{
m_show = show;
m_duration = 0;
m_item = item;
}

QGraphicsItem* CanvasFadeAnimation::item()
{
return m_item;
}

void CanvasFadeAnimation::setDuration(int time)
{
if (m_show == false && m_item->opacity() == 0.0)
m_duration = 0;
else
{
m_item->show();
m_duration = time;
}
}

int CanvasFadeAnimation::duration() const
{
return m_duration;
}

void CanvasFadeAnimation::updateCurrentTime(int time)
{
if (m_duration == 0)
return;

float value;

if (m_show)
value = float(time)/m_duration;
else
value = 1.0-(float(time)/m_duration);

m_item->setOpacity(value);

if (m_item->type() == CanvasBoxType)
((CanvasBox*)m_item)->setShadowOpacity(value);
}

void CanvasFadeAnimation::updateState(QAbstractAnimation::State /*newState*/, QAbstractAnimation::State /*oldState*/)
{
}

void CanvasFadeAnimation::updateDirection(QAbstractAnimation::Direction /*direction*/)
{
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 52
c++/patchcanvas/canvasfadeanimation.h View File

@@ -1,52 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASFADEANIMATION_H
#define CANVASFADEANIMATION_H

#include <QtCore/QAbstractAnimation>

#include "patchcanvas.h"

class QGraphicsItem;

START_NAMESPACE_PATCHCANVAS

class CanvasFadeAnimation : public QAbstractAnimation
{
public:
CanvasFadeAnimation(QGraphicsItem* item, bool show, QObject* parent=0);

QGraphicsItem* item();
void setDuration(int time);

virtual int duration() const;

protected:
virtual void updateCurrentTime(int time);
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
virtual void updateDirection(QAbstractAnimation::Direction direction);

private:
bool m_show;
int m_duration;
QGraphicsItem* m_item;
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASFADEANIMATION_H

+ 0
- 134
c++/patchcanvas/canvasicon.cpp View File

@@ -1,134 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasicon.h"

#include <QtGui/QPainter>
#include <QtGui/QGraphicsColorizeEffect>
#include <QtSvg/QSvgRenderer>

START_NAMESPACE_PATCHCANVAS

CanvasIcon::CanvasIcon(Icon icon, QString name, QGraphicsItem* parent) :
QGraphicsSvgItem(parent)
{
m_renderer = 0;
p_size = QRectF(0, 0, 0, 0);

m_colorFX = new QGraphicsColorizeEffect(this);
m_colorFX->setColor(canvas.theme->box_text.color());

setGraphicsEffect(m_colorFX);
setIcon(icon, name);
}

CanvasIcon::~CanvasIcon()
{
if (m_renderer)
delete m_renderer;
delete m_colorFX;
}

void CanvasIcon::setIcon(Icon icon, QString name)
{
name = name.toLower();
QString icon_path;

if (icon == ICON_APPLICATION)
{
p_size = QRectF(3, 2, 19, 18);

if (name.contains("audacious"))
{
p_size = QRectF(5, 4, 16, 16);
icon_path = ":/scalable/pb_audacious.svg";
}
else if (name.contains("clementine"))
{
p_size = QRectF(5, 4, 16, 16);
icon_path = ":/scalable/pb_clementine.svg";
}
else if (name.contains("jamin"))
{
p_size = QRectF(5, 3, 16, 16);
icon_path = ":/scalable/pb_jamin.svg";
}
else if (name.contains("mplayer"))
{
p_size = QRectF(5, 4, 16, 16);
icon_path = ":/scalable/pb_mplayer.svg";
}
else if (name.contains("vlc"))
{
p_size = QRectF(5, 3, 16, 16);
icon_path = ":/scalable/pb_vlc.svg";
}
else
{
p_size = QRectF(5, 3, 16, 16);
icon_path = ":/scalable/pb_generic.svg";
}
}
else if (icon == ICON_HARDWARE)
{
p_size = QRectF(5, 2, 16, 16);
icon_path = ":/scalable/pb_hardware.svg";

}
else if (icon == ICON_LADISH_ROOM)
{
p_size = QRectF(5, 2, 16, 16);
icon_path = ":/scalable/pb_hardware.svg";
}
else
{
p_size = QRectF(0, 0, 0, 0);
qCritical("PatchCanvas::CanvasIcon->setIcon(%s, %s) - unsupported Icon requested", icon2str(icon), name.toUtf8().constData());
return;
}

if (m_renderer)
delete m_renderer;

m_renderer = new QSvgRenderer(icon_path, canvas.scene);
setSharedRenderer(m_renderer);
update();
}

int CanvasIcon::type() const
{
return CanvasIconType;
}

QRectF CanvasIcon::boundingRect() const
{
return p_size;
}

void CanvasIcon::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
if (m_renderer)
{
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setRenderHint(QPainter::TextAntialiasing, false);
m_renderer->render(painter, p_size);
}
else
QGraphicsSvgItem::paint(painter, option, widget);
}

END_NAMESPACE_PATCHCANVAS

+ 0
- 52
c++/patchcanvas/canvasicon.h View File

@@ -1,52 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CANVASICON_H
#define CANVASICON_H

#include <QtSvg/QGraphicsSvgItem>

#include "patchcanvas.h"

class QPainter;
class QGraphicsColorizeEffect;
class QSvgRenderer;

START_NAMESPACE_PATCHCANVAS

class CanvasIcon : public QGraphicsSvgItem
{
public:
CanvasIcon(Icon icon, QString name, QGraphicsItem* parent);
~CanvasIcon();

void setIcon(Icon icon, QString name);

virtual int type() const;

private:
QGraphicsColorizeEffect* m_colorFX;
QSvgRenderer* m_renderer;
QRectF p_size;

virtual QRectF boundingRect() const;
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
};

END_NAMESPACE_PATCHCANVAS

#endif // CANVASICON_H

+ 0
- 148
c++/patchcanvas/canvasline.cpp View File

@@ -1,148 +0,0 @@
/*
* Patchbay Canvas engine using QGraphicsView/Scene
* Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "canvasline.h"

#include <QtGui/QPainter>

#include "canvasport.h"
#include "canvasportglow.h"

START_NAMESPACE_PATCHCANVAS

CanvasLine::CanvasLine(CanvasPort* item1_, CanvasPort* item2_, QGraphicsItem* parent) :
QGraphicsLineItem(parent, canvas.scene)
{
item1 = item1_;
item2 = item2_;

m_locked = false;
m_lineSelected = false;

setGraphicsEffect(0);
updateLinePos();
}

CanvasLine::~CanvasLine()
{
setGraphicsEffect(0);
}

void CanvasLine::deleteFromScene()
{
canvas.scene->removeItem(this);
delete this;
}

bool CanvasLine::isLocked() const
{
return m_locked;
}

void CanvasLine::setLocked(bool yesno)
{
m_locked = yesno;
}

bool CanvasLine::isLineSelected() const
{
return m_lineSelected;
}

void CanvasLine::setLineSelected(bool yesno)
{
if (m_locked)
return;

if (options.eyecandy == EYECANDY_FULL)
{
if (yesno)
setGraphicsEffect(new CanvasPortGlow(item1->getPortType(), toGraphicsObject()));
else
setGraphicsEffect(0);
}

m_lineSelected = yesno;
updateLineGradient();
}

void CanvasLine::updateLinePos()
{
if (item1->getPortMode() == PORT_MODE_OUTPUT)
{
QLineF line(item1->scenePos().x() + item1->getPortWidth()+12, item1->scenePos().y()+7.5, item2->scenePos().x(), item2->scenePos().y()+7.5);
setLine(line);

m_lineSelected = false;
updateLineGradient();
}
}

int CanvasLine::type() const
{
return CanvasLineType;
}

void CanvasLine::updateLineGradient()
{
short pos1, pos2;
int pos_top = boundingRect().top();
int pos_bot = boundingRect().bottom();

if (item2->scenePos().y() >= item1->scenePos().y())
{
pos1 = 0;
pos2 = 1;
}
else
{
pos1 = 1;
pos2 = 0;