main.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. Copyright (C) 2016 Tobias Platen
  3. This file is part of OREMO2.
  4. OREMO2 is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #include "mainwindow.h"
  16. #include <QApplication>
  17. #include "jackconnector.h"
  18. #include "recordingmanager.h"
  19. #include "controller.h"
  20. #include <sys/file.h>
  21. #include <errno.h>
  22. #include <unistd.h>
  23. int main(int argc, char *argv[])
  24. {
  25. //TODO: move to common shared lib
  26. int pid_file = open("/tmp/oremo2.lock", O_CREAT | O_RDWR, 0666);
  27. int rc = flock(pid_file, LOCK_EX | LOCK_NB);
  28. if(rc) {
  29. if(EWOULDBLOCK == errno)
  30. {
  31. fprintf(stderr,"oremo is running\n");
  32. return rc;
  33. }
  34. }
  35. QApplication a(argc, argv);
  36. //create remote
  37. //Controller* ctrl = new Controller();
  38. JackConnector* jack = new JackConnector(&a);
  39. RecordingManager* rec = new RecordingManager(&a);
  40. rec->init(jack);
  41. MainWindow w(rec);
  42. w.show();
  43. return a.exec();
  44. }