BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
TemplateGenerator Class Reference

Generator responsible for generating APK mobile applications. More...

#include <templategenerator.h>

Collaboration diagram for TemplateGenerator:
Collaboration graph

Public Slots

void generateMobileApplication (TemplateCore *core)
 Generates new APK application using given core. More...
 
void cleanWorkspace ()
 Cleans workspace used for generating applications.
 
void refreshWorkspace ()
 Cleans and recreates base workspace path.
 

Signals

void generationStarted ()
 Emitted if generating process is started.
 
void generationFinished (TemplateCore::GenerationResult result_code, const QString &output_file=QString())
 Emitted if generating process is finished. More...
 
void generationProgress (int progress, const QString &message)
 Emitted when there is some progress in generating APK application. More...
 

Public Member Functions

 TemplateGenerator (QObject *parent=0)
 

Detailed Description

Generator responsible for generating APK mobile applications.

Definition at line 10 of file templategenerator.h.

Member Function Documentation

void TemplateGenerator::generateMobileApplication ( TemplateCore core)
slot

Generates new APK application using given core.

Parameters
coreUsed core.
Warning
State and progress of creating of application is reported via signalling. No return values are used.

Definition at line 21 of file templategenerator.cpp.

21  {
22  if (qApp->closeLock()->tryLock()) {
23  bool ok;
24  QString input_file_name = QInputDialog::getText(qApp->mainForm(), tr("Specify application output file name"),
25  tr("Type here custom output application file name or leave the default value intact if you are satisfied with it."),
26  QLineEdit::Normal,
27  qApp->templateManager()->applicationFileName(core->editor()->projectName()), &ok);
28 
29  if (!ok || input_file_name.isEmpty()) {
30  // User aborted the process or entered empty file name.
31  //emit generationFinished(TemplateCore::Aborted);
32  qApp->closeLock()->unlock();
33  return;
34  }
35 
36  // Append necessary suffix.
37  if (!input_file_name.endsWith(".apk")) {
38  input_file_name += ".apk";
39  }
40 
41  connect(core, SIGNAL(generationProgress(int,QString)), this, SIGNAL(generationProgress(int,QString)));
42  emit generationStarted();
43 
44  // TODO: upravit signaturu metody generationMobileApplication,
45  // aby brala i ten vstupni nazev ciloveho apk souboru.
46 
47  QString output_file;
48  TemplateCore::GenerationResult result = core->generateMobileApplication(input_file_name, output_file);
49 
50  disconnect(core, SIGNAL(generationProgress(int,QString)), this, SIGNAL(generationProgress(int,QString)));
51 
52  if (result == TemplateCore::Success) {
53  emit generationFinished(result, output_file);
54  }
55  else {
56  emit generationFinished(result);
57  }
58 
59  qApp->closeLock()->unlock();
60  }
61  else {
62  qApp->trayIcon()->showMessage(tr("Cannot generate application"),
63  tr("Master generation lock is locked, try to\ngenerate application later."),
64  QSystemTrayIcon::Warning);
65  }
66 }
virtual QString projectName()=0
Access to project name of current editor.
virtual TemplateEditor * editor() const
Access to editor widget of the template.
Definition: templatecore.h:84
void generationProgress(int progress, const QString &message)
Emitted when there is some progress in generating APK application.
virtual GenerationResult generateMobileApplication(const QString &input_apk_file, QString &output_file)=0
Generates APK file from current project with active settings.
void generationFinished(TemplateCore::GenerationResult result_code, const QString &output_file=QString())
Emitted if generating process is finished.
void generationStarted()
Emitted if generating process is started.
GenerationResult
Possible results of generation of bundle data.
Definition: templatecore.h:48

Here is the call graph for this function:

void TemplateGenerator::generationFinished ( TemplateCore::GenerationResult  result_code,
const QString &  output_file = QString() 
)
signal

Emitted if generating process is finished.

Parameters
result_codeResult code of generating process.
output_fileIf generating succeeded, then this contains output APK file path.

Here is the caller graph for this function:

void TemplateGenerator::generationProgress ( int  progress,
const QString &  message 
)
signal

Emitted when there is some progress in generating APK application.

Parameters
progressNumber of percent passed.
messageProgress message description.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: