= Qt Interface = !RefactorErl's Qt based graphical user interface is a standard desktop application which provides the following functionalities * File and database management * Semantic query execution with auto-complete * Skeletons (query schemes) * Duplicated code analysis * Dependency analysis with dependency graph visualisation * Code investigations == Installation == For now the !RefactorErl Qt GUI is only available on Linux operating systems and possibly OS X (not tested yet). === Dependencies === For the Qt GUI to be accessible the Qt application and UI framework is needed, along with the !GraphViz software: * Qt application and UI framework, 4.x (4.8.2 is recommended) * qt-sdk package on Ubuntu * !GraphViz software ( http://www.graphviz.org ) for dependency graph drawing * graphviz package on Ubuntu * GCC 4.7.2 or newer, since the Qt GUI strongly relies on C++11 features Note that during Qt installation, using the qt-sdk package, a warning message could appear telling you there is a missing external media library called //Phonon//. You can ignore this warning since Phonon is not needed by the Qt GUI. [[Image(qt_install.png)]] Make sure that the {{{dot}}} command, g++ command and {{{qmake}}} or {{{qmake-qt4}}} commands (the latter depends on the Linux distribution) are in your PATH. To access the Qt GUI compile the tool with the following command: {{{ bin/referl -build tool -qt_gui }}} == Starting up == The interface can be started either with the {{{referl}}} script or from a running !RefactorErl shell. When using the latter option a username can be passed, this way the saved queries, skeletons and investigations will be distinguished for the different users. Start up examples: * With the {{{referl}}} script {{{ bin/referl -qt }}} * From the shell without a user name (the current node name will be used as the default user name): {{{ ri:start_qt(). }}} * From the shell with a user name: {{{ ri:start_qt("userNameAsAString"). }}} == Shutting down == Simply close the window with the X in the upper left or right corner (depends on your window manager). == Qt interface usage == The main functionalities (file management, queries, dependency graph, duplicated code and investigations) can be accessed in separate embedded windows or as tabs through the **View** menu from the top menu bar. The windows and tabs can be opened at the users will. The tab or embedded window view (used by default) can be accessed in the **View**/**View Mode** menu or via keyboard shortcuts. When using the embedded window view the windows can be arranged as tiles or as cascaded windows, also accessible from the **View** menu or via shortcuts. Some messages are displayed in dialogs, for example when a duplicated code analysis is finished or some error happens during an operation. === File Browser === [[Image(fbrowser.png)]] This window or tab is used to manage the database. Three tabs are accessible: * **Files:** The list of files in the database * **Errors:** Detected errors in the database * **Configuration Parameters:** Incldes and appbases ==== Files ==== In this tab you can: * add files and directories or drop the selected files from the list * reset or syncronize the database ==== Errors ==== View the detected errors in the database. ==== Configuration Parameters ==== In this tab you can: * add includes and appbases or drop the selected ones from the list, using the **Delete env** button === Queries === Read more about semantic queries on the [SemanticQuery Semantic Queries Page]. [[Image(queries.png)]] On this window there are four tabs: * **Query:** Run queries and manage skeletons * **Last results:** Result of the latest query run in a collapsible tree format * **Running queries:** List of currently running queries * **Files:** File list in the database ==== Queries ==== Queries can be entered with the help of autocorrect in the top textbox. The query can be ran or saved as a skeleton with the corresponding buttons below. The list of the latest queries is used to re-run previous ones from the cache. ==== Last results ==== The query result is displayed in a tree structure, according to the grouping. Some parts of the tree are bound to certain code parts, these can be opened in the code browser on the right by //double clicking them using the left mouse button//. ==== Running queries ==== A running query can be selected and stopped with the **Kill query** button. ==== Files ==== A file can be opened in the code browser by double clicking it in the list. === Dependency Graph === Read more about dependency analysis on the [wiki:Dependency Dependency Analysis Page]. [[Image(depgraph.png)]] You can generate: * Qt based graphical graphs, by using the **Draw** button * SVG graphs, by using the **Draw SVG** button The dependency analysis can be performed in the following levels: * Function * Module * Module group using the whole graph (**All**) or the cyclic sub-graphs (**Cycles**). A start function or module can be given, as well as excluded modules and excluded leaves of nodes. Autocomplete helps the addition of modules or functions. For better navigation you can zoom in the graph by pressing the Ctrl key and using the mouse scroll. === Duplicated Code === You can learn more about this topic and about the usage on CloneIdentifiErl page, whilst the services provided by this interface are detailed below. [[Image(dupcode.png)]] You can choose an algorithm by clicking on one of the top-left tabs. After filling in the parameters the analysis is started by clicking the **Run analysis** button. When the analysis is finished an info dialog pops up notifying you. Choose the group and the contents of the left and right browsers from the available drop-down lists. The result of a previous analysis can be reloaded by entering the name (helped by autocomplete) and clicking the **Load previous result** button. === Investigations === [[Image(investigations.png)]] The usage of the investigation window is the following: * Enter a function name in MODULE:FUNCTION/ARITY format (helped by autocomplete) and click the **Run new investigation** button. An investigation box will appear on the right side of the window with the selected function in it. * By clicking in the code of the investigation box a new query can be ran from the specified position. The query results will appear in a list on the left side. * Select the wanted result and click the **Add to investigation** button. Investigations can be saved using the **Save** and **Save as** buttons. To reload one select it from the list and click the **Load** button. Investigation box functionality: * **Name:** Add a name * **Add memo:** Add a comment box * **Hide:** Hide the code in the box * **Delete:** Delete the box and its subtree * **Move to new:** Move the box and its subtree to a new investigation * **New investigation:** Use the box as the starting point of a new investigation For better navigation you can zoom in the graph by pressing the Ctrl key and using the mouse scroll. === Code Browser === [[Image(cbrowser.png)]] The Code Browser is not directly accessible from the **View** menu like the previous functionalities but from various places. The Queries and Duplicated Code windows have built-in Code Browsers as well as the Investigation boxes. If you double click a file in the File Browser window a separate Code Browser window opens. The Code Browser allows you to view the source of a module in the !RefactorErl database with syntax highlighting, search functionality and queries started from a selected position. The text search can be triggered by simply typing when the Code Browser is in focus, so a search bar appears on the bottom of the window. By //clicking somewhere in the code using the left mouse button// a query bar appears and a query can be given by typing or selecting the available predefined queries and started clicking the **Run query** button.