/*************************************************************************** musrStep.cpp Author: Andreas Suter e-mail: andreas.suter@psi.ch ***************************************************************************/ /*************************************************************************** * Copyright (C) 2007-2025 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ /** * @file musrStep.cpp * @brief Main entry point for the musrStep application. * @details musrStep is a Qt-based GUI application for adjusting fit parameter * step sizes in muSR msr-files. It provides an interactive interface to view, * select, and modify the step values of fit parameters used by musrfit. * * The application supports both automatic step size adjustment based on * parameter naming conventions and manual scaling by user-defined factors. * * @author Andreas Suter * @date 2007-2025 * @copyright GNU General Public License v2 or later */ #include #include #include #include #ifdef HAVE_GIT_REV_H #include "git-revision.h" #endif #include "PMusrStep.h" //------------------------------------------------------------------------- /** * @brief Prints the command-line syntax and usage information to stdout. * @details This function displays the available command-line options: * - \: The msr-file name to open and edit * - -v, --version: Display git version information * - -h, --help: Display this help message */ void musrStep_syntax() { std::cout << std::endl; std::cout << "usage: musrStep | [-v | --version] | [-h | --help]" << std::endl; std::cout << " : msr-file name." << std::endl; std::cout << " -v, --version: print the current git-version to the stdout" << std::endl; std::cout << " -h, --help: print this help" << std::endl; std::cout << std::endl << std::endl; } //------------------------------------------------------------------------- /** * @brief Main entry point for the musrStep application. * @details Parses command-line arguments and launches the musrStep GUI. * * The application expects exactly one argument which can be: * - A path to an msr-file to open * - -v or --version to display version information * - -h or --help to display usage information * * @param argc Number of command-line arguments * @param argv Array of command-line argument strings * @return 0 on success, 1 on error or invalid usage */ int main(int argc, char *argv[]) { char fln[1024]; if (argc != 2) { musrStep_syntax(); return 1; } else { if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) { #ifdef HAVE_GIT_REV_H std::cout << std::endl << "musrStep - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl; #else std::cout << std::endl << "musrStep - git-branch: unknown, git-rev: unknown" << std::endl << std::endl; #endif return 0; } else if (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-h"))) { musrStep_syntax(); return 0; } else { strncpy(fln, argv[1], sizeof(fln)); } } Q_INIT_RESOURCE(musrStep); QApplication app(argc, argv); PMusrStep musrStep(fln); if (!musrStep.isValid()) return 1; musrStep.show(); app.exec(); int result = musrStep.result(); return result; }