Skip to content

Commit

Permalink
0.0.1-3
Browse files Browse the repository at this point in the history
  • Loading branch information
trueToastedCode committed Apr 13, 2021
0 parents commit 889551b
Show file tree
Hide file tree
Showing 96 changed files with 5,849 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
channel: stable

project_type: app
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# open_configurator

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
78 changes: 78 additions & 0 deletions lib/globals.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
library open_configurator.globals;

import 'package:flutter/cupertino.dart';
import 'package:open_configurator/services/pconfig.dart';
import 'package:open_configurator/templates/number_widget.dart';

import 'templates/checkbox_widget.dart';
import 'templates/data_widget.dart';
import 'templates/string_widget.dart';

bool isDark = true;
Function changeColorMode;
Function changeColorMode2;

PConfig pConfig;
List<Function> undoList = [];

List<Widget> buildWidgetsNoTree(List<String> path, int orientation, double width, double height, List<String> ignoreKeys) {
List<Widget> widgets = [];
final map = pConfig.getValue(List.from(path), null);
for (final key in map.keys) {
if (ignoreKeys != null && ignoreKeys.contains(key)) continue;
switch(map[key]["type"]) {
case "bool":
widgets.addAll([
CheckboxWidget(
width: width,
height: height,
title: key,
getValue: () => pConfig.getValue([...path, key, "content"], null),
setValue: (value) => pConfig.setValue([...path, key, "content"], value, null),
),
SizedBox(height: orientation == 0 ? 5 : 0, width: orientation == 0 ? 5 : 0),
]);
break;
case "integer":
widgets.addAll([
NumberWidget(
width: width,
height: height,
title: key,
getValue: () => pConfig.getValue([...path, key, "content"], null),
setValue: (value) => pConfig.setValue([...path, key, "content"], value, null),
),
SizedBox(height: orientation == 0 ? 5 : 0, width: orientation == 0 ? 5 : 0),
]);
break;
case "data":
widgets.addAll([
DataWidget(
width: width,
height: height,
title: key,
getValue: () => pConfig.getValue([...path, key, "content"], null),
setValue: (value) => pConfig.setValue([...path, key, "content"], value, null),
),
SizedBox(height: orientation == 0 ? 5 : 0, width: orientation == 0 ? 5 : 0),
]);
break;
case "string":
widgets.addAll([
StringWidget(
width: width,
height: height,
title: key,
getValue: () => pConfig.getValue([...path, key, "content"], null),
setValue: (value) => pConfig.setValue([...path, key, "content"], value, null),
),
SizedBox(height: orientation == 0 ? 5 : 0, width: orientation == 0 ? 5 : 0),
]);
break;
default:
throw UnimplementedError("Tried to build type \"${map[key]["type"]}\"");
}
}
if (widgets.isNotEmpty) widgets.removeLast();
return widgets;
}
64 changes: 64 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:desktop_window/desktop_window.dart';
import 'package:open_configurator/pages/home/home_page.dart';
import 'package:open_configurator/globals.dart' as globals;
import 'package:open_configurator/pages/load_config_page.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (/*Platform.isWindows || */Platform.isLinux || Platform.isMacOS) {
await DesktopWindow.setWindowSize(Size(900, 620));
}
runApp(Main());
}

class Main extends StatefulWidget {
@override
_MainState createState() => _MainState();
}

class _MainState extends State<Main> {
void _onConfigLoaded() => setState(() {});
@override
Widget build(BuildContext context) {
globals.changeColorMode = () {
setState(() {
globals.isDark = globals.isDark == true ? false : true;
if (globals.changeColorMode2 != null) try {
globals.changeColorMode2();
}catch (e) {}
});
};
return MaterialApp(
theme: globals.isDark ? ThemeData.dark() : null,
home: globals.pConfig == null
? LoadConfigPage(
onConfigLoaded: _onConfigLoaded,
)
: HomePage(
onReset: () {
setState(() {
globals.pConfig = null;
globals.undoList = [];
globals.changeColorMode = null;
globals.changeColorMode2 = null;
});
},
onSave: () {
final path = globals.pConfig.path;
String newPath;
for (int i=path.length-1; i>-1; i--) {
if (path[i] == ".") {
newPath = path.substring(0, i) + "_OpenConf.plist";
break;
}
}
if (newPath == null) newPath = path + "_OpenConf.plist";
globals.pConfig.write(newPath);
},
),
);
}
}
32 changes: 32 additions & 0 deletions lib/pages/acpi/acpi_add_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/cupertino.dart';
import 'package:open_configurator/templates/dict_array_widget.dart';
import 'package:open_configurator/globals.dart' as globals;

class AcpiAddWidget extends StatefulWidget {
@override
_AcpiAddWidgetState createState() => _AcpiAddWidgetState();
}

