Skip to content
Mario Martin Basa edited this page Mar 16, 2022 · 2 revisions

Adding GTT functionality to the SMASH Import-Export Library plugin.

These are the following steps in order to let SMASH create issues into a Redmine Server.

Initial Setup

  • Create the required directories:
    • export/gtt
    • import/gtt

Adding GTT Export

  • In export/gtt directory create the file gtt_export.dart and copy the contents of export/gtt_export.dart from the Hyakumori's gtt/main GitHub repository.

  • Remove all the library import code and add the following code:

part of smash_import_export_plugins;

class GttExportPlugin extends AExportPlugin {
  ProjectDb projectDb;
  BuildContext context;

  @override
  void setContext(BuildContext context) {
    this.context = context;
  }

  @override
  Icon getIcon() {
    return Icon(
      MdiIcons.cloudLock,
      color: SmashColors.mainDecorations,
    );
  }

  @override
  String getTitle() {
    return "GTT";
  }

  @override
  String getDescription() {
    return IEL.of(context).exportWidget_exportToGTT;
  }

  @override
  void setProjectDatabase(ProjectDb projectDb) {
    this.projectDb = projectDb;
  }

  @override
  Widget getExportPage() {
    return GttExportWidget(
      projectDb,
    );
  }

  @override
  Widget getSettingsPage() {
    return GttSettings();
  }
}
  • Change final GeopaparazziProjectDb projectDb; into final ProjectDb projectDb; in GttExportWidget class.

  • Comment out the following code in lines 576 - 581

    /*if (noteUpdated) {
      ProjectState projectState =
          Provider.of<ProjectState>(context, listen: false);

      projectState.reloadProject(context);
    }*/
  • Change all instances of GeopaparazziProjectDb to ProjectDb.

Adding GTT Import

  • In import/gtt directory create the file gtt_import.dart and copy the contents of import/gtt_import.dart from the Hyakumori's gtt/main GitHub repository.

  • Remove all the library import code and add the following code:

part of smash_import_export_plugins;

class GttImportPlugin extends AImportPlugin {
  ProjectDb projectDb;
  BuildContext context;

  @override
  void setContext(BuildContext context) {
    this.context = context;
  }

  @override
  Icon getIcon() {
    return Icon(
      MdiIcons.cloudLock,
      color: SmashColors.mainDecorations,
    );
  }

  @override
  String getTitle() {
    return "GTT";
  }

  @override
  String getDescription() {
    return IEL.of(context).importWidget_importFromGTT;
  }

  @override
  void setProjectDatabase(ProjectDb projectDb) {
    this.projectDb = projectDb;
  }

  @override
  Widget getImportPage() {
    return GttImportWidget();
  }

  @override
  Widget getSettingsPage() {
    return GttSettings();
  }
}

Adding GTT Utilities

  • In the utils directory, create the file gtt_utilities.dart and copy the contents of gtt/gtt_utilities.dart from the Hyakumori's gtt/main GitHub repository.

  • Remove all the library import code and add the following code:

part of smash_import_export_plugins;
  • Copy the classes GttSettings and GttSettingsState from the widgets/settings.dart of the Hyakumori's gtt/main GitHub repository and place it at the bottom portion of the gtt_utilities.dart

Adding to plugins.dart

  • Open plugins.dart and add GttImportPlugin(), to List<AImportPlugin> importPlugins.

  • Add GttExportPlugin(), to List<AExportPlugin> exportPlugins.

Adding to smash_import_export_plugins.dart

  • Open smash_import_export_plugins.dart and add the following:
import 'package:intl/intl.dart';

and

part 'com/hydrologis/smash/import_export_plugins/export/gtt/gtt_export.dart';
part 'com/hydrologis/smash/import_export_plugins/import/gtt/gtt_import.dart';
part 'com/hydrologis/smash/import_export_plugins/utils/gtt_utilities.dart';

Localization

  • Change all instances of SL into IEL for gtt_import.dart, gtt_export.dart, and gtt_utilities.dart.

  • Copy all gttExport_* from Hyakumori's intl_en.arb GitHub repository and place into i10n/intl_en.arb

  • Copy all gttImport_* from Hyakumori's intl_en.arb GitHub repository and place into i10n/intl_en.arb

  • Copy the following from Hyakumori's intl_en.arb GitHub repository and place into i10n/intl_en.arb:

    • exportWidget_exportToGTT
    • importWidget_importFromGeoTaskTracker
    • settings_serverUsername
    • settings_pleaseEnterValidUsername
Clone this wiki locally