|
9 | 9 | # $Id$ #
|
10 | 10 |
|
11 | 11 | # get the needed information from the user
|
12 |
| -print "\n\nEnter the directory name under qgis/plugins/ where your new plugin will be created.\n"; |
| 12 | +print "\n\nEnter the directory name under qgis/src/plugins/ where your new plugin will be created.\n"; |
13 | 13 | print "We suggest using a lowercase underscore separated name e.g. clever_plugin\n";
|
14 | 14 | print "Directory for the new plugin:";
|
15 | 15 | $pluginDir =<STDIN>;
|
16 | 16 | chop $pluginDir;
|
17 | 17 |
|
18 |
| -print "\n\nEnter the name that will be used when creating the plugin library and should be\n"; |
19 |
| -print "entered as a mixed case name with no spaces. e.g. CleverPlugin\n"; |
| 18 | +print "\n\nEnter the name that will be used when creating the plugin library.\n"; |
| 19 | +print "The name should be entered as a mixed case name with no spaces. e.g. CleverTool\n"; |
| 20 | +print "The plugin name will be used in the following ways:\n"; |
| 21 | +print "1) it will be 'lower cased' and used as the root of the generated lib name \n"; |
| 22 | +print " e.g. libqgis_plugin_clevertool\n"; |
| 23 | +print "2) in its upper cased form it will be used as the basis for class names, in particular\n"; |
| 24 | +print " CleverToolGuiBase <- The base class for the plugins configuration dialog / gui generated by uic\n"; |
| 25 | +print " CleverToolGui <- The concrete class for the plugins configuration dialog\n"; |
| 26 | +print "3) CleverTool <- The class that includes the plugin loader instructions and\n"; |
| 27 | +print " and calls to your custom application logic\n"; |
| 28 | +print "4) clevertool.h, clevertool.cpp etc. <- the filenames used to hold the above derived classes\n"; |
20 | 29 | print "Plugin name: " ;
|
21 | 30 | $pluginName = <STDIN>;
|
22 | 31 | chop $pluginName;
|
| 32 | +$pluginLCaseName = $pluginName; #todo convert to lower case |
23 | 33 |
|
24 | 34 | print "\n\nEnter a short description (typically one line)\n";
|
25 |
| -print "e.g. The clever plugin does clever stuff in qgis\n"; |
| 35 | +print "e.g. The clever plugin does clever stuff in QGIS\n"; |
26 | 36 | print "Plugin description: " ;
|
27 | 37 | $pluginDescription = <STDIN>;
|
28 | 38 | chop $pluginDescription;
|
|
46 | 56 | ---------------------------------------------
|
47 | 57 | Plugin directory $pluginDir
|
48 | 58 | Name of the plugin: $pluginName
|
| 59 | +Library name of the plugin: libqgis_plugin_$pluginLCaseName |
49 | 60 | Description of the plugin: $pluginDescription
|
50 | 61 | Menu name: $menuName
|
51 | 62 | Menu item name: $menuItemName
|
52 | 63 |
|
53 | 64 | Warning - Proceeding will make changes to Makefile.am in this directory,
|
54 |
| -as well as ../configure.in. Please use caution. |
| 65 | +as well as ../../configure.in. Please use caution. |
55 | 66 | EOF
|
56 | 67 | # ask if we should proceed
|
57 | 68 | print "Create the plugin? [y/n]: ";
|
|
64 | 75 | #
|
65 | 76 | # create the new plugin directory
|
66 | 77 | system("cp -r plugin_template $pluginDir");
|
67 |
| - # remove the CVS directory |
68 |
| - system("rm -rf $pluginDir/CVS"); |
| 78 | + # remove the subversion directory |
| 79 | + system("rm -rf $pluginDir/.svn"); |
| 80 | + # copy files to appropriate names |
| 81 | + system("cp $pluginDir/plugin.cpp $pluginDir/$pluginLCaseName.cpp"); |
| 82 | + system("cp $pluginDir/plugin.h $pluginDir/$pluginLCaseName.h"); |
| 83 | + #todo sort out copying these next items properly |
| 84 | + system("cp $pluginDir/pluginbase.cpp $pluginDir/$pluginLCaseName.cpp"); |
| 85 | + system("cp $pluginDir/plugin.cpp $pluginDir/$pluginLCaseName.cpp"); |
69 | 86 |
|
70 | 87 | # Substitute the plugin specific vars in the various files
|
71 | 88 | # This is a brute force approach but its quick and dirty :)
|
72 | 89 | #
|
| 90 | + # replace [pluginlcasename] in template with the new plugin name |
| 91 | + system("perl -pi -e 's/\\\[pluginlcasename\\\]/$pluginLCaseName/g' $pluginDir/*.cpp $pluginDir/*.h $pluginDir/*.am $pluginDir/*.ui"); |
73 | 92 | # replace [pluginname] in template with the new plugin name
|
74 | 93 | system("perl -pi -e 's/\\\[pluginname\\\]/$pluginName/g' $pluginDir/*.cpp $pluginDir/*.h $pluginDir/*.am $pluginDir/*.ui");
|
75 | 94 | # replace [plugindescription] in template with the description
|
|
0 commit comments