aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fileinfo/main.cpp
blob: 46f83831dd2a39d4c19f57109ca27363dbe61ea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <QTranslator>
#include <QApplication>
#include <QDebug>
#include <QFile>

#include "MainUI.h"
#include <LUtils.h>
#include <LuminaThemes.h>

int main(int argc, char ** argv)
{
  LTHEME::LoadCustomEnvSettings();
  QApplication a(argc, argv);
  LUtils::LoadTranslation(&a, "l-fileinfo");
  LuminaThemeEngine theme(&a);


  //Read the input variables
  QString path = "";
  QString flag = "";
  for(int i=1; i<argc; i++){
    if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); }
    else{ path = QString(argv[i]); break; }
  }
  //Check the input variables
  // - path
  if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); }
  // - flag
  if(!flag.isEmpty()){
    if(flag=="-application"){
      flag = "APP"; //for internal use
    }else if(flag=="-link"){
      flag = "LINK"; //for internal use
    }else{
      //Invalid flag - clear the path as well
      flag.clear();
      path.clear();
    }
  }
  if(!path.isEmpty() || !flag.isEmpty()){ 
    MainUI w;
      QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
    w.LoadFile(path, flag);
    w.show();
    int retCode = a.exec();
    return retCode;
  }else{
    //Show an error text and exit
    qDebug() << "ERROR: Invalid input arguments";
    qDebug() << "Usage: \"lumina-fileinfo [-application | -link] [file]";
    return 1;
  }


}
bgstack15