main.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Róbert Márki
  4. **
  5. ** This file is part of Web Feeds.
  6. **
  7. ** Web Feeds is free software: you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation, either version 3 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** Web Feeds is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
  19. ****************************************************************************/
  20. #include <QtGui/QApplication>
  21. #include <QtDeclarative>
  22. #include <QPalette>
  23. #include <QDebug>
  24. #include "qmlapplicationviewer.h"
  25. #include "pageitemmodel.h"
  26. #include "pageitem.h"
  27. #include "abstractfeedaggreagatorservice.h"
  28. #include "webfeedsapp.h"
  29. #include "applicationsettings.h"
  30. Q_DECL_EXPORT int main(int argc, char *argv[])
  31. {
  32. QScopedPointer<QApplication> app(createApplication(argc, argv));
  33. app->setOrganizationName("gsmiko");
  34. app->setApplicationName("Web Feeds");
  35. /*change the applications color palette
  36. this is the only way to change the color of links
  37. inside a QML Text element*/
  38. QPalette palette = app->palette();
  39. palette.setColor(QPalette::Link, qRgb(255, 140, 0));
  40. app->setPalette(palette);
  41. //register the types of the WebFeeds namespace
  42. qmlRegisterType<WebFeeds::PageItemModel>("WebFeeds", 1, 0, "PageItemModel");
  43. qmlRegisterType<PageItem>("WebFeeds", 1, 0, "PageItem");
  44. qmlRegisterType<ApplicationSettings>("WebFeeds", 1, 0, "ApplicationSettings");
  45. qmlRegisterType<WebFeeds::WebFeedsApp>("WebFeeds", 1, 0, "WebFeedsApp");
  46. qmlRegisterType<AbstractFeedAggreagatorService>();
  47. QmlApplicationViewer viewer;
  48. WebFeeds::WebFeedsApp webFeedsApp;
  49. //expose the WebFeedsApp instance as a context property
  50. viewer.rootContext()->setContextProperty("webFeedsApp", &webFeedsApp);
  51. webFeedsApp.initialize(viewer.engine());
  52. viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
  53. viewer.setMainQmlFile(QLatin1String("qrc:/app/qml/main.qml"));
  54. viewer.showExpanded();
  55. return app->exec();
  56. }