-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Files view * Added ability to reorder preserts in the settings * Added multicam support * Fixed NonPrinting FAB menu * Replaced SpeedDial Lib
- Loading branch information
Showing
31 changed files
with
953 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,67 @@ | ||
import 'package:mobileraker/dto/machine/printer.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
enum KlipperState { ready, error, shutdown, startup, disconnected } | ||
|
||
class KlipperInstance { | ||
bool klippyConnected; | ||
|
||
PrinterState klippyState; //Matches Printer state | ||
KlipperState klippyState; //Matches Printer state | ||
String get klippyStateName => printerStateName(klippyState); | ||
|
||
List<String> plugins; | ||
|
||
KlipperInstance( | ||
{this.klippyConnected = false, | ||
this.klippyState = PrinterState.error, | ||
this.klippyState = KlipperState.error, | ||
this.plugins = const []}); | ||
|
||
String get stateName => printerStateName(klippyState); | ||
|
||
static Color stateToColor(KlipperState state) { | ||
switch (state) { | ||
case KlipperState.ready: | ||
return Colors.green; | ||
case KlipperState.error: | ||
return Colors.red; | ||
case KlipperState.shutdown: | ||
case KlipperState.startup: | ||
case KlipperState.disconnected: | ||
default: | ||
return Colors.orange; | ||
} | ||
} | ||
|
||
static String printerStateName(KlipperState printerState) { | ||
switch (printerState) { | ||
case KlipperState.ready: | ||
return "Ready"; | ||
case KlipperState.shutdown: | ||
return "Shutdown"; | ||
case KlipperState.startup: | ||
return "Starting"; | ||
case KlipperState.disconnected: | ||
return "Disconnected"; | ||
case KlipperState.error: | ||
default: | ||
return "Error"; | ||
} | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'KlipperInstance{klippyConnected: $klippyConnected, klippyState: $klippyState, plugins: $plugins}'; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is KlipperInstance && | ||
runtimeType == other.runtimeType && | ||
klippyConnected == other.klippyConnected && | ||
klippyState == other.klippyState && | ||
plugins == other.plugins; | ||
|
||
@override | ||
int get hashCode => | ||
klippyConnected.hashCode ^ klippyState.hashCode ^ plugins.hashCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.