Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving QM folder to New Folder
#1
Hi Gintaras,
I would like to move a defined group of QM folders (that contain many many subfolders of functions) into one new folder which will make it easy to export as a single qml. I see how to copy folders and items but thought there may be a "move" function.

Function MoveQmlFolder
Code:
Copy      Help
str SuperFolderName = F"New Folder"
newitem FolderName "" "Folder"
str FolderColl=
;Folder1
;Folder2
;Folder3
;Folder4
;Folder5


foreach _s FolderColl
,out _s
,int FolderQmId = qmitem(_s)
,newitem("" "" FolderQmId "" SuperFolderName)

This just creates a duplicate folder name but doesn't move the contents.
Does this already exist?

Also, I thought that the newitem function would create the SuperFolderName folder if it didn't exist but the code above would only make the subfolders if I already created it with the first newitem command.

Thanks for any thoughts!!!,
S
#2
newitem maybe can be used to move QM items and folders, but it is difficult, it is not intended for this purpose. Better move QM items manually.
#3
Thanks for quick reply!
Stuart
#4
This is somewhat related to thread below and closer to my real use case: SilentImport to pre-existing folder.
I import a bunch of different .qml files from Source Control using SilentImport. it would be great to import them into a pre-existing folder rather than top-level item list in QM. This way it is easy to re-export all the imported files into a new qml containing them all as subfolders
Is this possible?
Thanks,
S
#5
stupomer Wrote:Is this possible?
no
#6
Reviving old post. I'm also in the need of source control import/export.

Currently, I export to a QML then connect as a Sqlite resource and dump the code to flat files. Metadata gets appended to each source file as a comment (guid, flags, etc), hex encoding any binary data. This allows it to go into source control and enable code reviews.

For importing I read the flat files and re-build the QML using a "blank". To create the blank, I deleted everything out of a normal QML file except the root entries (id = 0).. then populate the items and texts tables, reading metadata from each file to populate the flags, guid, date, etc.

About the only thing I need to do now is delete the old file/folder so the import won't rename anything. This should at least cover use cases where each project is within a single folder in QM. I'm working on building this out in a way that is user-friendly, so I can post it here for others. Working on using newitem to delete the old project before calling SilentImport.
#7
Here's what I have right now for a working example.

This allows for exporting a project to flat-files that can be checked into source control and submitted for code reviews.

The import routine re-builds the QML from the flat files, deletes the existing folder under the specified project name, and then imports the newly created QML.

Each QMC file gets a metadata line beneath it that needs to stay in tact, which should not be a problem if you are only using QM as the IDE. 
Rather than building a separate file with the metadata I figured it'd be best to just store it in each file as the last line comment.

To use, import QMImportExport.qml and update the exportProject and exportPath depending on which project you want to export/import, and where. Upon calling QMImportProject you will need the Blank.qml to be in that same path as the .QMC source files. Lastly, don't put a trailing slash on the exportPath in the QMExport macro.


Attached Files
.qml   Blank.qml (Size: 3 KB / Downloads: 326)
.qml   QMImportExport.qml (Size: 7 KB / Downloads: 317)


Forum Jump:


Users browsing this thread: 1 Guest(s)