From 9cb78ede183571984e8b47ac912f7121fb83c975 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 5 May 2014 14:10:56 +0200 Subject: Fix layout, give proper name to bug report button, disable button as long as it's not doing anything, add --fullscreen option --- src/command_line_options.cpp | 5 +++++ src/dialog.cpp | 3 +++ src/main.cpp | 45 ++++++++++++++++++++++++++++---------------- src/ui/dialog.ui | 14 +++++++------- 4 files changed, 44 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/command_line_options.cpp b/src/command_line_options.cpp index fd946bd..cfd5e08 100644 --- a/src/command_line_options.cpp +++ b/src/command_line_options.cpp @@ -6,9 +6,11 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { // parse command line arguments (please sort by short option for easier handling) static const struct option longOptions[] = { {"base", required_argument, NULL, 'b'}, + {"path", required_argument, NULL, 'b'}, // Compatibility to v1.0 {"config", required_argument, NULL, 'c'}, {"debug", no_argument, NULL, 'D'}, {"default", required_argument, NULL, 'd'}, + {"fullscreen", no_argument, NULL, 'F'}, {"file", required_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"pool", required_argument, NULL, 'P'}, @@ -39,6 +41,9 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]) { case 'd': options.insert("default", optarg); break; + case 'F': + options.insert("fullscreen", "fullscreen"); + break; case 'f': options.insert("file", optarg); break; diff --git a/src/dialog.cpp b/src/dialog.cpp index 6d42491..be8d976 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -53,6 +53,9 @@ Dialog::Dialog(QWidget *parent) this, SLOT(treeView_selectionChanged(const QModelIndex&, const QModelIndex&))); this->onTabButtonChanged(2); + + // TODO: Implement bug report dialog :) + ui->buttonBugReport->setEnabled(false); } Dialog::~Dialog() { diff --git a/src/main.cpp b/src/main.cpp index 87f30b9..30e30f3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -145,26 +145,32 @@ int main(int argc, char *argv[]) { } QString size; - if (cmdOptions.contains("size")) { + int width, height; + if (cmdOptions.contains("fullscreen")) { + size = "fullscreen"; + } else if (settings.contains("fullscreen")) { + size = "fullscreen"; + } else if (cmdOptions.contains("size")) { size = cmdOptions.value("size"); } else if (settings.contains("size")) { size = settings.value("size").toString(); } - int width, height; - QRegExp rx("^(\\d+)x(\\d+)$"); - if (rx.indexIn(size) != -1) { - QStringList list = rx.capturedTexts(); - width = list.value(1).toInt(); - height = list.value(2).toInt(); - } else if (!size.isEmpty()) { - std::cerr - << a.translate("Console", "vmchooser: invalid size argument").toUtf8().data() - << std::endl; - return EXIT_FAILURE; - } else { - width = VMCHOOSER_DEFAULT_WIDTH; - height = VMCHOOSER_DEFAULT_HEIGHT; + if (size != "fullscreen") { + QRegExp rx("^(\\d+)x(\\d+)$"); + if (rx.indexIn(size) != -1) { + QStringList list = rx.capturedTexts(); + width = list.value(1).toInt(); + height = list.value(2).toInt(); + } else if (!size.isEmpty()) { + std::cerr + << a.translate("Console", "vmchooser: invalid size argument").toUtf8().data() + << std::endl; + return EXIT_FAILURE; + } else { + width = VMCHOOSER_DEFAULT_WIDTH; + height = VMCHOOSER_DEFAULT_HEIGHT; + } } if (cmdOptions.contains("pool")) { @@ -187,6 +193,8 @@ int main(int argc, char *argv[]) { basePath = cmdOptions.value("base"); } else if (settings.contains("base")) { basePath = settings.value("base").toString(); + } else if (settings.contains("path")) { // Compatibility to v1.0 + basePath = settings.value("path").toString(); } /* read session files */ @@ -225,6 +233,12 @@ int main(int argc, char *argv[]) { if (pvsEnabled) w.showSettingsPVS(); + QRect desktopRect = QApplication::desktop()->availableGeometry(&w); + if (size == "fullscreen") { + width = desktopRect.width(); + height = desktopRect.height(); + } + w.resize(width, height); if (xsessions.size()) { @@ -241,7 +255,6 @@ int main(int argc, char *argv[]) { w.show(); // center dialog on primary screen - QRect desktopRect = QApplication::desktop()->availableGeometry(&w); QPoint center = desktopRect.center(); w.move(center.x() - w.width() * 0.5, center.y() - w.height() * 0.5); a.setActiveWindow(&w); diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index be55c23..204d486 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -23,7 +23,7 @@ 0 - 4 + 0 0 @@ -126,8 +126,8 @@ margin-bottom:0px;} <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html> +</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -152,8 +152,8 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html> +</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html> @@ -422,7 +422,7 @@ border:1px solid #999; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Open Sans'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Click on an item on the left side for more infos.</span></p></body></html> @@ -538,7 +538,7 @@ p, li { white-space: pre-wrap; } 9 - + Report Bug -- cgit v1.2.3-55-g7522