@@ -21,6 +21,7 | |||||
21 | #include "window.h" |
|
21 | #include "window.h" | |
22 | #include <QApplication> |
|
22 | #include <QApplication> | |
23 | #include <QMainWindow> |
|
23 | #include <QMainWindow> | |
|
24 | #include <iostream> | |||
24 |
|
25 | |||
25 | QVariantHash parseArgs(QStringList args) |
|
26 | QVariantHash parseArgs(QStringList args) | |
26 | { |
|
27 | { | |
@@ -54,10 +55,29 QVariantHash parseArgs(QStringList args) | |||||
54 | return parameters; |
|
55 | return parameters; | |
55 | } |
|
56 | } | |
56 |
|
57 | |||
|
58 | void printHelp() | |||
|
59 | { | |||
|
60 | std::cout << "chartviewer <options> "<< std::endl; | |||
|
61 | std::cout << " --view <1/2/3/4> - set size of charts' grid" << std::endl; | |||
|
62 | std::cout << " --chart <categoryName::subCategory::chartName> - set template to be show " << std::endl; | |||
|
63 | std::cout << " --opengl <enabled/disbaled> - set opengl mode" << std::endl; | |||
|
64 | std::cout << " --theme <name> - set theme" << std::endl; | |||
|
65 | std::cout << " --legend <alignment> - set legend alignment" << std::endl; | |||
|
66 | std::cout << " --help - prints this help" << std::endl; | |||
|
67 | std::cout << "Examples: " << std::endl; | |||
|
68 | std::cout << " chartviewer --view 4 --chart Axis" << std::endl; | |||
|
69 | std::cout << " chartviewer --view 1 --chart Axis::BarCategoryAxis::Axis " << std::endl; | |||
|
70 | } | |||
|
71 | ||||
57 | int main(int argc, char *argv[]) |
|
72 | int main(int argc, char *argv[]) | |
58 | { |
|
73 | { | |
59 | QApplication a(argc, argv); |
|
74 | QApplication a(argc, argv); | |
60 | QVariantHash parameters = parseArgs(QApplication::arguments()); |
|
75 | QVariantHash parameters = parseArgs(QApplication::arguments()); | |
|
76 | if(parameters.contains("help")) | |||
|
77 | { | |||
|
78 | printHelp(); | |||
|
79 | return 0; | |||
|
80 | } | |||
61 | Window window(parameters); |
|
81 | Window window(parameters); | |
62 | window.show(); |
|
82 | window.show(); | |
63 | return a.exec(); |
|
83 | return a.exec(); |
@@ -214,8 +214,8 QComboBox *Window::createTempleteBox() | |||||
214 |
|
214 | |||
215 | void Window::initializeFromParamaters(const QVariantHash ¶meters) |
|
215 | void Window::initializeFromParamaters(const QVariantHash ¶meters) | |
216 | { |
|
216 | { | |
217 |
if (parameters.contains(" |
|
217 | if (parameters.contains("chart")) { | |
218 |
QString t = parameters[" |
|
218 | QString t = parameters["chart"].toString(); | |
219 | for (int i = 0; i < m_templateComboBox->count(); ++i) { |
|
219 | for (int i = 0; i < m_templateComboBox->count(); ++i) { | |
220 | if (m_templateComboBox->itemText(i) == t) { |
|
220 | if (m_templateComboBox->itemText(i) == t) { | |
221 | m_templateComboBox->setCurrentIndex(i); |
|
221 | m_templateComboBox->setCurrentIndex(i); |
General Comments 0
You need to be logged in to leave comments.
Login now