class _AcpiAddWidgetState extends State<AcpiAddWidget> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: DictArrayWidget(
getArray: () => globals.pConfig.getValue(["content", "ACPI", "content", "Add", "content"], null),
setArray: (value) => globals.pConfig.setValue(["content", "ACPI", "content", "Add", "content"], value, null),
width: 600,
keyForHeader: "Path",
getDummyEntry: () => {
"Comment": {"type": "string", "content": "My SSDT"},
"Enabled": {"type": "bool", "content": "0"},
"Path": {"type": "string", "content": "SSDT-*.aml"},
},
),
),
],
);
}
}
35 changes: 35 additions & 0 deletions lib/pages/acpi/acpi_delete_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/cupertino.dart';
import 'package:open_configurator/templates/dict_array_widget.dart';
import 'package:open_configurator/globals.dart' as globals;

class AcpiDeleteWidget extends StatefulWidget {
@override
_AcpiDeleteWidgetState createState() => _AcpiDeleteWidgetState();
}

class _AcpiDeleteWidgetState extends State<AcpiDeleteWidget> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: DictArrayWidget(
getArray: () => globals.pConfig.getValue(["content", "ACPI", "content", "Delete", "content"], null),
setArray: (value) => globals.pConfig.setValue(["content", "ACPI", "content", "Delete", "content"], value, null),
width: 600,
keyForHeader: "Comment",
getDummyEntry: () => {
"All": {"type": "bool", "content": "0"},
"Comment": {"type": "string", "content": ""},
"Enabled": {"type": "bool", "content": "0"},
"OemTableId": {"type": "data", "content": ""},
"TableLength": {"type": "integer", "content": "0"},
"TableSignature": {"type": "data", "content": ""},
},
),
),
],
);
}
}
55 changes: 55 additions & 0 deletions lib/pages/acpi/acpi_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:open_configurator/globals.dart' as globals;
import 'package:open_configurator/pages/acpi/acpi_add_widget.dart';

import 'acpi_delete_widget.dart';
import 'acpi_patch_widget.dart';
import 'acpi_quirks_widget.dart';

class ACPIPage extends StatefulWidget {
@override
_ACPIPageState createState() => _ACPIPageState();
}

class _ACPIPageState extends State<ACPIPage> {
@override
void initState() {
super.initState();
globals.changeColorMode2 = () => setState(() {});
}

@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 4,
child: Scaffold(
appBar: AppBar(
flexibleSpace: Padding(
padding: EdgeInsets.symmetric(vertical: 0),
child: TabBar(
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: globals.isDark == true ? Color(0xff505050) : Colors.black.withOpacity(0.35),
),
tabs: [
Tab(text: "Add", icon: Icon(Icons.add, size: 19)),
Tab(text: "Delete", icon: Icon(Icons.remove, size: 19)),
Tab(text: "Patch", icon: Icon(Icons.construction_outlined, size: 19)),
Tab(text: "Quriks", icon: Icon(Icons.auto_awesome, size: 19)),
],
),
),
),
body: TabBarView(
children: [
AcpiAddWidget(),
AcpiDeleteWidget(),
AcpiPatchWidget(),
AcpiQuirksWidget(),
],
),
),
);
}
}
43 changes: 43 additions & 0 deletions lib/pages/acpi/acpi_patch_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:flutter/cupertino.dart';
import 'package:open_configurator/templates/dict_array_widget.dart';
import 'package:open_configurator/globals.dart' as globals;

class AcpiPatchWidget extends StatefulWidget {
@override
_AcpiPatchWidgetState createState() => _AcpiPatchWidgetState();
}

class _AcpiPatchWidgetState extends State<AcpiPatchWidget> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: DictArrayWidget(
getArray: () => globals.pConfig.getValue(["content", "ACPI", "content", "Patch", "content"], null),
setArray: (value) => globals.pConfig.setValue(["content", "ACPI", "content", "Patch", "content"], value, null),
width: 600,
keyForHeader: "Comment",
getDummyEntry: () => {
"Base": {"type": "string", "content": ""},
"BaseSkip": {"type": "integer", "content": "0"},
"Comment": {"type": "string", "content": ""},
"Count": {"type": "integer", "content": "0"},
"Enabled": {"type": "bool", "content": "0"},
"Find": {"type": "data", "content": ""},
"Limit": {"type": "integer", "content": "0"},
"Mask": {"type": "data", "content": ""},
"OemTableId": {"type": "data", "content": ""},
"Replace": {"type": "data", "content": ""},
"ReplaceMask": {"type": "data", "content": ""},
"Skip": {"type": "integer", "content": "0"},
"TableLength": {"type": "integer", "content": "0"},
"TableSignature": {"type": "data", "content": ""},
},
),
),
],
);
}
}
Loading

0 comments on commit 889551b

Please sign in to comment.