WSF
CreatePlatformDialog.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2018 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12
13#ifndef CREATEPLATFORMDIALOG_HPP
14#define CREATEPLATFORMDIALOG_HPP
15
16#include <map>
17#include <vector>
18
19#include <QDialog>
20
21#include "UtMemory.hpp"
22#include "ViExport.hpp"
24#include "WsfPProxyNode.hpp"
25#include "ui_CreatePlatform.h"
26
27class UtTextDocument;
28class WsfPProxy;
29class QMimeData;
30
31namespace wizard
32{
33class PasteContext;
34
35class VI_EXPORT CreatePlatformDialog : public QDialog
36{
37 Q_OBJECT
38
39public:
40 ~CreatePlatformDialog() override = default;
45
46 static void PasteHandler(const QMimeData* aMime, const PasteContext& aContext, bool aExecute);
47
48 explicit CreatePlatformDialog(WsfPProxy* proxy, QWidget* parent = nullptr);
49
50 void SetPlatformPosition(const UtLatPos& aLat, const UtLonPos& aLon);
51
52 void SelectPlatformType(const std::string& aName);
53public slots:
54 void CreatePlatform();
55 void UpdateSavedPlatType(int index);
56 void UpdateSavedFile(int index);
57 void OnNameTextChanged(const QString& aName);
58
59 // use the set platform type to choose the most appropriate file
60 void ChooseFileFromType();
61
62private:
65 typedef std::pair<std::string, size_t> FileHit;
66
68 typedef std::map<std::string, size_t> FileHitMap;
69
71 typedef std::vector<FileHit> FileHitList;
72
73 void PopulateTypes();
74 void PopulateFiles();
75
76 void SelectFile(const std::string& aFilePath);
77
78 WsfPProxyNode PlatTypeAtIndex(int index);
79 WsfPProxyNode SelectedPlatType();
80 std::string SaveFilePathAtIndex(int index);
81 std::string SelectedSaveFilePath();
82 std::string SetRelativeDocPath(const UtTextDocument* doc);
83 void InitFileHitMap(FileHitMap& fileHitMap);
84 void BuildFileHitMap(FileHitMap& fileHitMap);
85 void SortFileHitMap(const FileHitMap& fileHitMap, FileHitList& fileHitList);
86 static bool SortAlphabetical(const FileHit& entry1, const FileHit& entry2);
87 static bool SortMostHits(const FileHit& entry1, const FileHit& entry2);
88
91 static std::string mPrevPlatTypeName;
92 static std::string mPrevSaveFilePath;
93
94 bool mPosValid;
96 WsfPProxy* mProxy;
97 Ui::CreatePlatform mUi;
98 bool mApplyToTextImmediately;
99};
100} // namespace wizard
101
102#endif // CREATEPLATFORMDIALOG_HPP
#define VI_EXPORT
Definition ViExport.hpp:38
Definition WsfPProxyNode.hpp:60
Definition WsfPProxy.hpp:32
Definition WsfPProxyBasicValues.hpp:89
void OnNameTextChanged(const QString &aName)
Definition CreatePlatformDialog.cpp:347
CreatePlatformDialog(const CreatePlatformDialog &)=delete
void SetPlatformPosition(const UtLatPos &aLat, const UtLonPos &aLon)
Definition CreatePlatformDialog.cpp:76
void SelectPlatformType(const std::string &aName)
Use the static member variable to prepopulate the combo box selection based on what the user had sele...
Definition CreatePlatformDialog.cpp:200
static void PasteHandler(const QMimeData *aMime, const PasteContext &aContext, bool aExecute)
Definition CreatePlatformDialog.cpp:414
CreatePlatformDialog & operator=(CreatePlatformDialog &&)=default
CreatePlatformDialog(CreatePlatformDialog &&)=default
void UpdateSavedPlatType(int index)
When the user changes the selection in the combo box, save the selection for the next time the user o...
Definition CreatePlatformDialog.cpp:136
void CreatePlatform()
Definition CreatePlatformDialog.cpp:84
~CreatePlatformDialog() override=default
void UpdateSavedFile(int index)
When the user changes the selection in the combo box, save the selection for the next time the user o...
Definition CreatePlatformDialog.cpp:146
void ChooseFileFromType()
Definition CreatePlatformDialog.cpp:363
CreatePlatformDialog & operator=(const CreatePlatformDialog &)=delete
Definition PasteContext.hpp:31
Definition Runner.hpp:22
Copyrights Multiple, All Rights Reserved