def main():
    qt_set_sequence_auto_mnemonic(False)

    if hasattr(Qt, 'AA_EnableHighDpiScaling'):
        QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
    if hasattr(Qt, 'AA_Use96Dpi'):
        QGuiApplication.setAttribute(Qt.AA_Use96Dpi, True)
    if hasattr(Qt, 'AA_ShareOpenGLContexts'):
        fmt = QSurfaceFormat()
        fmt.setDepthBufferSize(24)
        QSurfaceFormat.setDefaultFormat(fmt)
        QGuiApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True)

    # if sys.platform == 'darwin':
    #     qApp.setStyle('Fusion')

    app = SingleApplication(vidcutter.__appid__, sys.argv)
    app.setApplicationName(vidcutter.__appname__)
    app.setApplicationVersion(vidcutter.__version__)
    app.setDesktopFileName(vidcutter.__desktopid__)
    app.setOrganizationDomain(vidcutter.__domain__)
    app.setQuitOnLastWindowClosed(True)

    win = MainWindow()
    win.stylename = app.style().objectName().lower()
    app.setActivationWindow(win)
    app.messageReceived.connect(win.file_opener)
    app.aboutToQuit.connect(MainWindow.cleanup)

    exit_code = app.exec_()
    if exit_code == MainWindow.EXIT_CODE_REBOOT:
        if sys.platform == 'win32':
            if hasattr(win.cutter, 'mpvWidget'):
                win.close()
            QProcess.startDetached('"{}"'.format(qApp.applicationFilePath()))
        else:
            QProcess.startDetached(' '.join(sys.argv))
    sys.exit(exit_code)