Changeset - 98500ddba1a3
[Not reviewed]
Mehmet Aslan - 7 years ago 2019-03-30 06:13:10
aaslan-mehmet@hotmail.com
Qapplication instance singleton. Reaching instance outside unnecessary, handleCommandLineOptions moved in to MW constructor.
3 files changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/main.cpp
Show inline comments
 
@@ -39,13 +39,12 @@ int main(int argc, char *argv[])
 
    QApplication::setApplicationName(PROGRAM_NAME_STRING);
 
    QApplication::setApplicationVersion(VERSION_STRING);
 
    MainWindow w;
 
    pMainWindow = &w;
 

	
 
    qInstallMessageHandler(messageHandler);
 
    w.handleCommandLineOptions(a);
 

	
 
    ToolTipFilter ttf;
 
    a.installEventFilter(&ttf);
 

	
 
    // log application information
 
    qDebug() << "SerialPlot" << VERSION_STRING;
src/mainwindow.cpp
Show inline comments
 
@@ -267,12 +267,14 @@ MainWindow::MainWindow(QWidget *parent) 
 
    // the very first run.
 
    connect(commandPanel.newCommandAction(), &QAction::triggered, [this]()
 
            {
 
                this->ui->tabWidget->setCurrentWidget(&commandPanel);
 
                this->ui->tabWidget->showTabs();
 
            });
 

	
 
    handleCommandLineOptions(*QApplication::instance());
 
}
 

	
 
MainWindow::~MainWindow()
 
{
 
    if (serialPort.isOpen())
 
    {
src/mainwindow.h
Show inline comments
 
@@ -61,13 +61,12 @@ public:
 
    ~MainWindow();
 

	
 
    PlotViewSettings viewSettings() const;
 

	
 
    void messageHandler(QtMsgType type, const QMessageLogContext &context,
 
                        const QString &msg);
 
    void handleCommandLineOptions(const QCoreApplication &app);
 

	
 
private:
 
    Ui::MainWindow *ui;
 

	
 
    QDialog aboutDialog;
 
    void setupAboutDialog();
 
@@ -91,12 +90,14 @@ private:
 
    RecordPanel recordPanel;
 
    PlotControlPanel plotControlPanel;
 
    PlotMenu plotMenu;
 
    DataTextView textView;
 
    UpdateCheckDialog updateCheckDialog;
 

	
 
    void handleCommandLineOptions(const QCoreApplication &app);
 

	
 
    /// Returns true if demo is running
 
    bool isDemoRunning();
 
    /// Display a secondary plot in the splitter, removing and
 
    /// deleting previous one if it exists
 
    void showSecondary(QWidget* wid);
 
    /// Hide secondary plot
0 comments (0 inline, 0 general)