Skip to content

Commit

Permalink
Layout rework phase 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sakertooth committed Sep 25, 2024
1 parent fff10f2 commit f0fdfa1
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 206 deletions.
2 changes: 2 additions & 0 deletions plugins/SlicerT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ link_libraries(${FFTW3F_LIBRARIES})
build_plugin(slicert
SlicerT.cpp
SlicerT.h
SlicerTKnob.cpp
SlicerTKnob.h
SlicerTView.cpp
SlicerTView.h
SlicerTWaveform.cpp
Expand Down
64 changes: 64 additions & 0 deletions plugins/SlicerT/SlicerTKnob.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* SlicerTKnob.cpp
*
* Copyright (c) 2023 Daniel Kauss Serna <daniel.kauss.serna@gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#include "SlicerTKnob.h"

#include <QPaintEvent>
#include <QPainter>

namespace lmms::gui {
SlicerTKnob::SlicerTKnob(QWidget* parent)
: Knob(KnobType::Styled, parent)
{
setFixedSize(50, 20);
setCenterPointX(24.0);
setCenterPointY(15.0);
}

void SlicerTKnob::paintEvent(QPaintEvent* event)
{
auto brush = QPainter{this};
brush.translate(width() / 2.0f, height() / 2.0f);

// int kor = 15; // knob outer radius
// int kir = 9; // knob inner radius

// // draw knob backgrounds
// brush.setRenderHint(QPainter::Antialiasing);

// // draw outer radius 2 times to make smooth
// brush.setPen(QPen(QColor(159, 124, 223, 100), 4));
// brush.drawArc(QRect(kor, 0, kor * 2, kor * 2), -45 * 16, 270 * 16);

// brush.setPen(QPen(QColor(159, 124, 223, 255), 2));
// brush.drawArc(QRect(kor, 0, kor * 2, kor * 2), -45 * 16, 270 * 16);

// // inner knob circle
// brush.setBrush(QColor(106, 90, 138));
// brush.setPen(QColor(0, 0, 0, 0));
// brush.drawEllipse(QPoint(0, 15), kir, kir);

Knob::paintEvent(event);
}
} // namespace lmms::gui
40 changes: 40 additions & 0 deletions plugins/SlicerT/SlicerTKnob.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* SlicerTKnob.h
*
* Copyright (c) 2024 saker
*
* This file is part of LMMS - https://lmms.io
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef LMMS_SLICERT_KNOB_H
#define LMMS_SLICERT_KNOB_H

#include <QWidget>
#include "Knob.h"

namespace lmms::gui {
class SlicerTKnob : public Knob
{
public:
SlicerTKnob(QWidget* parent);
void paintEvent(QPaintEvent* event) override;
};
} // namespace lmms::gui

#endif // LMMS_SLICERT_KNOB_H
Loading

0 comments on commit f0fdfa1

Please sign in to comment.