~vbursian/research-assistant/intervers

« back to all changes in this revision

Viewing changes to RAInst/InstallWizard.cpp

  • Committer: Viktor Bursian
  • Date: 2013-06-06 15:10:08 UTC
  • Revision ID: vbursian@gmail.com-20130606151008-6641eh62f0lgx8jt
Tags: version_0.3.0
versionĀ 0.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
/*! @file InstallWizard.cpp   ŠœŠ°ŃŃ‚ŠµŃ€ ŃƒŃŃ‚Š°Š½Š¾Š²ŠŗŠø ŃŠ¾ŃŃ‚Š°Š²Š½Š¾Š³Š¾ Š“ŠøстрŠøŠ±ŃƒŃ‚ŠøŠ²Š°.
 
3
- Uses  RAGUI - Research Assistant Graphical User Interface.
 
4
- Uses  QtGui v.4.6  -  http://qt.nokia.com/
 
5
- Uses  RANet - Research Assistant Net Library (based on ANSI C++).
 
6
- Copyright(C) 2011, Viktor E. Bursian, St.Petersburg, Russia.
 
7
                     Viktor.Bursian@mail.ioffe.ru
 
8
*///////////////////////////////////////////////////////////////////////////////
 
9
#include "InstallWizard.h"
 
10
#include "../RAGUI/StringsAndQStrings.h"
 
11
#include <QtGui>
 
12
#include <QApplication>
 
