Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. a function-definition is not allowed here before ‘{’ token
Forum Updated to NodeBB v4.3 + New Features

a function-definition is not allowed here before ‘{’ token

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 6 Posters 4.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by J.Hilk
    #2

    @AntonioValentin

    the error message is quite accurate,

    void BootWindow::create_treatments() is missing it's closing bracket }


    actually that is incorrect of me, the closing } is there, but your import_programms() function definition is inside the create_treatments() function.
    Move it out of there.


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    A 1 Reply Last reply
    2
    • KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #3

      @AntonioValentin said in a function-definition is not allowed here before ‘{’ token:

      Can anyone help me?

      I would suggest you to take a look at line 298...

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      3
      • A Offline
        A Offline
        AntonioValentin
        wrote on last edited by
        #4

        963.png

        1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @AntonioValentin

          the error message is quite accurate,

          void BootWindow::create_treatments() is missing it's closing bracket }


          actually that is incorrect of me, the closing } is there, but your import_programms() function definition is inside the create_treatments() function.
          Move it out of there.

          A Offline
          A Offline
          AntonioValentin
          wrote on last edited by
          #5

          @J-Hilk

          Can you give me an example where it is missing?

          void BootWindow::create_treatments() {
              if(Agejet::actual_language_name == "ita"){
          
                  Treatment *t = new Treatment(0,QString("Ringiovanimento cutaneo"));
                  tr_type sr1{"Epidermide","Epidermide\nVery Low Energy \n1 J","viso completo - collo \ndécolleté - mani ",1,"1-4","2-3 giorni","4 settimane",1,1,true};
                  tr_type sr2{"Derma Superficiale","Derma \nSuperficiale\nLow Energy \n1.5 J","viso completo - collo \ndécolleté - mani ",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                  tr_type sr3{"Derma Reticolare","Derma \nReticolare \nHigh Energy \n3 J","viso completo - collo \ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,3,false};
                  tr_type sr4{"Rimodellamento Profondo","Rimodellamento \nProfondo \nHigh Energy\n4 J","viso completo - collo\ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,4,false};
                  t->add_tr_type(sr1);
                  t->add_tr_type(sr2);
                  t->add_tr_type(sr3);
                  t->add_tr_type(sr4);
                  Agejet::skin_resurfacing=t;
          
                  t = new Treatment(1,QString("Lassità Cutanea"));
                  tr_type sl1{"Lassità Cutanea","Lassità Cutanea \n2 J","nasolabiale",2,"1-4","5-7 giorni","non definito",1,2,false};
                  t->add_tr_type(sl1);
                  Agejet::skin_laxity=t;
          
                  t = new Treatment(2,QString("Cicatrici da Acne"));
                  tr_type as1{"Cicatrici da Acne","Cicatrici da Acne \n4 J","cicatrici",1,"1-4","7-10 giorni","non definito",1,4,false};
                  t->add_tr_type(as1);
                  Agejet::acne=t;
          
                  t = new Treatment(3,QString("Iperpigmentazione"));
                  tr_type pi1{"Low Energy","Viso\nLow Energy \n1.5 J","macchie del viso",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                  t->add_tr_type(pi1);
                  tr_type pi2{"High Energy","Viso\nHigh Energy \n2.5 J","macchie del viso",1,"1-4","5-7 giorni","non definito",1,2.5,false};
                  t->add_tr_type(pi2);
                  tr_type pi3{"High Energy","Corpo \nHigh Energy \n3 J","macchie cutanee \n(corpo)",1,"1-4","5-7 giorni","non definito",1,3,false};
                  t->add_tr_type(pi3);
                  Agejet::pigmentation=t;
          
                  t = new Treatment(4,QString("Blefaroplastica non chirurgica"));
                  tr_type bl1{"Blefaroplastica \nnon chirurgica","Blefaroplastica \nnon chirurgica \n3.5 J","regione periorbitale",1,"1-4","7-10 giorni","non definito",1,3.5,false};
                  t->add_tr_type(bl1);
                  Agejet::blefaro=t;
          
                  t = new Treatment(5,QString("Trattamento personalizzato"));
                  tr_type cu1{"Trattamento personalizzato","","",1,"","","",1,3.5,false};
                  Agejet::custom=t;
                  t->add_tr_type(cu1);
              }
              else {
                  if (Agejet::actual_language_name == "eng"){
          
                  Treatment *t = new Treatment(0,QString("Skin Resurfacing"));
                  tr_type sr1{"Upper Layer","Upper Layer\nVery Low Energy \n1 J","full face - neck \ndécolletage - hand ",1,"1-4","2-3 days","4 weeks",1,1,true};
                  tr_type sr2{"Upper Dermis ","Upper Dermis\nLow Energy \n1.5 J","full face - neck \ndécolletage - hand ",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                  tr_type sr3{"Middle Dermis","Middle Dermis \nHigh Energy \n3 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,3,false};
                  tr_type sr4{"Deep Resurfacing","Deep \nRemodeling \nHigh Energy\n4 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,4,false};
                  t->add_tr_type(sr1);
                  t->add_tr_type(sr2);
                  t->add_tr_type(sr3);
                  t->add_tr_type(sr4);
                  Agejet::skin_resurfacing=t;
          
                  t = new Treatment(1,QString("Skin Laxity"));
                  tr_type sl1{"Skin Laxity","Skin Laxity \n2 J","nasolabial",2,"1-4","5-7 days","not defined weeks",1,2,false};
                  t->add_tr_type(sl1);
                  Agejet::skin_laxity=t;
          
                  t = new Treatment(2,QString("Acne Scares"));
                  tr_type as1{"Acne Scares","Acne Scars \n4 J","scars",1,"1-4","7-10 days","not defined weeks",1,4,false};
                  t->add_tr_type(as1);
                  Agejet::acne=t;
          
                  t = new Treatment(3,QString("Hyperpigmentation"));
                  tr_type pi1{"Low Energy","Face\nLow Energy \n1.5 J","facial skin patches",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                  t->add_tr_type(pi1);
                  tr_type pi2{"High Energy","Face\nHigh Energy \n2.5 J","facial skin patches",1,"1-4","5-7 days","not defined weeks",1,2.5,false};
                  t->add_tr_type(pi2);
                  tr_type pi3{"High Energy","Body \nHigh Energy \n3 J","skin patches \n(body)",1,"1-4","5-7 days","not defined weeks",1,3,false};
                  t->add_tr_type(pi3);
                  Agejet::pigmentation=t;
          
                  t = new Treatment(4,QString("Non-surgical  Blepharoplasty"));
                  tr_type bl1{"Non-surgical\nBlefaroplasty","Non-surgical\nBlepharoplasty \n3.5 J","ocular Zone",1,"1-4","7-10 days","not defined weeks",1,3.5,false};
                  t->add_tr_type(bl1);
                  Agejet::blefaro=t;
          
                  t = new Treatment(5,QString("Custom"));
                  tr_type cu1{"Custom","","",1,"","","",1,2,false};
                  Agejet::custom=t;
                  t->add_tr_type(cu1);
              }
              else {
                  if(Agejet::actual_language_name == "rus"){
          
                   Treatment *t = new Treatment(0,QString("Шлифовка кожи"));
                   tr_type sr1{"ВЕРХНИЙ \n СЛОЙ КОЖИ","ВЕРХНИЙ \n СЛОЙ КОЖИ \n Очень \n низкая мощн. \n1 Дж","лицо - шея - \nзона декольте  - руки ",1,"1-4","2-3 дня","4 недели",1,1,true};
                   tr_type sr2{"ВНУТРЕННИЙ \n СЛОЙ КОЖИ/ДЕРМА","ВНУТРЕННИЙ \n СЛОЙ КОЖИ/\n ДЕРМА \n Низкая мощн. \n1.5 Дж","лицо - шея -\n зона декольте  - руки ",1,"1-4","4-5 дней","3 недели",1,1.5,true};
          
                   tr_type sr3{"РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ","РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ \n Высокая мощн. \n3 Дж","Лицо - шея - \nзона декольте - руки ",1,"1-4","7-10 дней","не задано",1,3,false};
                   tr_type sr4{"ГЛУБОКОЕ РЕМОДЕЛИРОВАНИЕ КОЖИ","ГЛУБОКОЕ \n РЕМОДЕЛИРОВ-Е \n КОЖИ \n  Высокая мощн.\n4 Дж","лицо- шея -\n зона декольте - руки",1,"1-4","7-10 дней","не задано",1,4,false};
                   t->add_tr_type(sr1);
                   t->add_tr_type(sr2);
                   t->add_tr_type(sr3);
                   t->add_tr_type(sr4);
                   Agejet::skin_resurfacing=t;
          
                   t = new Treatment(1,QString("Вялость кожи"));
                   tr_type sl1{"Вялость кожи","Вялость кожи \n2 Дж","носогубная\n",2,"1-4","5-7 дней","не задано",1,2,false};
                   t->add_tr_type(sl1);
                   Agejet::skin_laxity=t;
          
                   t = new Treatment(2,QString("Шрамы постакне"));
          
                   tr_type as1{"Шрамы \n постакне","Шрамы \n постакне \n4 Дж","рубцы\n",1,"1-4","7-10 дней","не задано",1,4,false};
                   t->add_tr_type(as1);
                   Agejet::acne=t;
          
                   t = new Treatment(3,QString("Гиперпигментация"));
                   tr_type pi1{"Низкая мощность","Лицо\n Низкая мощн. \n1.5 Дж","пигментные пятна \nна лице",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                   t->add_tr_type(pi1);
                   tr_type pi2{"Высокая мощность","Лицо\n Высокая мощн. \n2.5 Дж","пигментные пятна \nна лице",1,"1-4","5-7 дней","не задано",1,2.5,false};
                   t->add_tr_type(pi2);
                   tr_type pi3{"Высокая мощность","Тело \n Высокая мощн. \n3 Дж","пятна на коже \n(тело)",1,"1-4","5-7 дней","не задано",1,3,false};
                   t->add_tr_type(pi3);
                   Agejet::pigmentation=t;
                   t = new Treatment(4,QString("Нехирургическая \n блефаропластика"));
          
                   tr_type bl1{"Нехирургическая \n блефаропластика","Нехирургическая\n блефаропластика \n3.5 Дж","периорбитальная зона\n",1,"1-4","7-10 дней","не задано",1,3.5,false};
                   t->add_tr_type(bl1);
                   Agejet::blefaro=t;
          
                   t = new Treatment(5,QString("Персонализированные процедуры"));
                   tr_type cu1{"Персонализированные процедуры","","",1,"","","",1,2,false};
                   Agejet::custom=t;
                   t->add_tr_type(cu1);
              }
           }
          
          jsulmJ KroMignonK 2 Replies Last reply
          0
          • A AntonioValentin

            @J-Hilk

            Can you give me an example where it is missing?

            void BootWindow::create_treatments() {
                if(Agejet::actual_language_name == "ita"){
            
                    Treatment *t = new Treatment(0,QString("Ringiovanimento cutaneo"));
                    tr_type sr1{"Epidermide","Epidermide\nVery Low Energy \n1 J","viso completo - collo \ndécolleté - mani ",1,"1-4","2-3 giorni","4 settimane",1,1,true};
                    tr_type sr2{"Derma Superficiale","Derma \nSuperficiale\nLow Energy \n1.5 J","viso completo - collo \ndécolleté - mani ",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                    tr_type sr3{"Derma Reticolare","Derma \nReticolare \nHigh Energy \n3 J","viso completo - collo \ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,3,false};
                    tr_type sr4{"Rimodellamento Profondo","Rimodellamento \nProfondo \nHigh Energy\n4 J","viso completo - collo\ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,4,false};
                    t->add_tr_type(sr1);
                    t->add_tr_type(sr2);
                    t->add_tr_type(sr3);
                    t->add_tr_type(sr4);
                    Agejet::skin_resurfacing=t;
            
                    t = new Treatment(1,QString("Lassità Cutanea"));
                    tr_type sl1{"Lassità Cutanea","Lassità Cutanea \n2 J","nasolabiale",2,"1-4","5-7 giorni","non definito",1,2,false};
                    t->add_tr_type(sl1);
                    Agejet::skin_laxity=t;
            
                    t = new Treatment(2,QString("Cicatrici da Acne"));
                    tr_type as1{"Cicatrici da Acne","Cicatrici da Acne \n4 J","cicatrici",1,"1-4","7-10 giorni","non definito",1,4,false};
                    t->add_tr_type(as1);
                    Agejet::acne=t;
            
                    t = new Treatment(3,QString("Iperpigmentazione"));
                    tr_type pi1{"Low Energy","Viso\nLow Energy \n1.5 J","macchie del viso",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                    t->add_tr_type(pi1);
                    tr_type pi2{"High Energy","Viso\nHigh Energy \n2.5 J","macchie del viso",1,"1-4","5-7 giorni","non definito",1,2.5,false};
                    t->add_tr_type(pi2);
                    tr_type pi3{"High Energy","Corpo \nHigh Energy \n3 J","macchie cutanee \n(corpo)",1,"1-4","5-7 giorni","non definito",1,3,false};
                    t->add_tr_type(pi3);
                    Agejet::pigmentation=t;
            
                    t = new Treatment(4,QString("Blefaroplastica non chirurgica"));
                    tr_type bl1{"Blefaroplastica \nnon chirurgica","Blefaroplastica \nnon chirurgica \n3.5 J","regione periorbitale",1,"1-4","7-10 giorni","non definito",1,3.5,false};
                    t->add_tr_type(bl1);
                    Agejet::blefaro=t;
            
                    t = new Treatment(5,QString("Trattamento personalizzato"));
                    tr_type cu1{"Trattamento personalizzato","","",1,"","","",1,3.5,false};
                    Agejet::custom=t;
                    t->add_tr_type(cu1);
                }
                else {
                    if (Agejet::actual_language_name == "eng"){
            
                    Treatment *t = new Treatment(0,QString("Skin Resurfacing"));
                    tr_type sr1{"Upper Layer","Upper Layer\nVery Low Energy \n1 J","full face - neck \ndécolletage - hand ",1,"1-4","2-3 days","4 weeks",1,1,true};
                    tr_type sr2{"Upper Dermis ","Upper Dermis\nLow Energy \n1.5 J","full face - neck \ndécolletage - hand ",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                    tr_type sr3{"Middle Dermis","Middle Dermis \nHigh Energy \n3 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,3,false};
                    tr_type sr4{"Deep Resurfacing","Deep \nRemodeling \nHigh Energy\n4 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,4,false};
                    t->add_tr_type(sr1);
                    t->add_tr_type(sr2);
                    t->add_tr_type(sr3);
                    t->add_tr_type(sr4);
                    Agejet::skin_resurfacing=t;
            
                    t = new Treatment(1,QString("Skin Laxity"));
                    tr_type sl1{"Skin Laxity","Skin Laxity \n2 J","nasolabial",2,"1-4","5-7 days","not defined weeks",1,2,false};
                    t->add_tr_type(sl1);
                    Agejet::skin_laxity=t;
            
                    t = new Treatment(2,QString("Acne Scares"));
                    tr_type as1{"Acne Scares","Acne Scars \n4 J","scars",1,"1-4","7-10 days","not defined weeks",1,4,false};
                    t->add_tr_type(as1);
                    Agejet::acne=t;
            
                    t = new Treatment(3,QString("Hyperpigmentation"));
                    tr_type pi1{"Low Energy","Face\nLow Energy \n1.5 J","facial skin patches",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                    t->add_tr_type(pi1);
                    tr_type pi2{"High Energy","Face\nHigh Energy \n2.5 J","facial skin patches",1,"1-4","5-7 days","not defined weeks",1,2.5,false};
                    t->add_tr_type(pi2);
                    tr_type pi3{"High Energy","Body \nHigh Energy \n3 J","skin patches \n(body)",1,"1-4","5-7 days","not defined weeks",1,3,false};
                    t->add_tr_type(pi3);
                    Agejet::pigmentation=t;
            
                    t = new Treatment(4,QString("Non-surgical  Blepharoplasty"));
                    tr_type bl1{"Non-surgical\nBlefaroplasty","Non-surgical\nBlepharoplasty \n3.5 J","ocular Zone",1,"1-4","7-10 days","not defined weeks",1,3.5,false};
                    t->add_tr_type(bl1);
                    Agejet::blefaro=t;
            
                    t = new Treatment(5,QString("Custom"));
                    tr_type cu1{"Custom","","",1,"","","",1,2,false};
                    Agejet::custom=t;
                    t->add_tr_type(cu1);
                }
                else {
                    if(Agejet::actual_language_name == "rus"){
            
                     Treatment *t = new Treatment(0,QString("Шлифовка кожи"));
                     tr_type sr1{"ВЕРХНИЙ \n СЛОЙ КОЖИ","ВЕРХНИЙ \n СЛОЙ КОЖИ \n Очень \n низкая мощн. \n1 Дж","лицо - шея - \nзона декольте  - руки ",1,"1-4","2-3 дня","4 недели",1,1,true};
                     tr_type sr2{"ВНУТРЕННИЙ \n СЛОЙ КОЖИ/ДЕРМА","ВНУТРЕННИЙ \n СЛОЙ КОЖИ/\n ДЕРМА \n Низкая мощн. \n1.5 Дж","лицо - шея -\n зона декольте  - руки ",1,"1-4","4-5 дней","3 недели",1,1.5,true};
            
                     tr_type sr3{"РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ","РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ \n Высокая мощн. \n3 Дж","Лицо - шея - \nзона декольте - руки ",1,"1-4","7-10 дней","не задано",1,3,false};
                     tr_type sr4{"ГЛУБОКОЕ РЕМОДЕЛИРОВАНИЕ КОЖИ","ГЛУБОКОЕ \n РЕМОДЕЛИРОВ-Е \n КОЖИ \n  Высокая мощн.\n4 Дж","лицо- шея -\n зона декольте - руки",1,"1-4","7-10 дней","не задано",1,4,false};
                     t->add_tr_type(sr1);
                     t->add_tr_type(sr2);
                     t->add_tr_type(sr3);
                     t->add_tr_type(sr4);
                     Agejet::skin_resurfacing=t;
            
                     t = new Treatment(1,QString("Вялость кожи"));
                     tr_type sl1{"Вялость кожи","Вялость кожи \n2 Дж","носогубная\n",2,"1-4","5-7 дней","не задано",1,2,false};
                     t->add_tr_type(sl1);
                     Agejet::skin_laxity=t;
            
                     t = new Treatment(2,QString("Шрамы постакне"));
            
                     tr_type as1{"Шрамы \n постакне","Шрамы \n постакне \n4 Дж","рубцы\n",1,"1-4","7-10 дней","не задано",1,4,false};
                     t->add_tr_type(as1);
                     Agejet::acne=t;
            
                     t = new Treatment(3,QString("Гиперпигментация"));
                     tr_type pi1{"Низкая мощность","Лицо\n Низкая мощн. \n1.5 Дж","пигментные пятна \nна лице",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                     t->add_tr_type(pi1);
                     tr_type pi2{"Высокая мощность","Лицо\n Высокая мощн. \n2.5 Дж","пигментные пятна \nна лице",1,"1-4","5-7 дней","не задано",1,2.5,false};
                     t->add_tr_type(pi2);
                     tr_type pi3{"Высокая мощность","Тело \n Высокая мощн. \n3 Дж","пятна на коже \n(тело)",1,"1-4","5-7 дней","не задано",1,3,false};
                     t->add_tr_type(pi3);
                     Agejet::pigmentation=t;
                     t = new Treatment(4,QString("Нехирургическая \n блефаропластика"));
            
                     tr_type bl1{"Нехирургическая \n блефаропластика","Нехирургическая\n блефаропластика \n3.5 Дж","периорбитальная зона\n",1,"1-4","7-10 дней","не задано",1,3.5,false};
                     t->add_tr_type(bl1);
                     Agejet::blefaro=t;
            
                     t = new Treatment(5,QString("Персонализированные процедуры"));
                     tr_type cu1{"Персонализированные процедуры","","",1,"","","",1,2,false};
                     Agejet::custom=t;
                     t->add_tr_type(cu1);
                }
             }
            
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @AntonioValentin Please check that function more thoroughly.
            I removed the content of all your if/else blocks and this is the result:

            void BootWindow::create_treatments() {
                if(Agejet::actual_language_name == "ita"){
                }
                else {
                    if (Agejet::actual_language_name == "eng"){
                    }
                    else {
                        if(Agejet::actual_language_name == "rus"){
                        }
                   }
            

            You're clearly missing } (2 times I think).

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply
            2
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Hi
              If you select the last } it will show how it maches up
              alt text

              and as you can see, it shows the else { and
              not the top one for the function.
              so there you are missing one.

              1 Reply Last reply
              3
              • A AntonioValentin

                @J-Hilk

                Can you give me an example where it is missing?

                void BootWindow::create_treatments() {
                    if(Agejet::actual_language_name == "ita"){
                
                        Treatment *t = new Treatment(0,QString("Ringiovanimento cutaneo"));
                        tr_type sr1{"Epidermide","Epidermide\nVery Low Energy \n1 J","viso completo - collo \ndécolleté - mani ",1,"1-4","2-3 giorni","4 settimane",1,1,true};
                        tr_type sr2{"Derma Superficiale","Derma \nSuperficiale\nLow Energy \n1.5 J","viso completo - collo \ndécolleté - mani ",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                        tr_type sr3{"Derma Reticolare","Derma \nReticolare \nHigh Energy \n3 J","viso completo - collo \ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,3,false};
                        tr_type sr4{"Rimodellamento Profondo","Rimodellamento \nProfondo \nHigh Energy\n4 J","viso completo - collo\ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,4,false};
                        t->add_tr_type(sr1);
                        t->add_tr_type(sr2);
                        t->add_tr_type(sr3);
                        t->add_tr_type(sr4);
                        Agejet::skin_resurfacing=t;
                
                        t = new Treatment(1,QString("Lassità Cutanea"));
                        tr_type sl1{"Lassità Cutanea","Lassità Cutanea \n2 J","nasolabiale",2,"1-4","5-7 giorni","non definito",1,2,false};
                        t->add_tr_type(sl1);
                        Agejet::skin_laxity=t;
                
                        t = new Treatment(2,QString("Cicatrici da Acne"));
                        tr_type as1{"Cicatrici da Acne","Cicatrici da Acne \n4 J","cicatrici",1,"1-4","7-10 giorni","non definito",1,4,false};
                        t->add_tr_type(as1);
                        Agejet::acne=t;
                
                        t = new Treatment(3,QString("Iperpigmentazione"));
                        tr_type pi1{"Low Energy","Viso\nLow Energy \n1.5 J","macchie del viso",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                        t->add_tr_type(pi1);
                        tr_type pi2{"High Energy","Viso\nHigh Energy \n2.5 J","macchie del viso",1,"1-4","5-7 giorni","non definito",1,2.5,false};
                        t->add_tr_type(pi2);
                        tr_type pi3{"High Energy","Corpo \nHigh Energy \n3 J","macchie cutanee \n(corpo)",1,"1-4","5-7 giorni","non definito",1,3,false};
                        t->add_tr_type(pi3);
                        Agejet::pigmentation=t;
                
                        t = new Treatment(4,QString("Blefaroplastica non chirurgica"));
                        tr_type bl1{"Blefaroplastica \nnon chirurgica","Blefaroplastica \nnon chirurgica \n3.5 J","regione periorbitale",1,"1-4","7-10 giorni","non definito",1,3.5,false};
                        t->add_tr_type(bl1);
                        Agejet::blefaro=t;
                
                        t = new Treatment(5,QString("Trattamento personalizzato"));
                        tr_type cu1{"Trattamento personalizzato","","",1,"","","",1,3.5,false};
                        Agejet::custom=t;
                        t->add_tr_type(cu1);
                    }
                    else {
                        if (Agejet::actual_language_name == "eng"){
                
                        Treatment *t = new Treatment(0,QString("Skin Resurfacing"));
                        tr_type sr1{"Upper Layer","Upper Layer\nVery Low Energy \n1 J","full face - neck \ndécolletage - hand ",1,"1-4","2-3 days","4 weeks",1,1,true};
                        tr_type sr2{"Upper Dermis ","Upper Dermis\nLow Energy \n1.5 J","full face - neck \ndécolletage - hand ",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                        tr_type sr3{"Middle Dermis","Middle Dermis \nHigh Energy \n3 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,3,false};
                        tr_type sr4{"Deep Resurfacing","Deep \nRemodeling \nHigh Energy\n4 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,4,false};
                        t->add_tr_type(sr1);
                        t->add_tr_type(sr2);
                        t->add_tr_type(sr3);
                        t->add_tr_type(sr4);
                        Agejet::skin_resurfacing=t;
                
                        t = new Treatment(1,QString("Skin Laxity"));
                        tr_type sl1{"Skin Laxity","Skin Laxity \n2 J","nasolabial",2,"1-4","5-7 days","not defined weeks",1,2,false};
                        t->add_tr_type(sl1);
                        Agejet::skin_laxity=t;
                
                        t = new Treatment(2,QString("Acne Scares"));
                        tr_type as1{"Acne Scares","Acne Scars \n4 J","scars",1,"1-4","7-10 days","not defined weeks",1,4,false};
                        t->add_tr_type(as1);
                        Agejet::acne=t;
                
                        t = new Treatment(3,QString("Hyperpigmentation"));
                        tr_type pi1{"Low Energy","Face\nLow Energy \n1.5 J","facial skin patches",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                        t->add_tr_type(pi1);
                        tr_type pi2{"High Energy","Face\nHigh Energy \n2.5 J","facial skin patches",1,"1-4","5-7 days","not defined weeks",1,2.5,false};
                        t->add_tr_type(pi2);
                        tr_type pi3{"High Energy","Body \nHigh Energy \n3 J","skin patches \n(body)",1,"1-4","5-7 days","not defined weeks",1,3,false};
                        t->add_tr_type(pi3);
                        Agejet::pigmentation=t;
                
                        t = new Treatment(4,QString("Non-surgical  Blepharoplasty"));
                        tr_type bl1{"Non-surgical\nBlefaroplasty","Non-surgical\nBlepharoplasty \n3.5 J","ocular Zone",1,"1-4","7-10 days","not defined weeks",1,3.5,false};
                        t->add_tr_type(bl1);
                        Agejet::blefaro=t;
                
                        t = new Treatment(5,QString("Custom"));
                        tr_type cu1{"Custom","","",1,"","","",1,2,false};
                        Agejet::custom=t;
                        t->add_tr_type(cu1);
                    }
                    else {
                        if(Agejet::actual_language_name == "rus"){
                
                         Treatment *t = new Treatment(0,QString("Шлифовка кожи"));
                         tr_type sr1{"ВЕРХНИЙ \n СЛОЙ КОЖИ","ВЕРХНИЙ \n СЛОЙ КОЖИ \n Очень \n низкая мощн. \n1 Дж","лицо - шея - \nзона декольте  - руки ",1,"1-4","2-3 дня","4 недели",1,1,true};
                         tr_type sr2{"ВНУТРЕННИЙ \n СЛОЙ КОЖИ/ДЕРМА","ВНУТРЕННИЙ \n СЛОЙ КОЖИ/\n ДЕРМА \n Низкая мощн. \n1.5 Дж","лицо - шея -\n зона декольте  - руки ",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                
                         tr_type sr3{"РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ","РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ \n Высокая мощн. \n3 Дж","Лицо - шея - \nзона декольте - руки ",1,"1-4","7-10 дней","не задано",1,3,false};
                         tr_type sr4{"ГЛУБОКОЕ РЕМОДЕЛИРОВАНИЕ КОЖИ","ГЛУБОКОЕ \n РЕМОДЕЛИРОВ-Е \n КОЖИ \n  Высокая мощн.\n4 Дж","лицо- шея -\n зона декольте - руки",1,"1-4","7-10 дней","не задано",1,4,false};
                         t->add_tr_type(sr1);
                         t->add_tr_type(sr2);
                         t->add_tr_type(sr3);
                         t->add_tr_type(sr4);
                         Agejet::skin_resurfacing=t;
                
                         t = new Treatment(1,QString("Вялость кожи"));
                         tr_type sl1{"Вялость кожи","Вялость кожи \n2 Дж","носогубная\n",2,"1-4","5-7 дней","не задано",1,2,false};
                         t->add_tr_type(sl1);
                         Agejet::skin_laxity=t;
                
                         t = new Treatment(2,QString("Шрамы постакне"));
                
                         tr_type as1{"Шрамы \n постакне","Шрамы \n постакне \n4 Дж","рубцы\n",1,"1-4","7-10 дней","не задано",1,4,false};
                         t->add_tr_type(as1);
                         Agejet::acne=t;
                
                         t = new Treatment(3,QString("Гиперпигментация"));
                         tr_type pi1{"Низкая мощность","Лицо\n Низкая мощн. \n1.5 Дж","пигментные пятна \nна лице",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                         t->add_tr_type(pi1);
                         tr_type pi2{"Высокая мощность","Лицо\n Высокая мощн. \n2.5 Дж","пигментные пятна \nна лице",1,"1-4","5-7 дней","не задано",1,2.5,false};
                         t->add_tr_type(pi2);
                         tr_type pi3{"Высокая мощность","Тело \n Высокая мощн. \n3 Дж","пятна на коже \n(тело)",1,"1-4","5-7 дней","не задано",1,3,false};
                         t->add_tr_type(pi3);
                         Agejet::pigmentation=t;
                         t = new Treatment(4,QString("Нехирургическая \n блефаропластика"));
                
                         tr_type bl1{"Нехирургическая \n блефаропластика","Нехирургическая\n блефаропластика \n3.5 Дж","периорбитальная зона\n",1,"1-4","7-10 дней","не задано",1,3.5,false};
                         t->add_tr_type(bl1);
                         Agejet::blefaro=t;
                
                         t = new Treatment(5,QString("Персонализированные процедуры"));
                         tr_type cu1{"Персонализированные процедуры","","",1,"","","",1,2,false};
                         Agejet::custom=t;
                         t->add_tr_type(cu1);
                    }
                 }
                
                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by
                #8

                @AntonioValentin The problem highlighted by QtCreator is line 291.
                So, take a look at the function before this line!

                To help you, select the hole function and the press "Ctrl+I" to realign the code... I give you another hint, take a look at your if/else brackets.

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                1 Reply Last reply
                3
                • jsulmJ jsulm

                  @AntonioValentin Please check that function more thoroughly.
                  I removed the content of all your if/else blocks and this is the result:

                  void BootWindow::create_treatments() {
                      if(Agejet::actual_language_name == "ita"){
                      }
                      else {
                          if (Agejet::actual_language_name == "eng"){
                          }
                          else {
                              if(Agejet::actual_language_name == "rus"){
                              }
                         }
                  

                  You're clearly missing } (2 times I think).

                  A Offline
                  A Offline
                  AntonioValentin
                  wrote on last edited by AntonioValentin
                  #9

                  @jsulm I solved only that now these two errors come out.

                  import_programs();{
                  ifstream model_file;
                  string line;
                  model_file.open(Agejet::model_path);
                  bool model_error=false;
                  if(model_file.is_open())
                    getline(model_file,line);
                    QString model = QString::fromStdString(line);
                    int model_int = model.toInt();
                  
                    switch (model_int) {
                    case 16:
                        Agejet::model=Agejet::AESTHETIC;
                        Agejet::DIV=Agejet::DIV_HIGH;
                        Agejet::max_energy=2;
                        break;
                    case 17:
                        Agejet::model=Agejet::MEDICAL;
                        Agejet::DIV=Agejet::DIV_HIGH;
                        Agejet::max_energy=4;
                        break;
                    case 32:
                        Agejet::model=Agejet::AESTHETIC_LOW;
                        Agejet::DIV=Agejet::DIV_LOW;
                        Agejet::max_energy=2;
                        break;
                    case 33:
                        Agejet::model=Agejet::MEDICAL_LOW;
                        Agejet::max_energy=4;
                        Agejet::DIV=Agejet::DIV_LOW;
                        break;
                    default:
                        model_error=true;
                        break;
                    }
                  }
                  JonBJ 1 Reply Last reply
                  0
                  • A AntonioValentin

                    @jsulm I solved only that now these two errors come out.

                    import_programs();{
                    ifstream model_file;
                    string line;
                    model_file.open(Agejet::model_path);
                    bool model_error=false;
                    if(model_file.is_open())
                      getline(model_file,line);
                      QString model = QString::fromStdString(line);
                      int model_int = model.toInt();
                    
                      switch (model_int) {
                      case 16:
                          Agejet::model=Agejet::AESTHETIC;
                          Agejet::DIV=Agejet::DIV_HIGH;
                          Agejet::max_energy=2;
                          break;
                      case 17:
                          Agejet::model=Agejet::MEDICAL;
                          Agejet::DIV=Agejet::DIV_HIGH;
                          Agejet::max_energy=4;
                          break;
                      case 32:
                          Agejet::model=Agejet::AESTHETIC_LOW;
                          Agejet::DIV=Agejet::DIV_LOW;
                          Agejet::max_energy=2;
                          break;
                      case 33:
                          Agejet::model=Agejet::MEDICAL_LOW;
                          Agejet::max_energy=4;
                          Agejet::DIV=Agejet::DIV_LOW;
                          break;
                      default:
                          model_error=true;
                          break;
                      }
                    }
                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by JonB
                    #10

                    @AntonioValentin
                    In general please paste the text of error messages, don't make people to go external on an unclickable link.

                    A 1 Reply Last reply
                    1
                    • JonBJ JonB

                      @AntonioValentin
                      In general please paste the text of error messages, don't make people to go external on an unclickable link.

                      A Offline
                      A Offline
                      AntonioValentin
                      wrote on last edited by
                      #11
                      This post is deleted!
                      JonBJ 1 Reply Last reply
                      0
                      • A AntonioValentin

                        This post is deleted!

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by JonB
                        #12

                        @AntonioValentin
                        I really meant, paste the text of the message and the text of the (surrounding) lines of code. Not many people like looking at big pictures, and then not being to copy any text out of them so that we have to type everything in ourselves....

                        Anyway, what do you expect people to say? You have a line
                        import_programs();{
                        That makes no sense in C++, hence the compiler error. I have no idea what you are intending here. Purely judging by indentation, maybe all the subsequent code is supposed inside a function definition of import_programs() but I really don't know. There are other problems in the code when you do sort this out. Don't know if you have (mis-)copy/pasted from somewhere.

                        A 1 Reply Last reply
                        1
                        • JonBJ JonB

                          @AntonioValentin
                          I really meant, paste the text of the message and the text of the (surrounding) lines of code. Not many people like looking at big pictures, and then not being to copy any text out of them so that we have to type everything in ourselves....

                          Anyway, what do you expect people to say? You have a line
                          import_programs();{
                          That makes no sense in C++, hence the compiler error. I have no idea what you are intending here. Purely judging by indentation, maybe all the subsequent code is supposed inside a function definition of import_programs() but I really don't know. There are other problems in the code when you do sort this out. Don't know if you have (mis-)copy/pasted from somewhere.

                          A Offline
                          A Offline
                          AntonioValentin
                          wrote on last edited by
                          #13

                          @JonB

                          #include "bootwindow.h"
                          #include "ui_bootwindow.h"
                          #include "agejet.h"
                          #include "main_window.h"
                          #include "treatment.h"
                          #include <openssl/aes.h>
                          #include <iostream>
                          #include <fstream>
                          #include <cstdio>
                          #include <QProcess>
                          #include <stdio.h>
                          #include <QTranslator>
                          
                          BootWindow::BootWindow(QWidget *parent) :
                              QMainWindow(parent),
                              ui(new Ui::BootWindow)
                          {
                              ui->setupUi(this);
                              this->move(0,0);
                              this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
                              timer.singleShot(200,this,SLOT(set_up()));
                          }
                          
                          BootWindow::~BootWindow()
                          {
                              delete ui;
                          }
                          void BootWindow::set_up()
                          {
                              ifstream file_version;
                              string line;
                              file_version.open("/home/"+Agejet::home_name.toStdString()+"/version");
                              if(file_version.is_open()){
                                  getline(file_version,line);
                                  Agejet::software_version = QString::fromStdString(line);
                                  file_version.close();
                              }
                              ifstream mac_file;
                              const char *cmd;
                              QString q_cmd = "cat /sys/class//net/eth0/address > /home/"+Agejet::home_name+"/mac";
                              cmd = q_cmd.toLatin1().data();
                              system(cmd);
                              mac_file.open("/home/"+Agejet::home_name.toStdString()+"/mac");
                              if(mac_file.is_open()){
                                  QString q_cfg_line;
                                  string cfg_line;
                                  getline(mac_file,cfg_line);
                                  q_cfg_line = QString::fromStdString(cfg_line);
                                  Agejet::mac =q_cfg_line;
                                  mac_file.close();
                              }
                              ifstream psw_file;
                              psw_file.open("/home/"+Agejet::home_name.toStdString()+"/PSW");
                              if(psw_file.is_open()){
                                  QString q_psw_line;
                                  string psw_line;
                                  getline(psw_file,psw_line);
                                  q_psw_line = QString::fromStdString(psw_line);
                                  Agejet::customer_psw = q_psw_line;
                                  psw_file.close();
                                  if(Agejet::customer_psw == Agejet::our_psw){
                                      Agejet::our_psw = "17093";
                                  }
                              }
                              Agejet::error_type=Agejet::NO_ERR;
                              QString prog = "/home/"+Agejet::home_name+"/find_usb";
                              QStringList arg;
                              QProcess *proc = new QProcess(this);
                              connect(proc,SIGNAL(finished(int)),this,SLOT(set_up_usb_paths(int)));
                              proc->start(prog, arg);
                          
                          }
                          
                          void BootWindow::set_up_usb_paths(int err)
                          {
                              ifstream paths_file;
                              string line;
                              paths_file.open(Agejet::rfid_serial_path_file.toLatin1());
                              QString rfid_pth = "";
                              if(paths_file.is_open()){
                                  getline(paths_file,line);
                                  rfid_pth = QString::fromStdString(line);
                                  Agejet::rfid_serial_path=rfid_pth;
                                  paths_file.close();
                              }
                              else {
                                  if(!rfid_pth.contains("tty")){
                                      Agejet::error_type=Agejet::RFID_RDR_NOT_FOUND;
                                  }
                                  else {
                                      Agejet::error_type=Agejet::PATHS_ERR;
                                      open_main_window();
                                      return;
                                  }
                              }
                              paths_file.open(Agejet::sr_path_file.toLatin1());
                              if(paths_file.is_open()){
                                  getline(paths_file,line);
                                  QString module_pth = QString::fromStdString(line);
                                  Agejet::sr_path=module_pth;
                                  paths_file.close();
                              }
                              else {
                                  Agejet::error_type=Agejet::PATHS_ERR;
                                  open_main_window();
                                  return;
                              }
                              if(!rfid_pth.contains("tty")){
                                  Agejet::error_type=Agejet::RFID_RDR_NOT_FOUND;
                              }
                              load_language();
                          }
                          
                          
                          
                          void BootWindow::create_treatments() {
                              if(Agejet::actual_language_name == "ita"){
                          
                                  Treatment *t = new Treatment(0,QString("Ringiovanimento cutaneo"));
                                  tr_type sr1{"Epidermide","Epidermide\nVery Low Energy \n1 J","viso completo - collo \ndécolleté - mani ",1,"1-4","2-3 giorni","4 settimane",1,1,true};
                                  tr_type sr2{"Derma Superficiale","Derma \nSuperficiale\nLow Energy \n1.5 J","viso completo - collo \ndécolleté - mani ",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                                  tr_type sr3{"Derma Reticolare","Derma \nReticolare \nHigh Energy \n3 J","viso completo - collo \ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,3,false};
                                  tr_type sr4{"Rimodellamento Profondo","Rimodellamento \nProfondo \nHigh Energy\n4 J","viso completo - collo\ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,4,false};
                                  t->add_tr_type(sr1);
                                  t->add_tr_type(sr2);
                                  t->add_tr_type(sr3);
                                  t->add_tr_type(sr4);
                                  Agejet::skin_resurfacing=t;
                          
                                  t = new Treatment(1,QString("Lassità Cutanea"));
                                  tr_type sl1{"Lassità Cutanea","Lassità Cutanea \n2 J","nasolabiale",2,"1-4","5-7 giorni","non definito",1,2,false};
                                  t->add_tr_type(sl1);
                                  Agejet::skin_laxity=t;
                          
                                  t = new Treatment(2,QString("Cicatrici da Acne"));
                                  tr_type as1{"Cicatrici da Acne","Cicatrici da Acne \n4 J","cicatrici",1,"1-4","7-10 giorni","non definito",1,4,false};
                                  t->add_tr_type(as1);
                                  Agejet::acne=t;
                          
                                  t = new Treatment(3,QString("Iperpigmentazione"));
                                  tr_type pi1{"Low Energy","Viso\nLow Energy \n1.5 J","macchie del viso",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                                  t->add_tr_type(pi1);
                                  tr_type pi2{"High Energy","Viso\nHigh Energy \n2.5 J","macchie del viso",1,"1-4","5-7 giorni","non definito",1,2.5,false};
                                  t->add_tr_type(pi2);
                                  tr_type pi3{"High Energy","Corpo \nHigh Energy \n3 J","macchie cutanee \n(corpo)",1,"1-4","5-7 giorni","non definito",1,3,false};
                                  t->add_tr_type(pi3);
                                  Agejet::pigmentation=t;
                          
                                  t = new Treatment(4,QString("Blefaroplastica non chirurgica"));
                                  tr_type bl1{"Blefaroplastica \nnon chirurgica","Blefaroplastica \nnon chirurgica \n3.5 J","regione periorbitale",1,"1-4","7-10 giorni","non definito",1,3.5,false};
                                  t->add_tr_type(bl1);
                                  Agejet::blefaro=t;
                          
                                  t = new Treatment(5,QString("Trattamento personalizzato"));
                                  tr_type cu1{"Trattamento personalizzato","","",1,"","","",1,3.5,false};
                                  Agejet::custom=t;
                                  t->add_tr_type(cu1);
                              }
                              else {
                                  if (Agejet::actual_language_name == "eng"){
                          
                                      Treatment *t = new Treatment(0,QString("Skin Resurfacing"));
                                      tr_type sr1{"Upper Layer","Upper Layer\nVery Low Energy \n1 J","full face - neck \ndécolletage - hand ",1,"1-4","2-3 days","4 weeks",1,1,true};
                                      tr_type sr2{"Upper Dermis ","Upper Dermis\nLow Energy \n1.5 J","full face - neck \ndécolletage - hand ",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                                      tr_type sr3{"Middle Dermis","Middle Dermis \nHigh Energy \n3 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,3,false};
                                      tr_type sr4{"Deep Resurfacing","Deep \nRemodeling \nHigh Energy\n4 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,4,false};
                                      t->add_tr_type(sr1);
                                      t->add_tr_type(sr2);
                                      t->add_tr_type(sr3);
                                      t->add_tr_type(sr4);
                                      Agejet::skin_resurfacing=t;
                          
                                      t = new Treatment(1,QString("Skin Laxity"));
                                      tr_type sl1{"Skin Laxity","Skin Laxity \n2 J","nasolabial",2,"1-4","5-7 days","not defined weeks",1,2,false};
                                      t->add_tr_type(sl1);
                                      Agejet::skin_laxity=t;
                          
                                      t = new Treatment(2,QString("Acne Scares"));
                                      tr_type as1{"Acne Scares","Acne Scars \n4 J","scars",1,"1-4","7-10 days","not defined weeks",1,4,false};
                                      t->add_tr_type(as1);
                                      Agejet::acne=t;
                          
                                      t = new Treatment(3,QString("Hyperpigmentation"));
                                      tr_type pi1{"Low Energy","Face\nLow Energy \n1.5 J","facial skin patches",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                                      t->add_tr_type(pi1);
                                      tr_type pi2{"High Energy","Face\nHigh Energy \n2.5 J","facial skin patches",1,"1-4","5-7 days","not defined weeks",1,2.5,false};
                                      t->add_tr_type(pi2);
                                      tr_type pi3{"High Energy","Body \nHigh Energy \n3 J","skin patches \n(body)",1,"1-4","5-7 days","not defined weeks",1,3,false};
                                      t->add_tr_type(pi3);
                                      Agejet::pigmentation=t;
                          
                                      t = new Treatment(4,QString("Non-surgical  Blepharoplasty"));
                                      tr_type bl1{"Non-surgical\nBlefaroplasty","Non-surgical\nBlepharoplasty \n3.5 J","ocular Zone",1,"1-4","7-10 days","not defined weeks",1,3.5,false};
                                      t->add_tr_type(bl1);
                                      Agejet::blefaro=t;
                          
                                      t = new Treatment(5,QString("Custom"));
                                      tr_type cu1{"Custom","","",1,"","","",1,2,false};
                                      Agejet::custom=t;
                                      t->add_tr_type(cu1);
                                  }
                                  else {
                                      if(Agejet::actual_language_name == "rus"){
                          
                                          Treatment *t = new Treatment(0,QString("Шлифовка кожи"));
                                          tr_type sr1{"ВЕРХНИЙ \n СЛОЙ КОЖИ","ВЕРХНИЙ \n СЛОЙ КОЖИ \n Очень \n низкая мощн. \n1 Дж","лицо - шея - \nзона декольте  - руки ",1,"1-4","2-3 дня","4 недели",1,1,true};
                                          tr_type sr2{"ВНУТРЕННИЙ \n СЛОЙ КОЖИ/ДЕРМА","ВНУТРЕННИЙ \n СЛОЙ КОЖИ/\n ДЕРМА \n Низкая мощн. \n1.5 Дж","лицо - шея -\n зона декольте  - руки ",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                          
                                          tr_type sr3{"РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ","РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ \n Высокая мощн. \n3 Дж","Лицо - шея - \nзона декольте - руки ",1,"1-4","7-10 дней","не задано",1,3,false};
                                          tr_type sr4{"ГЛУБОКОЕ РЕМОДЕЛИРОВАНИЕ КОЖИ","ГЛУБОКОЕ \n РЕМОДЕЛИРОВ-Е \n КОЖИ \n  Высокая мощн.\n4 Дж","лицо- шея -\n зона декольте - руки",1,"1-4","7-10 дней","не задано",1,4,false};
                                          t->add_tr_type(sr1);
                                          t->add_tr_type(sr2);
                                          t->add_tr_type(sr3);
                                          t->add_tr_type(sr4);
                                          Agejet::skin_resurfacing=t;
                          
                                          t = new Treatment(1,QString("Вялость кожи"));
                                          tr_type sl1{"Вялость кожи","Вялость кожи \n2 Дж","носогубная\n",2,"1-4","5-7 дней","не задано",1,2,false};
                                          t->add_tr_type(sl1);
                                          Agejet::skin_laxity=t;
                          
                                          t = new Treatment(2,QString("Шрамы постакне"));
                          
                                          tr_type as1{"Шрамы \n постакне","Шрамы \n постакне \n4 Дж","рубцы\n",1,"1-4","7-10 дней","не задано",1,4,false};
                                          t->add_tr_type(as1);
                                          Agejet::acne=t;
                          
                                          t = new Treatment(3,QString("Гиперпигментация"));
                                          tr_type pi1{"Низкая мощность","Лицо\n Низкая мощн. \n1.5 Дж","пигментные пятна \nна лице",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                                          t->add_tr_type(pi1);
                                          tr_type pi2{"Высокая мощность","Лицо\n Высокая мощн. \n2.5 Дж","пигментные пятна \nна лице",1,"1-4","5-7 дней","не задано",1,2.5,false};
                                          t->add_tr_type(pi2);
                                          tr_type pi3{"Высокая мощность","Тело \n Высокая мощн. \n3 Дж","пятна на коже \n(тело)",1,"1-4","5-7 дней","не задано",1,3,false};
                                          t->add_tr_type(pi3);
                                          Agejet::pigmentation=t;
                                          t = new Treatment(4,QString("Нехирургическая \n блефаропластика"));
                          
                                          tr_type bl1{"Нехирургическая \n блефаропластика","Нехирургическая\n блефаропластика \n3.5 Дж","периорбитальная зона\n",1,"1-4","7-10 дней","не задано",1,3.5,false};
                                          t->add_tr_type(bl1);
                                          Agejet::blefaro=t;
                          
                                          t = new Treatment(5,QString("Персонализированные процедуры"));
                                          tr_type cu1{"Персонализированные процедуры","","",1,"","","",1,2,false};
                                          Agejet::custom=t;
                                          t->add_tr_type(cu1);
                                      }
                          
                                  }
                              }
                          }
                          
                          import_programs();
                          ifstream model_file;
                          string line;
                          model_file.open(Agejet::model_path);
                          bool model_error=false;
                          if(model_file.is_open()){
                              getline(model_file,line);
                              QString model = QString::fromStdString(line);
                              int model_int = model.toInt();
                              switch (model_int) {
                              case 16:
                                  Agejet::model=Agejet::AESTHETIC;
                                  Agejet::DIV=Agejet::DIV_HIGH;
                                  Agejet::max_energy=2;
                                  break;
                              case 17:
                                  Agejet::model=Agejet::MEDICAL;
                                  Agejet::DIV=Agejet::DIV_HIGH;
                                  Agejet::max_energy=4;
                                  break;
                              case 32:
                                  Agejet::model=Agejet::AESTHETIC_LOW;
                                  Agejet::DIV=Agejet::DIV_LOW;
                                  Agejet::max_energy=2;
                                  break;
                              case 33:
                                  Agejet::model=Agejet::MEDICAL_LOW;
                                  Agejet::max_energy=4;
                                  Agejet::DIV=Agejet::DIV_LOW;
                                  break;
                              default:
                                  model_error=true;
                                  break;
                              }
                          }
                          else {
                             //.....
                          }
                          model_file.close();
                          load_shoots();
                          }
                          
                          void BootWindow::import_programs()
                          {
                              Agejet::prog_1=Program::import_program(Agejet::prog_path+Agejet::prog_1_name);
                              Agejet::prog_2=Program::import_program(Agejet::prog_path+Agejet::prog_2_name);
                              Agejet::prog_3=Program::import_program(Agejet::prog_path+Agejet::prog_3_name);
                              Agejet::prog_4=Program::import_program(Agejet::prog_path+Agejet::prog_4_name);
                          }
                          
                          void BootWindow::load_shoots()
                          {
                              ifstream shoots_file;
                              string line;
                              shoots_file.open(Agejet::hp_shoots_count_path);
                              if(shoots_file.is_open()){
                                  getline(shoots_file,line);
                                  bool ok;
                                  QString shoots = QString::fromStdString(line);
                                  int hp_s = shoots.toInt(&ok,10);
                                  if(!ok){//....
                                      Agejet::actual_hp_shoots=0;
                                  }
                                  else Agejet::actual_hp_shoots=hp_s;
                              }
                              else {
                                  Agejet::actual_hp_shoots=0;
                              }
                              shoots_file.close();
                              shoots_file.open(Agejet::tips_shoots_count_path);
                              if(shoots_file.is_open()){
                                  getline(shoots_file,line);
                                  bool ok;
                                  QString shoots = QString::fromStdString(line);
                                  int hp_s = shoots.toInt(&ok,10);
                                  if(!ok){//....
                                      Agejet::actual_tips_shoots=0;
                                  }
                                  else Agejet::actual_tips_shoots=hp_s;
                              }
                              else {
                                  Agejet::actual_tips_shoots=0;
                              }
                          
                              boot();
                          }
                          
                          void BootWindow::load_language()
                          {
                              ifstream language;
                              string lang;
                              language.open("/home/"+Agejet::home_name.toStdString()+"/lan");
                              if(language.is_open()){
                                  getline(language,lang);
                                  QString qLan = QString::fromStdString(lang);
                                  if(qLan.contains("ita")){
                                      QTranslator *translator = new QTranslator();
                                      if(translator->load("/home/triworker/agejet_it.qm")){
                                          QApplication::installTranslator(translator);
                                          Agejet::actual_language = translator;
                                          Agejet::actual_language_name = "ita";
                          
                                          mes_dialog.set_ita();
                                          err_dialog.set_ita();
                                          cout<<"ita"<<endl;}
                                      else {
                                          mes_dialog.set_eng();
                                          err_dialog.set_eng();cout<<"eng"<<endl;
                                      }
                                  }
                                  else {
                                      if(qLan.contains("rus")){
                                          cout<<"russo"<<endl;
                                          QTranslator *translator = new QTranslator();
                          
                                          if(translator->load("/home/triworker/agejet_ru.qm")){
                                              QApplication::installTranslator(translator);
                                              Agejet::actual_language = translator;
                                              Agejet::actual_language_name = "rus";
                                              mes_dialog.set_russ();
                                              err_dialog.set_russ();
                          
                                              Agejet::Hz="Гц";
                                              Agejet::J="Дж";
                          
                                          }
                                          else {
                                              mes_dialog.set_eng();
                                              err_dialog.set_eng();cout<<"eng"<<endl;
                                          }
                                      }
                          
                                      //if(qLan.contains("ita")){
                                      //  mes_dialog.set_eng();
                                      //err_dialog.set_eng();
                                      //}
                                  }
                          
                              }
                              else {
                                  mes_dialog.set_eng();
                                  err_dialog.set_eng();
                              }
                              language.close();
                              create_treatments();
                          }
                          
                          void BootWindow::boot()
                          {
                              connect(&Agejet::sr_works,SIGNAL(finished()),this,SLOT(open_main_window()));
                              Agejet::sr_works.sw_function="boot";
                              Agejet::sr_works.start();
                          }
                          
                          void BootWindow::open_main_window()
                          {
                              if(Agejet::test){
                                  mes_dialog.set_language();
                              }
                              disconnect(&Agejet::sr_works,SIGNAL(finished()),this,SLOT(open_main_window()));
                              Main_Window *win = new Main_Window();
                              this->close();
                              win->show();
                          
                          }
                          
                          
                          
                          
                          
                          JonBJ 1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            AntonioValentin
                            wrote on last edited by
                            #14

                            error

                            ‘model_file’ does not name a type line: 255
                            expected constructor, destructor, or type conversion before ‘;’ token: line 252
                            expected unqualified-id before ‘if’: line 257

                            jsulmJ 1 Reply Last reply
                            0
                            • A AntonioValentin

                              @JonB

                              #include "bootwindow.h"
                              #include "ui_bootwindow.h"
                              #include "agejet.h"
                              #include "main_window.h"
                              #include "treatment.h"
                              #include <openssl/aes.h>
                              #include <iostream>
                              #include <fstream>
                              #include <cstdio>
                              #include <QProcess>
                              #include <stdio.h>
                              #include <QTranslator>
                              
                              BootWindow::BootWindow(QWidget *parent) :
                                  QMainWindow(parent),
                                  ui(new Ui::BootWindow)
                              {
                                  ui->setupUi(this);
                                  this->move(0,0);
                                  this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
                                  timer.singleShot(200,this,SLOT(set_up()));
                              }
                              
                              BootWindow::~BootWindow()
                              {
                                  delete ui;
                              }
                              void BootWindow::set_up()
                              {
                                  ifstream file_version;
                                  string line;
                                  file_version.open("/home/"+Agejet::home_name.toStdString()+"/version");
                                  if(file_version.is_open()){
                                      getline(file_version,line);
                                      Agejet::software_version = QString::fromStdString(line);
                                      file_version.close();
                                  }
                                  ifstream mac_file;
                                  const char *cmd;
                                  QString q_cmd = "cat /sys/class//net/eth0/address > /home/"+Agejet::home_name+"/mac";
                                  cmd = q_cmd.toLatin1().data();
                                  system(cmd);
                                  mac_file.open("/home/"+Agejet::home_name.toStdString()+"/mac");
                                  if(mac_file.is_open()){
                                      QString q_cfg_line;
                                      string cfg_line;
                                      getline(mac_file,cfg_line);
                                      q_cfg_line = QString::fromStdString(cfg_line);
                                      Agejet::mac =q_cfg_line;
                                      mac_file.close();
                                  }
                                  ifstream psw_file;
                                  psw_file.open("/home/"+Agejet::home_name.toStdString()+"/PSW");
                                  if(psw_file.is_open()){
                                      QString q_psw_line;
                                      string psw_line;
                                      getline(psw_file,psw_line);
                                      q_psw_line = QString::fromStdString(psw_line);
                                      Agejet::customer_psw = q_psw_line;
                                      psw_file.close();
                                      if(Agejet::customer_psw == Agejet::our_psw){
                                          Agejet::our_psw = "17093";
                                      }
                                  }
                                  Agejet::error_type=Agejet::NO_ERR;
                                  QString prog = "/home/"+Agejet::home_name+"/find_usb";
                                  QStringList arg;
                                  QProcess *proc = new QProcess(this);
                                  connect(proc,SIGNAL(finished(int)),this,SLOT(set_up_usb_paths(int)));
                                  proc->start(prog, arg);
                              
                              }
                              
                              void BootWindow::set_up_usb_paths(int err)
                              {
                                  ifstream paths_file;
                                  string line;
                                  paths_file.open(Agejet::rfid_serial_path_file.toLatin1());
                                  QString rfid_pth = "";
                                  if(paths_file.is_open()){
                                      getline(paths_file,line);
                                      rfid_pth = QString::fromStdString(line);
                                      Agejet::rfid_serial_path=rfid_pth;
                                      paths_file.close();
                                  }
                                  else {
                                      if(!rfid_pth.contains("tty")){
                                          Agejet::error_type=Agejet::RFID_RDR_NOT_FOUND;
                                      }
                                      else {
                                          Agejet::error_type=Agejet::PATHS_ERR;
                                          open_main_window();
                                          return;
                                      }
                                  }
                                  paths_file.open(Agejet::sr_path_file.toLatin1());
                                  if(paths_file.is_open()){
                                      getline(paths_file,line);
                                      QString module_pth = QString::fromStdString(line);
                                      Agejet::sr_path=module_pth;
                                      paths_file.close();
                                  }
                                  else {
                                      Agejet::error_type=Agejet::PATHS_ERR;
                                      open_main_window();
                                      return;
                                  }
                                  if(!rfid_pth.contains("tty")){
                                      Agejet::error_type=Agejet::RFID_RDR_NOT_FOUND;
                                  }
                                  load_language();
                              }
                              
                              
                              
                              void BootWindow::create_treatments() {
                                  if(Agejet::actual_language_name == "ita"){
                              
                                      Treatment *t = new Treatment(0,QString("Ringiovanimento cutaneo"));
                                      tr_type sr1{"Epidermide","Epidermide\nVery Low Energy \n1 J","viso completo - collo \ndécolleté - mani ",1,"1-4","2-3 giorni","4 settimane",1,1,true};
                                      tr_type sr2{"Derma Superficiale","Derma \nSuperficiale\nLow Energy \n1.5 J","viso completo - collo \ndécolleté - mani ",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                                      tr_type sr3{"Derma Reticolare","Derma \nReticolare \nHigh Energy \n3 J","viso completo - collo \ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,3,false};
                                      tr_type sr4{"Rimodellamento Profondo","Rimodellamento \nProfondo \nHigh Energy\n4 J","viso completo - collo\ndécolleté - mani ",1,"1-4","7-10 giorni","non definito",1,4,false};
                                      t->add_tr_type(sr1);
                                      t->add_tr_type(sr2);
                                      t->add_tr_type(sr3);
                                      t->add_tr_type(sr4);
                                      Agejet::skin_resurfacing=t;
                              
                                      t = new Treatment(1,QString("Lassità Cutanea"));
                                      tr_type sl1{"Lassità Cutanea","Lassità Cutanea \n2 J","nasolabiale",2,"1-4","5-7 giorni","non definito",1,2,false};
                                      t->add_tr_type(sl1);
                                      Agejet::skin_laxity=t;
                              
                                      t = new Treatment(2,QString("Cicatrici da Acne"));
                                      tr_type as1{"Cicatrici da Acne","Cicatrici da Acne \n4 J","cicatrici",1,"1-4","7-10 giorni","non definito",1,4,false};
                                      t->add_tr_type(as1);
                                      Agejet::acne=t;
                              
                                      t = new Treatment(3,QString("Iperpigmentazione"));
                                      tr_type pi1{"Low Energy","Viso\nLow Energy \n1.5 J","macchie del viso",1,"1-4","4-5 giorni","3 settimane",1,1.5,true};
                                      t->add_tr_type(pi1);
                                      tr_type pi2{"High Energy","Viso\nHigh Energy \n2.5 J","macchie del viso",1,"1-4","5-7 giorni","non definito",1,2.5,false};
                                      t->add_tr_type(pi2);
                                      tr_type pi3{"High Energy","Corpo \nHigh Energy \n3 J","macchie cutanee \n(corpo)",1,"1-4","5-7 giorni","non definito",1,3,false};
                                      t->add_tr_type(pi3);
                                      Agejet::pigmentation=t;
                              
                                      t = new Treatment(4,QString("Blefaroplastica non chirurgica"));
                                      tr_type bl1{"Blefaroplastica \nnon chirurgica","Blefaroplastica \nnon chirurgica \n3.5 J","regione periorbitale",1,"1-4","7-10 giorni","non definito",1,3.5,false};
                                      t->add_tr_type(bl1);
                                      Agejet::blefaro=t;
                              
                                      t = new Treatment(5,QString("Trattamento personalizzato"));
                                      tr_type cu1{"Trattamento personalizzato","","",1,"","","",1,3.5,false};
                                      Agejet::custom=t;
                                      t->add_tr_type(cu1);
                                  }
                                  else {
                                      if (Agejet::actual_language_name == "eng"){
                              
                                          Treatment *t = new Treatment(0,QString("Skin Resurfacing"));
                                          tr_type sr1{"Upper Layer","Upper Layer\nVery Low Energy \n1 J","full face - neck \ndécolletage - hand ",1,"1-4","2-3 days","4 weeks",1,1,true};
                                          tr_type sr2{"Upper Dermis ","Upper Dermis\nLow Energy \n1.5 J","full face - neck \ndécolletage - hand ",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                                          tr_type sr3{"Middle Dermis","Middle Dermis \nHigh Energy \n3 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,3,false};
                                          tr_type sr4{"Deep Resurfacing","Deep \nRemodeling \nHigh Energy\n4 J","full face - neck \ndécolletage - hand ",1,"1-4","7-10 days","not defined weeks",1,4,false};
                                          t->add_tr_type(sr1);
                                          t->add_tr_type(sr2);
                                          t->add_tr_type(sr3);
                                          t->add_tr_type(sr4);
                                          Agejet::skin_resurfacing=t;
                              
                                          t = new Treatment(1,QString("Skin Laxity"));
                                          tr_type sl1{"Skin Laxity","Skin Laxity \n2 J","nasolabial",2,"1-4","5-7 days","not defined weeks",1,2,false};
                                          t->add_tr_type(sl1);
                                          Agejet::skin_laxity=t;
                              
                                          t = new Treatment(2,QString("Acne Scares"));
                                          tr_type as1{"Acne Scares","Acne Scars \n4 J","scars",1,"1-4","7-10 days","not defined weeks",1,4,false};
                                          t->add_tr_type(as1);
                                          Agejet::acne=t;
                              
                                          t = new Treatment(3,QString("Hyperpigmentation"));
                                          tr_type pi1{"Low Energy","Face\nLow Energy \n1.5 J","facial skin patches",1,"1-4","4-5 days","3 weeks",1,1.5,true};
                                          t->add_tr_type(pi1);
                                          tr_type pi2{"High Energy","Face\nHigh Energy \n2.5 J","facial skin patches",1,"1-4","5-7 days","not defined weeks",1,2.5,false};
                                          t->add_tr_type(pi2);
                                          tr_type pi3{"High Energy","Body \nHigh Energy \n3 J","skin patches \n(body)",1,"1-4","5-7 days","not defined weeks",1,3,false};
                                          t->add_tr_type(pi3);
                                          Agejet::pigmentation=t;
                              
                                          t = new Treatment(4,QString("Non-surgical  Blepharoplasty"));
                                          tr_type bl1{"Non-surgical\nBlefaroplasty","Non-surgical\nBlepharoplasty \n3.5 J","ocular Zone",1,"1-4","7-10 days","not defined weeks",1,3.5,false};
                                          t->add_tr_type(bl1);
                                          Agejet::blefaro=t;
                              
                                          t = new Treatment(5,QString("Custom"));
                                          tr_type cu1{"Custom","","",1,"","","",1,2,false};
                                          Agejet::custom=t;
                                          t->add_tr_type(cu1);
                                      }
                                      else {
                                          if(Agejet::actual_language_name == "rus"){
                              
                                              Treatment *t = new Treatment(0,QString("Шлифовка кожи"));
                                              tr_type sr1{"ВЕРХНИЙ \n СЛОЙ КОЖИ","ВЕРХНИЙ \n СЛОЙ КОЖИ \n Очень \n низкая мощн. \n1 Дж","лицо - шея - \nзона декольте  - руки ",1,"1-4","2-3 дня","4 недели",1,1,true};
                                              tr_type sr2{"ВНУТРЕННИЙ \n СЛОЙ КОЖИ/ДЕРМА","ВНУТРЕННИЙ \n СЛОЙ КОЖИ/\n ДЕРМА \n Низкая мощн. \n1.5 Дж","лицо - шея -\n зона декольте  - руки ",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                              
                                              tr_type sr3{"РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ","РЕТИКУЛЯРНЫЙ \n СЛОЙ ДЕРМЫ \n Высокая мощн. \n3 Дж","Лицо - шея - \nзона декольте - руки ",1,"1-4","7-10 дней","не задано",1,3,false};
                                              tr_type sr4{"ГЛУБОКОЕ РЕМОДЕЛИРОВАНИЕ КОЖИ","ГЛУБОКОЕ \n РЕМОДЕЛИРОВ-Е \n КОЖИ \n  Высокая мощн.\n4 Дж","лицо- шея -\n зона декольте - руки",1,"1-4","7-10 дней","не задано",1,4,false};
                                              t->add_tr_type(sr1);
                                              t->add_tr_type(sr2);
                                              t->add_tr_type(sr3);
                                              t->add_tr_type(sr4);
                                              Agejet::skin_resurfacing=t;
                              
                                              t = new Treatment(1,QString("Вялость кожи"));
                                              tr_type sl1{"Вялость кожи","Вялость кожи \n2 Дж","носогубная\n",2,"1-4","5-7 дней","не задано",1,2,false};
                                              t->add_tr_type(sl1);
                                              Agejet::skin_laxity=t;
                              
                                              t = new Treatment(2,QString("Шрамы постакне"));
                              
                                              tr_type as1{"Шрамы \n постакне","Шрамы \n постакне \n4 Дж","рубцы\n",1,"1-4","7-10 дней","не задано",1,4,false};
                                              t->add_tr_type(as1);
                                              Agejet::acne=t;
                              
                                              t = new Treatment(3,QString("Гиперпигментация"));
                                              tr_type pi1{"Низкая мощность","Лицо\n Низкая мощн. \n1.5 Дж","пигментные пятна \nна лице",1,"1-4","4-5 дней","3 недели",1,1.5,true};
                                              t->add_tr_type(pi1);
                                              tr_type pi2{"Высокая мощность","Лицо\n Высокая мощн. \n2.5 Дж","пигментные пятна \nна лице",1,"1-4","5-7 дней","не задано",1,2.5,false};
                                              t->add_tr_type(pi2);
                                              tr_type pi3{"Высокая мощность","Тело \n Высокая мощн. \n3 Дж","пятна на коже \n(тело)",1,"1-4","5-7 дней","не задано",1,3,false};
                                              t->add_tr_type(pi3);
                                              Agejet::pigmentation=t;
                                              t = new Treatment(4,QString("Нехирургическая \n блефаропластика"));
                              
                                              tr_type bl1{"Нехирургическая \n блефаропластика","Нехирургическая\n блефаропластика \n3.5 Дж","периорбитальная зона\n",1,"1-4","7-10 дней","не задано",1,3.5,false};
                                              t->add_tr_type(bl1);
                                              Agejet::blefaro=t;
                              
                                              t = new Treatment(5,QString("Персонализированные процедуры"));
                                              tr_type cu1{"Персонализированные процедуры","","",1,"","","",1,2,false};
                                              Agejet::custom=t;
                                              t->add_tr_type(cu1);
                                          }
                              
                                      }
                                  }
                              }
                              
                              import_programs();
                              ifstream model_file;
                              string line;
                              model_file.open(Agejet::model_path);
                              bool model_error=false;
                              if(model_file.is_open()){
                                  getline(model_file,line);
                                  QString model = QString::fromStdString(line);
                                  int model_int = model.toInt();
                                  switch (model_int) {
                                  case 16:
                                      Agejet::model=Agejet::AESTHETIC;
                                      Agejet::DIV=Agejet::DIV_HIGH;
                                      Agejet::max_energy=2;
                                      break;
                                  case 17:
                                      Agejet::model=Agejet::MEDICAL;
                                      Agejet::DIV=Agejet::DIV_HIGH;
                                      Agejet::max_energy=4;
                                      break;
                                  case 32:
                                      Agejet::model=Agejet::AESTHETIC_LOW;
                                      Agejet::DIV=Agejet::DIV_LOW;
                                      Agejet::max_energy=2;
                                      break;
                                  case 33:
                                      Agejet::model=Agejet::MEDICAL_LOW;
                                      Agejet::max_energy=4;
                                      Agejet::DIV=Agejet::DIV_LOW;
                                      break;
                                  default:
                                      model_error=true;
                                      break;
                                  }
                              }
                              else {
                                 //.....
                              }
                              model_file.close();
                              load_shoots();
                              }
                              
                              void BootWindow::import_programs()
                              {
                                  Agejet::prog_1=Program::import_program(Agejet::prog_path+Agejet::prog_1_name);
                                  Agejet::prog_2=Program::import_program(Agejet::prog_path+Agejet::prog_2_name);
                                  Agejet::prog_3=Program::import_program(Agejet::prog_path+Agejet::prog_3_name);
                                  Agejet::prog_4=Program::import_program(Agejet::prog_path+Agejet::prog_4_name);
                              }
                              
                              void BootWindow::load_shoots()
                              {
                                  ifstream shoots_file;
                                  string line;
                                  shoots_file.open(Agejet::hp_shoots_count_path);
                                  if(shoots_file.is_open()){
                                      getline(shoots_file,line);
                                      bool ok;
                                      QString shoots = QString::fromStdString(line);
                                      int hp_s = shoots.toInt(&ok,10);
                                      if(!ok){//....
                                          Agejet::actual_hp_shoots=0;
                                      }
                                      else Agejet::actual_hp_shoots=hp_s;
                                  }
                                  else {
                                      Agejet::actual_hp_shoots=0;
                                  }
                                  shoots_file.close();
                                  shoots_file.open(Agejet::tips_shoots_count_path);
                                  if(shoots_file.is_open()){
                                      getline(shoots_file,line);
                                      bool ok;
                                      QString shoots = QString::fromStdString(line);
                                      int hp_s = shoots.toInt(&ok,10);
                                      if(!ok){//....
                                          Agejet::actual_tips_shoots=0;
                                      }
                                      else Agejet::actual_tips_shoots=hp_s;
                                  }
                                  else {
                                      Agejet::actual_tips_shoots=0;
                                  }
                              
                                  boot();
                              }
                              
                              void BootWindow::load_language()
                              {
                                  ifstream language;
                                  string lang;
                                  language.open("/home/"+Agejet::home_name.toStdString()+"/lan");
                                  if(language.is_open()){
                                      getline(language,lang);
                                      QString qLan = QString::fromStdString(lang);
                                      if(qLan.contains("ita")){
                                          QTranslator *translator = new QTranslator();
                                          if(translator->load("/home/triworker/agejet_it.qm")){
                                              QApplication::installTranslator(translator);
                                              Agejet::actual_language = translator;
                                              Agejet::actual_language_name = "ita";
                              
                                              mes_dialog.set_ita();
                                              err_dialog.set_ita();
                                              cout<<"ita"<<endl;}
                                          else {
                                              mes_dialog.set_eng();
                                              err_dialog.set_eng();cout<<"eng"<<endl;
                                          }
                                      }
                                      else {
                                          if(qLan.contains("rus")){
                                              cout<<"russo"<<endl;
                                              QTranslator *translator = new QTranslator();
                              
                                              if(translator->load("/home/triworker/agejet_ru.qm")){
                                                  QApplication::installTranslator(translator);
                                                  Agejet::actual_language = translator;
                                                  Agejet::actual_language_name = "rus";
                                                  mes_dialog.set_russ();
                                                  err_dialog.set_russ();
                              
                                                  Agejet::Hz="Гц";
                                                  Agejet::J="Дж";
                              
                                              }
                                              else {
                                                  mes_dialog.set_eng();
                                                  err_dialog.set_eng();cout<<"eng"<<endl;
                                              }
                                          }
                              
                                          //if(qLan.contains("ita")){
                                          //  mes_dialog.set_eng();
                                          //err_dialog.set_eng();
                                          //}
                                      }
                              
                                  }
                                  else {
                                      mes_dialog.set_eng();
                                      err_dialog.set_eng();
                                  }
                                  language.close();
                                  create_treatments();
                              }
                              
                              void BootWindow::boot()
                              {
                                  connect(&Agejet::sr_works,SIGNAL(finished()),this,SLOT(open_main_window()));
                                  Agejet::sr_works.sw_function="boot";
                                  Agejet::sr_works.start();
                              }
                              
                              void BootWindow::open_main_window()
                              {
                                  if(Agejet::test){
                                      mes_dialog.set_language();
                                  }
                                  disconnect(&Agejet::sr_works,SIGNAL(finished()),this,SLOT(open_main_window()));
                                  Main_Window *win = new Main_Window();
                                  this->close();
                                  win->show();
                              
                              }
                              
                              
                              
                              
                              
                              JonBJ Online
                              JonBJ Online
                              JonB
                              wrote on last edited by JonB
                              #15

                              @AntonioValentin
                              Same question: it's just a C++ issue, only you know what you intend when you get to the line
                              import_programs();
                              in the middle of the file outside of any function definitions, because I don't know....

                              1 Reply Last reply
                              0
                              • A AntonioValentin

                                error

                                ‘model_file’ does not name a type line: 255
                                expected constructor, destructor, or type conversion before ‘;’ token: line 252
                                expected unqualified-id before ‘if’: line 257

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                @AntonioValentin As @JonB wrote: that bunch of code is outside of any function/method and is invalid for that reason.
                                Also if saying error is in line 255 you could at least mark that line in the code you posted, because else people have to count the lines to find out which line that actually is (and this only works if you posted whole content of the file).

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                3

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved