mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Add a proper flux component.
This commit is contained in:
@@ -47,6 +47,7 @@ cxxprogram(
|
||||
"./mainwindow.cc",
|
||||
"./drivecomponent.cc",
|
||||
"./formatcomponent.cc",
|
||||
"./fluxcomponent.cc",
|
||||
"./fluxvisualiserwidget.cc",
|
||||
"./globals.h",
|
||||
"./mainwindow.h",
|
||||
|
||||
32
src/gui2/fluxcomponent.cc
Normal file
32
src/gui2/fluxcomponent.cc
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "lib/globals.h"
|
||||
#include "lib/usb/usbfinder.h"
|
||||
#include "globals.h"
|
||||
#include "fluxcomponent.h"
|
||||
#include "mainwindow.h"
|
||||
#include "fluxvisualiserwidget.h"
|
||||
|
||||
class FluxComponentImpl : public FluxComponent, public QObject
|
||||
{
|
||||
W_OBJECT(FluxComponentImpl)
|
||||
|
||||
public:
|
||||
FluxComponentImpl(MainWindow* mainWindow): _mainWindow(mainWindow)
|
||||
{
|
||||
setParent(mainWindow);
|
||||
|
||||
_fluxVisualiserWidget = FluxVisualiserWidget::create();
|
||||
_mainWindow->fluxViewContainer->layout()->addWidget(
|
||||
_fluxVisualiserWidget);
|
||||
_fluxVisualiserWidget->refresh();
|
||||
}
|
||||
|
||||
private:
|
||||
MainWindow* _mainWindow;
|
||||
FluxVisualiserWidget* _fluxVisualiserWidget;
|
||||
};
|
||||
W_OBJECT_IMPL(FluxComponentImpl)
|
||||
|
||||
FluxComponent* FluxComponent::create(MainWindow* mainWindow)
|
||||
{
|
||||
return new FluxComponentImpl(mainWindow);
|
||||
}
|
||||
9
src/gui2/fluxcomponent.h
Normal file
9
src/gui2/fluxcomponent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class FluxComponent
|
||||
{
|
||||
public:
|
||||
static FluxComponent* create(MainWindow* mainWindow);
|
||||
};
|
||||
@@ -60,9 +60,10 @@ public:
|
||||
_scene->clear();
|
||||
|
||||
drawSide(VOUTER_RADIUS, VOUTER_RADIUS);
|
||||
drawSide(VOUTER_RADIUS, VOUTER_RADIUS*3 + VBORDER);
|
||||
drawSide(VOUTER_RADIUS, VOUTER_RADIUS * 3 + VBORDER);
|
||||
|
||||
_scene->setSceneRect(0.0, 0.0, VOUTER_RADIUS*2, VOUTER_RADIUS*4 + VBORDER);
|
||||
_scene->setSceneRect(
|
||||
0.0, 0.0, VOUTER_RADIUS * 2, VOUTER_RADIUS * 4 + VBORDER);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -72,10 +73,10 @@ private:
|
||||
black.setWidth(0);
|
||||
|
||||
float step = (VOUTER_RADIUS - VINNER_RADIUS) / TRACKS;
|
||||
for (int track = 0; track<82; track++)
|
||||
for (int track = 0; track < 82; track++)
|
||||
{
|
||||
float r = VOUTER_RADIUS - track * step;
|
||||
_scene->addEllipse(x-r, y-r, r*2, r*2, black);
|
||||
_scene->addEllipse(x - r, y - r, r * 2, r * 2, black);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "drivecomponent.h"
|
||||
#include "formatcomponent.h"
|
||||
#include "fluxvisualiserwidget.h"
|
||||
#include "fluxcomponent.h"
|
||||
|
||||
class MainWindowImpl : public MainWindow
|
||||
{
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
setupUi(this);
|
||||
_driveComponent = DriveComponent::create(this);
|
||||
_formatComponent = FormatComponent::create(this);
|
||||
_fluxComponent = FluxComponent::create(this);
|
||||
|
||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
||||
@@ -32,10 +33,6 @@ public:
|
||||
stopWidget->setText("Stop");
|
||||
statusbar->addPermanentWidget(stopWidget);
|
||||
|
||||
_fluxVisualiserWidget = FluxVisualiserWidget::create();
|
||||
fluxViewContainer->layout()->addWidget(_fluxVisualiserWidget);
|
||||
_fluxVisualiserWidget->refresh();
|
||||
|
||||
connect(readDiskButton,
|
||||
&QAbstractButton::clicked,
|
||||
this,
|
||||
@@ -135,8 +132,8 @@ private:
|
||||
private:
|
||||
DriveComponent* _driveComponent;
|
||||
FormatComponent* _formatComponent;
|
||||
FluxComponent* _fluxComponent;
|
||||
QProgressBar* _progressWidget;
|
||||
FluxVisualiserWidget* _fluxVisualiserWidget;
|
||||
};
|
||||
W_OBJECT_IMPL(MainWindowImpl)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user