13
namespace RA/*RADist*/ {
 
14
//------------------------------------------------------------------------------
 
15
//---------------------------------------------------- sInstallWizard::sData ---
 
16
 
 
17
sInstallWizard::sData::sData ()
 
18
    :DistributiveDir(qApp->applicationDirPath())
 
19
{
 
20
  #ifdef Q_OS_WIN32
 
21
    System = "win32";
 
22
  #else
 
23
    #ifdef Q_OS_UNIX
 
24
      System = "unix";
 
25
    #else
 
26
      System = "unknownsystem";
 
27
    #endif
 
28
  #endif
 
29
};
 
30
 
 
31
//----------------------------------------------------------- sInstallWizard ---
 
32
 
 
33
sInstallWizard::sInstallWizard ()
 
34
    :QWizard()
 
35
    ,Prj( new sProjectInfo )
 
36
    ,Data( new sData )
 
37
{
 
38
  setWindowTitle(tr("Research Assistant Installation Wizard"));
 
39
  setPixmap(QWizard::LogoPixmap,QPixmap(":/install/ra.png"));
 
40
 
 
41
  if( AnalizeDistributive() ){
 
42
    setPage( IntroPage , new sIntroPage(Prj) );
 
43
    setPage( DirsPage , new sDirsPage(Prj,Data) );
 
44
    setPage( SelectionPage , new sSelectionPage(Prj,Data) );
 
45
    setPage( LicensePage , new sLicensePage() );
 
46
    setPage( ReadyToInstallPage , new sReadyToInstallPage );
 
47
    setPage( InstallationPage , new sInstallationPage(Prj,Data) );
 
48
    setPage( ConclusionPage , new sConclusionPage );
 
49
  };
 
50
};
 
51
 
 
52
 
 
53
bool  sInstallWizard::AnalizeDistributive ()
 
54
{
 
55
  foreach( QString FName, Data->DistributiveDir.entryList(QDir::Files) ){
 
56
    if( FName.endsWith(QString(".")+Data->System+".zip") ){
 
57
      if( FName.startsWith("RA.") ){
 
58
        int                         VerMajor;
 
59
        int                         VerMinor;
 
60
        sString                     VerPatchStr;
 
61
        bool                        OK;
 
62
        int                         P;
 
63
        QString                     Part;
 
64
 
 
65
        FName=FName.mid(QString("RA.").length());
 
66
        P = FName.indexOf(".");
 
67
        if( P < 0 )  return false;
 
68
        Part = FName.mid(0,P);
 
69
        FName=FName.mid(P+1);
 
70
 
 
71
        P = FName.indexOf(".");
 
72
        if( P < 0 )  return false;
 
73
        VerMajor = FName.mid(0,P).toInt(&OK);
 
74
        if( ! OK )  return false;
 
75
        FName=FName.mid(P+1);
 
76
 
 
77
        P = FName.indexOf(".");
 
78
        if( P < 0 )  return false;
 
79
        VerMinor = FName.mid(0,P).toInt(&OK);
 
80
        if( ! OK )  return false;
 
81
        FName=FName.mid(P+1);
 
82
 
 
83
        P = FName.indexOf(".");
 
84
        if( P < 0 )  return false;
 
85
        VerPatchStr = FromQString(FName.mid(0,P));
 
86
        FName=FName.mid(P+1);
 
87
 
 
88
        if( Part == "core" ){
 
89
          Prj->Core = new sProjectInfo::sPartInfo
 
90
              (sVersion(VerMajor,VerMinor,VerPatchStr),QString());
 
91
        }else{
 
92
          Prj->Plugins << Part;
 
93
          Prj->Plugin[Part] = new sProjectInfo::sPartInfo
 
94
              (sVersion(VerMajor,VerMinor,VerPatchStr),QString());
 
95
        };
 
96
      }else{
 
97
        Data->OtherProgZips << FName;
 
98
      };
 
99
    }else if( FName.endsWith(".src.zip") ){
 
100
      Data->Sources << FName;
 
101
    };
 
102
  };
 
103
  return true;
 
104
};
 
105
 
 
106
//--------------------------------------------------------------- sIntroPage ---
 
107
 
 
108
sIntroPage::sIntroPage (psProjectInfo  prj)
 
109
    :Prj(prj)
 
110
{
 
111
  setTitle(tr("Introduction"));
 
112
  if( Prj->Core )
 
113
    setSubTitle(tr("RA distributive, version %1")
 
114
               .arg(ToQString(Prj->Core->Version.Text()))
 
115
               );
 
116
  setPixmap(QWizard::WatermarkPixmap,QPixmap(":/install/aboutra.png"));
 
117
 
 
118
  QVBoxLayout *               Layout = new QVBoxLayout;
 
119
  setLayout(Layout);
 
120
 
 
121
  QLabel *                    Label = new QLabel(tr(
 
122
      "This wizard will help you to install or upgrade\n"
 
123
      "the Research Assistant (RA) program and/or its data.\n\n"
 
124
      "On the next few pages you will\n"
 
125
//      "-- read more about RA,\n"
 
126
      "-- select folders for the installation,\n"
 
127
      "-- choose what exactly you wish to install or upgrade,\n"
 
128
      "-- confirm your agreement to the free software license,\n"
 
129
      "-- wait about a minute until everything is done for you,\n"
 
130
//      "-- run RA (optional)."
 
131
                                                    ));
 
132
  Label->setWordWrap(true);
 
133
  Layout->addWidget(Label);
 
134
};
 
135
 
 
136
//---------------------------------------------------------------- sDirsPage ---
 
137
 
 
138
sDirsPage::sDirsPage (psProjectInfo           prj
 
139
                     ,sInstallWizard::psData  data)
 
140
    :Prj(prj)
 
141
    ,Data(data)
 
142
{
 
143
  setTitle("Folders");
 
144
  setSubTitle(" ");
 
145
 
 
146
  int                         Row = 0;
 
147
  QGridLayout *               Layout = new QGridLayout;
 
148
  setLayout(Layout);
 
149
 
 
150
  QLabel *                    Label;
 
151
  Label = new QLabel(tr("Program folder:"));
 
152
  Layout->addWidget(Label,Row++,1,1,1);
 
153
 
 
154
  QLineEdit *                 ProgDirField = new QLineEdit;
 
155
  Layout->addWidget(ProgDirField,Row,1,1,1);
 
156
//  ProgDirField->setText("ResearchAssistant");
 
157
  registerField("ProgDir*",ProgDirField);
 
158
  ProgDirField->setReadOnly(true);
 
159
//  connect(ProgDirField,SIGNAL(textEdited(QString))
 
160
//         ,this,SLOT(ProgDirBrowse()));
 
161
 
 
162
  QPushButton *               ProgDirButton = new QPushButton(tr("Browse"));
 
163
  Layout->addWidget(ProgDirButton,Row++,2,1,1);
 
164
  connect(ProgDirButton,SIGNAL(clicked()),this,SLOT(ProgDirBrowse()));
 
165
};
 
166
 
 
167
 
 
168
void  sDirsPage::initializePage ()
 
169
{
 
170
//  qDebug() << "sDirsPage::initializePage";
 
171
//  Data->ProgDirDefaultLocation = "~/ResearchAssistant";
 
172
//  if( Prj->Core ){
 
173
//    Data->ProgDirDefaultName = QString("RA.")
 
174
//                             + Prj->Core->Version.Principal().Text();
 
175
//  };
 
176
////  setField("ProgDir",Data->ProgDirDefaultLocation
 
177
////                    +QDir::separator()
 
178
////                    +Data->ProgDirDefaultName);
 
179
////  Data->ProgDir = QDir( field("ProgDir").toString() );
 
180
//  Data->ProgDir = QDir(Data->ProgDirDefaultLocation
 
181
//                    +QDir::separator()
 
182
//                    +Data->ProgDirDefaultName);
 
183
//  setField("ProgDir",Data->ProgDir.absolutePath());
 
184
};
 
185
 
 
186
 
 
187
void  sDirsPage::ProgDirBrowse ()
 
188
{
 
189
  QFileDialog                   D;
 
190
  D.setWindowTitle(tr("Select program folder"));
 
191
  D.setFileMode(QFileDialog::Directory);
 
192
  if( ! field("ProgDir").toString().simplified().isEmpty() )
 
193
    D.setDirectory(field("ProgDir").toString().simplified());
 
194
  if( D.exec() && ! D.selectedFiles().empty() ){
 
195
    QString                     FileName(D.selectedFiles().at(0));
 
196
    QDir                        PDir(FileName);
 
197
    setField("ProgDir",FileName);
 
198
    emit completeChanged();
 
199
  };
 
200
};
 
201
 
 
202
 
 
203
bool  sDirsPage::FindPreviousInstallations ()
 
204
{
 
205
  return false;
 
206
};
 
207
 
 
208
 
 
209
bool  sDirsPage::isComplete () const
 
210
{
 
211
  qDebug() << "sDirsPage::isComplete";
 
212
  if( ! field("ProgDir").toString().simplified().isEmpty() ){
 
213
    Data->ProgDir = QDir( field("ProgDir").toString().simplified() );
 
214
    qDebug() << "ProgDir:" << Data->ProgDir.absolutePath();
 
215
    return  Data->ProgDir.exists();
 
216
  };
 
217
  return false;
 
218
};
 
219
 
 
220
//---------------------------------------------------------------- sDirsPage ---
 
221
 
 
222
sSelectionPage::sSelectionPage (psProjectInfo           prj
 
223
                               ,sInstallWizard::psData  data)
 
224
    :Prj(prj)
 
225
    ,Data(data)
 
226
{
 
227
  setTitle("Select program parts");
 
228
  setSubTitle(" ");
 
229
 
 
230
  int                         Row = 0;
 
231
  QGridLayout *               Layout = new QGridLayout;
 
232
  QCheckBox *                 Chkbox;
 
233
  QLabel *                    Label;
 
234
 
 
235
  setLayout(Layout);
 
236
  if( Prj->Core ){
 
237
    Chkbox = new QCheckBox(tr("Install RA program"));
 
238
    Layout->addWidget(Chkbox,Row,1,1,2);
 
239
    Chkbox->setChecked(true);
 
240
    registerField(QString("ra_core"),Chkbox);
 
241
    connect(Chkbox,SIGNAL(toggled(bool)),this,SLOT(Validate(bool)));
 
242
 
 
243
    Label = new QLabel(tr("version: %1")
 
244
                      .arg(ToQString(Prj->Core->Version.Text())));
 
245
    Layout->addWidget(Label,Row++,3,1,1);
 
246
 
 
247
    Label = new QLabel(tr("with the following plugins:"));
 
248
    Layout->addWidget(Label,Row++,1,1,3,Qt::AlignHCenter);
 
249
  }else{
 
250
    Label = new QLabel(tr("Install the following plugins:"));
 
251
    Layout->addWidget(Label,Row++,1,1,3,Qt::AlignHCenter);
 
252
  };
 
253
  for( QStringList::const_iterator  P = Prj->Plugins.constBegin()
 
254
                                  ; P != Prj->Plugins.constEnd(); ++P ){
 
255
    Chkbox = new QCheckBox( *P );
 
256
    Layout->addWidget(Chkbox,Row,2,1,1);
 
257
    Chkbox->setChecked(true);
 
258
    registerField(QString("rap_")+(*P),Chkbox);
 
259
    connect(Chkbox,SIGNAL(toggled(bool)),this,SLOT(Validate(bool)));
 
260
 
 
261
    Label = new QLabel(tr("version: %1")
 
262
                      .arg(ToQString(Prj->Plugin[*P]
 
263
                                                   ->Version.Text())));
 
264
    Layout->addWidget(Label,Row++,3,1,1);
 
265
  };
 
266
};
 
267
 
 
268
 
 
269
void  sSelectionPage::Validate (bool  checked)
 
270
{
 
271
  QStringList::const_iterator P;
 
272
  if( checked ){
 
273
    for( P = Prj->Plugins.constBegin() ;
 
274
           P != Prj->Plugins.constEnd(); ++P ){
 
275
      if( field( QString("rap_") + (*P) ).toBool() ){
 
276
        if( Prj->Core )
 
277
          setField(QString("ra_core"),true);
 
278
      };
 
279
    };
 
280
  }else{
 
281
    if( Prj->Core && ! field( QString("ra_core") ).toBool() ){
 
282
      for( P = Prj->Plugins.constBegin() ;
 
283
             P != Prj->Plugins.constEnd(); ++P ){
 
284
        setField( QString("rap_") + (*P) , false );
 
285
      };
 
286
    };
 
287
  };
 
288
};
 
289
 
 
290
//------------------------------------------------------------- sLicensePage ---
 
291
 
 
292
sLicensePage::sLicensePage ()
 
293
{
 
294
  setTitle("License Agreement");
 
295
  setSubTitle("Please read the license.");
 
296
 
 
297
  QVBoxLayout *               Layout = new QVBoxLayout;
 
298
  setLayout(Layout);
 
299
 
 
300
//  QTextBrowser *              Viewer = new QTextBrowser;
 
301
//  Layout->addWidget(Viewer);
 
302
//  Viewer->setSource(QUrl("ShortLicense.html"));
 
303
 
 
304
  Viewer = new QTextEdit;
 
305
  Viewer->setReadOnly(true);
 
306
  Viewer->setMinimumWidth(600);
 
307
  Viewer->setMinimumHeight(350);
 
308
  Layout->addWidget(Viewer);
 
309
 
 
310
  btnIntro = new QPushButton("Back to the brief license overview");
 
311
  Layout->addWidget(btnIntro);
 
312
  connect(btnIntro,SIGNAL(clicked()) ,this,SLOT(ShowIntro()));
 
313
 
 
314
  btnGPL = new QPushButton("Show me GNU General Public License");
 
315
  Layout->addWidget(btnGPL);
 
316
  connect(btnGPL,SIGNAL(clicked()) ,this,SLOT(ShowGPL()));
 
317
 
 
318
  btnFDL = new QPushButton("Show me GNU Free Documentation License");
 
319
  Layout->addWidget(btnFDL);
 
320
  connect(btnFDL,SIGNAL(clicked()) ,this,SLOT(ShowFDL()));
 
321
 
 
322
  chkboxAgree = new QCheckBox(tr("  I accept the license agreement  "));
 
323
  Layout->addWidget(chkboxAgree);
 
324
 
 
325
  connect(chkboxAgree,SIGNAL(clicked())
 
326
         ,this,SIGNAL(completeChanged()));
 
327
};
 
328
 
 
329
 
 
330
void  sLicensePage::initializePage ()
 
331
{
 
332
  ShowIntro();
 
333
};
 
334
 
 
335
 
 
336
void  sLicensePage::ShowIntro ()
 
337
{
 
338
  QFile                       file("Licenses(briefly).html");
 
339
  if( ! file.open(QFile::ReadOnly | QFile::Text) ){
 
340
    QMessageBox::warning(this, tr("install")
 
341
                        ,tr("Cannot read file %1:\n%2.")
 
342
                           .arg(file.fileName()).arg(file.errorString()));
 
343
  }else{
 
344
    QTextStream               in(&file);
 
345
    in.setCodec("UTF-8"); //QTextCodec::codecForName("utf8") ??
 
346
    QApplication::setOverrideCursor(Qt::WaitCursor);
 
347
    Viewer->setHtml(in.readAll());
 
348
    QApplication::restoreOverrideCursor();
 
349
    btnIntro->setVisible(false);
 
350
    btnGPL->setVisible(true);
 
351
    btnFDL->setVisible(true);
 
352
  };
 
353
};
 
354
 
 
355
 
 
356
void  sLicensePage::ShowGPL ()
 
357
{
 
358
  QFile                       file("GNU_GPL_3_0.html");
 
359
  if( ! file.open(QFile::ReadOnly | QFile::Text) ){
 
360
    QMessageBox::warning(this, tr("install")
 
361
                        ,tr("Cannot read file %1:\n%2.")
 
362
                           .arg(file.fileName()).arg(file.errorString()));
 
363
  }else{
 
364
    QTextStream               in(&file);
 
365
    in.setCodec("UTF-8"); //QTextCodec::codecForName("utf8") ??
 
366
    QApplication::setOverrideCursor(Qt::WaitCursor);
 
367
    Viewer->setHtml(in.readAll());
 
368
    QApplication::restoreOverrideCursor();
 
369
    btnIntro->setVisible(true);
 
370
    btnGPL->setVisible(false);
 
371
    btnFDL->setVisible(true);
 
372
  };
 
373
};
 
374
 
 
375
 
 
376
void  sLicensePage::ShowFDL ()
 
377
{
 
378
  QFile                       file("GNU_FDL_1_3.html");
 
379
  if( ! file.open(QFile::ReadOnly | QFile::Text) ){
 
380
    QMessageBox::warning(this, tr("install")
 
381
                        ,tr("Cannot read file %1:\n%2.")
 
382
                           .arg(file.fileName()).arg(file.errorString()));
 
383
  }else{
 
384
    QTextStream               in(&file);
 
385
    in.setCodec("UTF-8"); //QTextCodec::codecForName("utf8") ??
 
386
    QApplication::setOverrideCursor(Qt::WaitCursor);
 
387
    Viewer->setHtml(in.readAll());
 
388
    QApplication::restoreOverrideCursor();
 
389
    btnIntro->setVisible(true);
 
390
    btnGPL->setVisible(true);
 
391
    btnFDL->setVisible(false);
 
392
  };
 
393
};
 
394
 
 
395
 
 
396
bool  sLicensePage::isComplete () const
 
397
{
 
398
  return  chkboxAgree->isChecked();
 
399
};
 
400
 
 
401
//------------------------------------------------------ sReadyToInstallPage ---
 
402
 
 
403
sReadyToInstallPage::sReadyToInstallPage ()
 
404
    :sReadyPage("Ready to install","Install")
 
405
{
 
406
};
 
407
 
 
408
//-------------------------------------------------------- sInstallationPage ---
 
409
 
 
410
sInstallationPage::sInstallationPage (psProjectInfo           prj
 
411
                                     ,sInstallWizard::psData  data)
 
412
    :sDoItPage("Installing...","Please, wait...","Done","Thanks","Error")
 
413
    ,Prj(prj)
 
414
    ,Data(data)
 
415
{
 
416
};
 
417
 
 
418
 
 
419
bool  sInstallationPage::Job ()
 
420
{
 
421
  bool                        OK = true;
 
422
  QString                     UnzipProg;
 
423
  if( Data->System == "unix" ){
 
424
    UnzipProg = "./7za";
 
425
  }else if( Data->System == "win32" ){
 
426
    UnzipProg = "7za.exe";
 
427
  };
 
428
  if( Prj->Core && field("ra_core").toBool() ){
 
429
    OK = OK && Execute(UnzipProg
 
430
                      ,QStringList() << "x" << "-y"
 
431
                          << QString("-o")+Data->ProgDir.absolutePath()
 
432
                          << QString("RA.core.")
 
433
                            + ToQString(Prj->Core->Version.Valuable().Text())
 
434
                            + "." + Data->System + ".zip"
 
435
                      ,qApp->applicationDirPath()
 
436
                      );
 
437
    OK = OK && Execute(UnzipProg
 
438
                      ,QStringList() << "x" << "-y"
 
439
                          << QString("-o")+Data->ProgDir.absolutePath()
 
440
                          << QString("Qt_libs")
 
441
                            + "." + Data->System + ".zip"
 
442
                      ,qApp->applicationDirPath()
 
443
                      );
 
444
  };
 
445
  for( QStringList::const_iterator  P = Prj->Plugins.constBegin()
 
446
                                  ; P != Prj->Plugins.constEnd(); ++P ){
 
447
    if( field(QString("rap_")+(*P)).toBool() ){
 
448
      OK = OK && Execute(UnzipProg
 
449
                        ,QStringList() << "x" << "-y"
 
450
                            << QString("-o")+Data->ProgDir.absolutePath()
 
451
                            << QString("RA.") + *P + "."
 
452
                              + ToQString(Prj->Plugin[*P]->Version.Valuable().Text())
 
453
                              + "." + Data->System + ".zip"
 
454
                        ,qApp->applicationDirPath()
 
455
                        );
 
456
    };
 
457
  };
 
458
  if( Data->System == "unix" ){
 
459
    OK = OK && Execute( QString("./RA.sh")
 
460
                      , QStringList() << "install"
 
461
                      ,Data->ProgDir.absolutePath()
 
462
                      );
 
463
  }else if( Data->System == "win32" ){
 
464
    OK = OK && Execute( QString("cmd")
 
465
                      , QStringList() << "/c" << "ra" << "install"
 
466
                      ,Data->ProgDir.absoluteFilePath("bin")
 
467
                      );
 
468
  };
 
469
  return OK;
 
470
};
 
471
 
 
472
 
 
473
//void  sInstallationPage::Install ()
 
474
//{
 
475
//  QProcess *                  Process;
 
476
//  QString                     UnzipProgName;
 
477
//  QString                     UnzipArgumentTemplate;
 
478
//  QString                     UnzipArgument;
 
479
//  QStringList                 UnzipArguments;
 
480
//  QString                     ZipFileName;
 
481
//  int                         t;
 
482
//
 
483
////  UnzipProgName = "unzip";
 
484
////  UnzipArgumentTemplate = "-uoq %2 -d %1"; //%1 -destdir, %2 - zip-file
 
485
//  UnzipProgName = QLatin1String("7za");
 
486
//  UnzipArgumentTemplate = "x -o%1 %2"; //%1 -destdir, %2 - zip-file
 
487
//
 
488
//  UnzipProgName = qApp->applicationDirPath()
 
489
//                + QDir::separator()
 
490
//                + UnzipProgName;
 
491
//
 
492
//  ZipFileName = QString("RA.")
 
493
//              + QString().setNum(Data->VerMajor)
 
494
//              + QString(".")
 
495
//              + QString().setNum(Data->VerMinor)
 
496
//              + QString(".core.")
 
497
//              + QString().setNum(Data->CoreVerPatch)
 
498
//              + QString(".")+Data->System+QString(".zip");
 
499
//  UnzipArgument = UnzipArgumentTemplate.arg( field("ProgDir").toString() )
 
500
//                                       .arg( ZipFileName );
 
501
////  UnzipArguments << QString("x")
 
502
////                 << QString("-o") + field("ProgDir").toString()
 
503
////                 << ZipFileName;
 
504
//  UnzipArguments << UnzipArgument;
 
505
//  qDebug() << UnzipProgName << UnzipArguments;
 
506
//  qDebug() << qApp->applicationDirPath();
 
507
//  Process = new QProcess;
 
508
//  Process->start(UnzipProgName,UnzipArguments);
 
509
//  if( ! Process->waitForStarted() ){
 
510
//    qDebug() << "cannot start";
 
511
//  }else{
 
512
//    qDebug() << "started";
 
513
//    t = 0;
 
514
//    while( ! Process->waitForFinished(100) ){
 
515
//      t++;
 
516
//      qDebug() << "working" << t; // << Process->read();
 
517
//      if( t > 200 ){
 
518
//        qDebug() << "cannot finish";
 
519
//        return;
 
520
//      };
 
521
//    };
 
522
//    qDebug() << "Yahoo!" << Process->readAll();
 
523
//  };
 
524
 
 
525
//  //it works!!!
 
526
//  Process->start(QLatin1String("../bin-debug/RAlgebrad"),UnzipArguments);
 
527
//  if( ! Process->waitForStarted() ){
 
528
//    qDebug() << "cannot start";
 
529
//  }else{
 
530
//    qDebug() << "started";
 
531
//    t = 0;
 
532
//    while( ! Process->waitForFinished(1000) ){
 
533
//      t++;
 
534
//      qDebug() << "working" << t;
 
535
//      if( t > 20 ){
 
536
//        qDebug() << "cannot finish";
 
537
//        return;
 
538
//      };
 
539
//    };
 
540
//    qDebug() << "Yahoo!";
 
541
//  };
 
542
 
 
543
//  //it works!!!
 
544
//  Process->start(QLatin1String("../bin-debug/RAlgebrad"),UnzipArguments);
 
545
//  if( ! Process->waitForStarted() )
 
546
//    qDebug() << "cannot start";
 
547
//  if( ! Process->waitForFinished(20000) ){
 
548
//    qDebug() << "cannot finish";
 
549
//  }else{
 
550
//    qDebug() << "Yahoo!";
 
551
//  };
 
552
 
 
553
//  //it works, but the second loop never finishes
 
554
//  Process->start(QLatin1String("/media/data/Vik/Prog/RA/bin-debug/RAlgebrad"),UnzipArguments);
 
555
//  t = 0;
 
556
//  while( ! Process->waitForStarted(10) ){
 
557
//    t++;
 
558
//    qDebug() << "starting" << t;
 
559
//    if( t > 8 )  break;
 
560
//  };
 
561
//  qDebug() << "It took " << t << "cs";
 
562
//  t = 0;
 
563
//  while( Process->state() == QProcess::Running ){
 
564
//    t++;
 
565
//    qDebug() << "working" << t;
 
566
//  };
 
567
//  qDebug() << "It took " << t << "s";
 
568
 
 
569
 
 
570
//  {
 
571
//    QProcess *                  TheProcess = new QProcess;
 
572
//    QStringList                 Arguments;
 
573
//    QString                     TheQtAssistantProgram;
 
574
//    TheQtAssistantProgram = QLatin1String("assistant");
 
575
//
 
576
//    TheProcess->start(TheQtAssistantProgram, Arguments);
 
577
//
 
578
//    if( ! TheProcess->waitForStarted() ){
 
579
//      TheQtAssistantProgram = QLibraryInfo::location(QLibraryInfo::BinariesPath)
 
580
//                            + QDir::separator()
 
581
//                            +TheQtAssistantProgram;
 
582
//
 
583
//      if( TheProcess->state() == QProcess::Running ){
 
584
//        TheProcess->terminate();
 
585
//        TheProcess->waitForFinished(3000);
 
586
//      };
 
587
//      TheProcess->start(TheQtAssistantProgram, Arguments);
 
588
//
 
589
//      if( ! TheProcess->waitForStarted() ){
 
590
//        QMessageBox::critical(NULL
 
591
//                             ,tr("Researh Assistant")
 
592
//                             ,tr("Unable to launch (%1)")
 
593
//                                .arg(TheQtAssistantProgram) );
 
594
//      };
 
595
//    };
 
596
//  };
 
597
//};
 
598
 
 
599
//---------------------------------------------------------- sConclusionPage ---
 
600
 
 
601
sConclusionPage::sConclusionPage ()
 
602
{
 
603
  setTitle("Conclusion");
 
604
 
 
605
  QVBoxLayout *               Layout = new QVBoxLayout;
 
606
  setLayout(Layout);
 
607
 
 
608
  QLabel *                    Label = new QLabel(tr(
 
609
      "Done.\n"
 
610
      "Have a nice day!"
 
611
                                                    ));
 
612
  Label->setWordWrap(true);
 
613
  Layout->addWidget(Label);
 
614
};
 
615
 
 
616
//------------------------------------------------------------------------------
 
617
}; //namespace RA/*RADist*/
 
618
 
 
619
 
 
620