OBSAbout::OBSAbout(QWidget *parent)
	: QDialog(parent),
	  ui(new Ui::OBSAbout)
{
	ui->setupUi(this);

	setFixedSize(size());

	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	QString bitness;

	if(sizeof(void*) == 4)
		bitness = " (32 bit)";
	else if(sizeof(void*) == 8)
		bitness = " (64 bit)";

	ui->version->setText(
			QString::number(LIBOBS_API_MAJOR_VER) + "." +
			QString::number(LIBOBS_API_MINOR_VER) + "." +
			QString::number(LIBOBS_API_PATCH_VER) +
			bitness);

	ui->contribute->setText(QTStr("About.Contribute"));
	ui->donate->setText("<a href='https://obsproject.com/donate'>" +
			QTStr("About.Donate") + "</a>");
	ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction);
	ui->donate->setOpenExternalLinks(true);

	ui->getInvolved->setText("<a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" +
			QTStr("About.GetInvolved") + "</a>");
	ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction);
	ui->getInvolved->setOpenExternalLinks(true);

	ui->about->setText("<a href='#'>" + QTStr("About") + "</a>");
	ui->authors->setText("<a href='#'>" + QTStr("About.Authors") + "</a>");
	ui->license->setText("<a href='#'>" + QTStr("About.License") + "</a>");

	ui->textBrowser->hide();

	ui->name->setProperty("themeID", "aboutName");
	ui->version->setProperty("themeID", "aboutVersion");
	ui->about->setProperty("themeID", "aboutHLayout");
	ui->authors->setProperty("themeID", "aboutHLayout");
	ui->license->setProperty("themeID", "aboutHLayout");
	ui->info->setProperty("themeID", "aboutInfo");

	connect(ui->about, SIGNAL(clicked()), this, SLOT(ShowAbout()));
	connect(ui->authors, SIGNAL(clicked()), this, SLOT(ShowAuthors()));
	connect(ui->license, SIGNAL(clicked()), this, SLOT(ShowLicense()));
}
Beispiel #2
0
MainWindow::MainWindow() :
    mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
    mApplications(new ApplicationList(this)),
    mTranslation(new TranslationHandler(this)),
    mLanguages(new QActionGroup(this)),
    mLogView(NULL),
    mHelpWindow(NULL),
    mProject(NULL),
    mExiting(false)
{
    mUI.setupUi(this);
    mUI.mResults->Initialize(mSettings, mApplications);

    mThread = new ThreadHandler(this);
    mLogView = new LogView(mSettings);

    connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles()));
    connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory()));
    connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings()));
    connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults()));
    connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(OpenXML()));

    connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
    connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
    connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool)));
    connect(mUI.mActionShowPortability, SIGNAL(toggled(bool)), this, SLOT(ShowPortability(bool)));
    connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool)));
    connect(mUI.mActionShowInformation, SIGNAL(toggled(bool)), this, SLOT(ShowInformation(bool)));
    connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
    connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
    connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
    connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
    connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults()));
    connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
    connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));

    connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));

    connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
    connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));

    connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
    connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense()));
    connect(mUI.mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(ToggleMainToolBar()));
    connect(mUI.mActionToolBarView, SIGNAL(toggled(bool)), this, SLOT(ToggleViewToolBar()));

    connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors()));
    connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
    connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
    connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool)));
    connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));

    connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile()));
    connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile()));
    connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile()));
    connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile()));

    connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));

    CreateLanguageMenuItems();
    LoadSettings();

    mThread->Initialize(mUI.mResults);
    FormatAndSetTitle();

    EnableCheckButtons(true);

    mUI.mActionClearResults->setEnabled(false);
    mUI.mActionSave->setEnabled(false);
    mUI.mActionRecheck->setEnabled(false);
    EnableProjectOpenActions(true);
    EnableProjectActions(false);

    QStringList args = QCoreApplication::arguments();
    //Remove the application itself
    args.removeFirst();
    if (!args.isEmpty())
    {
        DoCheckFiles(args);
    }
}
Beispiel #3
0
MainWindow::MainWindow() :
    mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
    mApplications(new ApplicationList(this)),
    mTranslation(new TranslationHandler(this)),
    mLogView(NULL),
    mProject(NULL),
    mPlatformActions(new QActionGroup(this)),
    mExiting(false)
{
    mUI.setupUi(this);
    mUI.mResults->Initialize(mSettings, mApplications);

    mThread = new ThreadHandler(this);
    mLogView = new LogView;

    // Filter timer to delay filtering results slightly while typing
    mFilterTimer = new QTimer(this);
    mFilterTimer->setInterval(500);
    mFilterTimer->setSingleShot(true);
    connect(mFilterTimer, SIGNAL(timeout()), this, SLOT(FilterResults()));

    // "Filter" toolbar
    mLineEditFilter = new QLineEdit(mUI.mToolBarFilter);
    mLineEditFilter->setPlaceholderText(tr("Quick Filter:"));
    mUI.mToolBarFilter->addWidget(mLineEditFilter);
    connect(mLineEditFilter, SIGNAL(textChanged(const QString&)), mFilterTimer, SLOT(start()));
    connect(mLineEditFilter, SIGNAL(returnPressed()), this, SLOT(FilterResults()));

    connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles()));
    connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory()));
    connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings()));
    connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults()));
    connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(OpenXML()));

    connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
    connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
    connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool)));
    connect(mUI.mActionShowPortability, SIGNAL(toggled(bool)), this, SLOT(ShowPortability(bool)));
    connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool)));
    connect(mUI.mActionShowInformation, SIGNAL(toggled(bool)), this, SLOT(ShowInformation(bool)));
    connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
    connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
    connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
    connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
    connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults()));
    connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
    connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));

    connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));

    connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
    connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));

    // About menu
    connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
    connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense()));

    // View > Toolbar menu
    connect(mUI.mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(ToggleMainToolBar()));
    connect(mUI.mActionToolBarView, SIGNAL(toggled(bool)), this, SLOT(ToggleViewToolBar()));
    connect(mUI.mActionToolBarFilter, SIGNAL(toggled(bool)), this, SLOT(ToggleFilterToolBar()));

    connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors()));
    connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
    connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
    connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool)));
    connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));

    // File menu
    connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile()));
    connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile()));
    connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile()));
    connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile()));

    connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));

    LoadSettings();

    mThread->Initialize(mUI.mResults);
    FormatAndSetTitle();

    EnableCheckButtons(true);

    mUI.mActionClearResults->setEnabled(false);
    mUI.mActionSave->setEnabled(false);
    mUI.mActionRecheck->setEnabled(false);
    EnableProjectOpenActions(true);
    EnableProjectActions(false);

    // Must setup MRU menu before CLI param handling as it can load a
    // project file and update MRU menu.
    for (int i = 0; i < MaxRecentProjects; ++i) {
        mRecentProjectActs[i] = new QAction(this);
        mRecentProjectActs[i]->setVisible(false);
        connect(mRecentProjectActs[i], SIGNAL(triggered()),
                this, SLOT(OpenRecentProject()));
    }
    mRecentProjectActs[MaxRecentProjects] = NULL; // The separator
    mUI.mActionProjectMRU->setVisible(false);
    UpdateMRUMenuItems();

    QStringList args = QCoreApplication::arguments();
    //Remove the application itself
    args.removeFirst();
    if (!args.isEmpty()) {
        HandleCLIParams(args);
    }

    for (int i = 0; i < mPlatforms.getCount(); i++) {
        Platform plat = mPlatforms.mPlatforms[i];
        QAction *act = new QAction(this);
        plat.mActMainWindow = act;
        mPlatforms.mPlatforms[i] = plat;
        act->setText(plat.mTitle);
        act->setData(plat.mType);
        act->setCheckable(true);
        act->setActionGroup(mPlatformActions);
        mUI.mMenuCheck->insertAction(mUI.mActionPlatforms, act);
        connect(act, SIGNAL(triggered()), this, SLOT(SelectPlatform()));
    }

    // For Windows platforms default to Win32 checked platform.
    // For other platforms default to unspecified/default which means the
    // platform Cppcheck GUI was compiled on.
#if defined(_WIN32)
    Platform &plat = mPlatforms.get(Settings::Win32A);
#else
    Platform &plat = mPlatforms.get(Settings::Unspecified);
#endif
    plat.mActMainWindow->setChecked(true);
    mSettings->setValue(SETTINGS_CHECKED_PLATFORM, plat.mType);
}
Beispiel #4
0
MainWindow::MainWindow() :
    mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
    mApplications(new ApplicationList(this)),
    mTranslation(new TranslationHandler(this)),
    mLogView(NULL),
    mProject(NULL),
    mExiting(false)
{
    mUI.setupUi(this);
    mUI.mResults->Initialize(mSettings, mApplications);

    mThread = new ThreadHandler(this);
    mLogView = new LogView;

    // Filter timer to delay filtering results slightly while typing
    mFilterTimer = new QTimer(this);
    mFilterTimer->setInterval(500);
    mFilterTimer->setSingleShot(true);
    connect(mFilterTimer, SIGNAL(timeout()), this, SLOT(FilterResults()));

    // "Filter" toolbar
    mLineEditFilter = new QLineEdit(mUI.mToolBarFilter);
    mLineEditFilter->setPlaceholderText(tr("Quick Filter:"));
    mUI.mToolBarFilter->addWidget(mLineEditFilter);
    connect(mLineEditFilter, SIGNAL(textChanged(const QString&)), mFilterTimer, SLOT(start()));
    connect(mLineEditFilter, SIGNAL(returnPressed()), this, SLOT(FilterResults()));

    connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles()));
    connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory()));
    connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings()));
    connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults()));
    connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(OpenXML()));

    connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
    connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
    connect(mUI.mActionShowWarnings, SIGNAL(toggled(bool)), this, SLOT(ShowWarnings(bool)));
    connect(mUI.mActionShowPortability, SIGNAL(toggled(bool)), this, SLOT(ShowPortability(bool)));
    connect(mUI.mActionShowPerformance, SIGNAL(toggled(bool)), this, SLOT(ShowPerformance(bool)));
    connect(mUI.mActionShowInformation, SIGNAL(toggled(bool)), this, SLOT(ShowInformation(bool)));
    connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
    connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
    connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
    connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));
    connect(mUI.mActionShowHidden, SIGNAL(triggered()), mUI.mResults, SLOT(ShowHiddenResults()));
    connect(mUI.mActionViewLog, SIGNAL(triggered()), this, SLOT(ShowLogView()));
    connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));

    connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));

    connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
    connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));

    // About menu
    connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
    connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense()));

    // View > Toolbar menu
    connect(mUI.mActionToolBarMain, SIGNAL(toggled(bool)), this, SLOT(ToggleMainToolBar()));
    connect(mUI.mActionToolBarView, SIGNAL(toggled(bool)), this, SLOT(ToggleViewToolBar()));
    connect(mUI.mActionToolBarFilter, SIGNAL(toggled(bool)), this, SLOT(ToggleFilterToolBar()));

    connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors()));
    connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
    connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
    connect(mUI.mResults, SIGNAL(ResultsHidden(bool)), mUI.mActionShowHidden, SLOT(setEnabled(bool)));
    connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));

    // File menu
    connect(mUI.mActionNewProjectFile, SIGNAL(triggered()), this, SLOT(NewProjectFile()));
    connect(mUI.mActionOpenProjectFile, SIGNAL(triggered()), this, SLOT(OpenProjectFile()));
    connect(mUI.mActionCloseProjectFile, SIGNAL(triggered()), this, SLOT(CloseProjectFile()));
    connect(mUI.mActionEditProjectFile, SIGNAL(triggered()), this, SLOT(EditProjectFile()));

    connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));

    LoadSettings();

    mThread->Initialize(mUI.mResults);
    FormatAndSetTitle();

    EnableCheckButtons(true);

    mUI.mActionClearResults->setEnabled(false);
    mUI.mActionSave->setEnabled(false);
    mUI.mActionRecheck->setEnabled(false);
    EnableProjectOpenActions(true);
    EnableProjectActions(false);

    QStringList args = QCoreApplication::arguments();
    //Remove the application itself
    args.removeFirst();
    if (!args.isEmpty())
    {
        HandleCLIParams(args);
    }

    for (int i = 0; i < MaxRecentProjects; ++i)
    {
        mRecentProjectActs[i] = new QAction(this);
        mRecentProjectActs[i]->setVisible(false);
        connect(mRecentProjectActs[i], SIGNAL(triggered()),
                this, SLOT(OpenRecentProject()));
    }
    mUI.mActionProjectMRU->setVisible(false);
    UpdateMRUMenuItems();
}
Beispiel #5
0
MainWindow::MainWindow() :
        mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
        mApplications(new ApplicationList(this)),
        mTranslation(new TranslationHandler(this)),
        mLanguages(new QActionGroup(this))
{
    mUI.setupUi(this);
    mUI.mResults->Initialize(mSettings, mApplications);


    mThread = new ThreadHandler(this);



    connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles()));
    connect(mUI.mActionCheckDirectory, SIGNAL(triggered()), this, SLOT(CheckDirectory()));
    connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(ProgramSettings()));
    connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(ClearResults()));

    connect(mUI.mActionShowAll, SIGNAL(toggled(bool)), this, SLOT(ShowAll(bool)));
    connect(mUI.mActionShowStyle, SIGNAL(toggled(bool)), this, SLOT(ShowStyle(bool)));
    connect(mUI.mActionShowAllStyle, SIGNAL(toggled(bool)), this, SLOT(ShowAllStyle(bool)));
    connect(mUI.mActionShowErrors, SIGNAL(toggled(bool)), this, SLOT(ShowErrors(bool)));
    connect(mUI.mActionCheckAll, SIGNAL(triggered()), this, SLOT(CheckAll()));
    connect(mUI.mActionUncheckAll, SIGNAL(triggered()), this, SLOT(UncheckAll()));
    connect(mUI.mActionCollapseAll, SIGNAL(triggered()), mUI.mResults, SLOT(CollapseAllResults()));
    connect(mUI.mActionExpandAll, SIGNAL(triggered()), mUI.mResults, SLOT(ExpandAllResults()));

    connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));

    connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
    connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));

    connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
    connect(mUI.mActionLicense, SIGNAL(triggered()), this, SLOT(ShowLicense()));
    connect(mUI.mActionToolbar, SIGNAL(toggled(bool)), this, SLOT(ToggleToolbar()));

    connect(mUI.mActionAuthors, SIGNAL(triggered()), this, SLOT(ShowAuthors()));
    connect(mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
    connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
    connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));


    CreateLanguageMenuItems();
    LoadSettings();

    mThread->Initialize(mUI.mResults);
    FormatAndSetTitle();

    EnableCheckButtons(true);

    mUI.mActionClearResults->setEnabled(false);
    mUI.mActionSave->setEnabled(false);



    QStringList args = QCoreApplication::arguments();
    //Remove the application itself
    args.removeFirst();
    if (!args.isEmpty())
    {
        DoCheckFiles(args);
    }
}
Beispiel #6
0
INT_PTR CALLBACK DialogProc(
	HWND hWnd,		// handle to dialog box
	UINT msg,		// message
	WPARAM wParam,	// first message parameter
	LPARAM lParam)	// second message parameter
{

	switch (msg)
	{
	case WM_INITDIALOG:

		{
			DWORD common_control_lib_version= GetDllVersion(_T("comctl32.dll"));

			g_update_common_ctrls = common_control_lib_version < PACKVERSION(5,80);	// anything below 5.80 is worth upgrading
			//{
			//	::MessageBox(hWnd, _T("ExifPro requires Common Controls library (ComCtl32.dll) version 4.71 or higher.\n\n")
			//		_T("This library can be found on the Microsoft download site either as a stand-alone \n")
			//		_T("component or part of the Internet Explorer 4.0 or later install package."),
			//		g_INSTALLER, MB_OK | MB_ICONERROR);
			//	::EndDialog(hWnd, IDCANCEL);
			//	return false;
			//}
		}

		if (g_update_common_ctrls)
		{
			// hide it--comctl updater needs to restart
			::ShowWindow(::GetDlgItem(hWnd, IDC_RUN), SW_HIDE);
		}

		{
			HICON icon= ::LoadIcon(g_instance_handle, MAKEINTRESOURCE(IDR_MAINFRAME));
			::SendMessage(hWnd, WM_SETICON, ICON_SMALL, LPARAM(icon));
			::SendMessage(hWnd, WM_SETICON, ICON_BIG, LPARAM(icon));
		}

		{
			HDC dc= ::GetWindowDC(hWnd);
			int log_pixels_y= ::GetDeviceCaps(dc, LOGPIXELSY);
			::ReleaseDC(hWnd, dc);

			// create title font
			{
				HFONT font= static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
				LOGFONT lf;
				::GetObject(font, sizeof lf, &lf);
				lf.lfWeight = FW_BOLD;
				lf.lfHeight = -MulDiv(18, log_pixels_y, 96);
				lf.lfWidth = 0;
				lf.lfQuality = ANTIALIASED_QUALITY;
				_tcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Tahoma"));
				g_fntTitle = ::CreateFontIndirect(&lf);
			}
			// create license info font
			{
				HFONT font= static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
				LOGFONT lf;
				::GetObject(font, sizeof lf, &lf);
				lf.lfWeight = FW_NORMAL;
				lf.lfHeight = -MulDiv(9, log_pixels_y, 96);
				lf.lfWidth = 0;
				//lf.lfQuality = ANTIALIASED_QUALITY;
				_tcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Small Fonts"));
				g_fntLicense = ::CreateFontIndirect(&lf);
			}
		}

		g_camera_image = ::ImageList_LoadImage(g_instance_handle, MAKEINTRESOURCE(IDB_CAMERA), 48, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION);

		{
			TCHAR path[2 * MAX_PATH]= _T("c:\\Program Files");
			ITEMIDLIST* idl= 0;
			if (g_IsWindows64)
			{
				if (HINSTANCE dll= ::LoadLibrary(_T("shell32.dll")))
				{
					typedef HRESULT (STDAPICALLTYPE *FN_SHGetKnownFolderIDList)(REFKNOWNFOLDERID, DWORD, HANDLE, PIDLIST_ABSOLUTE*);

					FN_SHGetKnownFolderIDList SHGetKnownFolderIDListFn= reinterpret_cast<FN_SHGetKnownFolderIDList>(::GetProcAddress(dll, "SHGetKnownFolderIDList"));

					if (SHGetKnownFolderIDListFn)
					{
						if (SHGetKnownFolderIDListFn(FOLDERID_ProgramFilesX64, 0, HANDLE(0), &idl) == S_OK)
						{
							::SHGetPathFromIDList(idl, path);

							IMallocPtr malloc;
							if (::SHGetMalloc(&malloc) == 0)
								malloc->Free(idl);
						}
					}

					::FreeLibrary(dll);
				}

				if (idl == 0)
				{
					TCHAR buffer[MAX_PATH];
					DWORD d= ::GetEnvironmentVariable(_T("ProgramW6432"), buffer, MAX_PATH);
					if (d > 0)
						_tcscpy_s(path, MAX_PATH, buffer);
				}
			}
			else if (::SHGetSpecialFolderLocation(hWnd, CSIDL_PROGRAM_FILES, &idl) == 0)
			{
				::SHGetPathFromIDList(idl, path);

				IMallocPtr malloc;
				if (::SHGetMalloc(&malloc) == 0)
					malloc->Free(idl);
			}
			_tcscat_s(path, MAX_PATH * 2, _T("\\ExifPro ") EP_VER);

			::SetDlgItemText(hWnd, IDC_FOLDER, path);

			if (pfnAutoCompleteFn)
				(*pfnAutoCompleteFn)(::GetDlgItem(hWnd, IDC_FOLDER), SHACF_FILESYSTEM);
		}

		::CheckDlgButton(hWnd, IDC_RUN, 1);
		::CheckDlgButton(hWnd, IDC_ADD_ICON, 1);
		::CheckDlgButton(hWnd, IDC_PROGRAMS, 1);

		if (HWND edit= ::GetDlgItem(hWnd, IDC_FOLDER))
			::SendMessage(edit, EM_LIMITTEXT, MAX_PATH - 16, 0);

		::SendMessage(hWnd, WM_NEXTDLGCTL, WPARAM(::GetDlgItem(hWnd, IDOK)), 1L);

		return false;


	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			{
				TCHAR path[MAX_PATH]= { 0 };
				if (::GetDlgItemText(hWnd, IDC_FOLDER, path, MAX_PATH) > 0)
				{
					HCURSOR cursor= ::SetCursor(::LoadCursor(0, IDC_WAIT));

					if (InstallExifPro(path, !!::IsDlgButtonChecked(hWnd, IDC_ADD_ICON), !!::IsDlgButtonChecked(hWnd, IDC_PROGRAMS)))
					{
						if (!g_update_common_ctrls)	// if comctl updated it waits for a restart
						{
							// launch ExifPro?
							if (::IsDlgButtonChecked(hWnd, IDC_RUN))
							{
								TCHAR exif[MAX_PATH * 2]= { 0 };
								AppendFileName(path, g_EXIF_APP, exif);
								::ShellExecute(0, _T("open"), exif, 0, 0, SW_SHOWNORMAL);
							}
							else
							{
								::MessageBox(hWnd, _T("ExifPro was installed successfully."), g_INSTALLER, MB_ICONINFORMATION | MB_OK);
							}
						}

						::EndDialog(hWnd, wParam);
					}
				}
			}
			return true;

		case IDCANCEL:
			::EndDialog(hWnd, wParam);
			return TRUE;

		case IDC_BROWSE_DIR:
			BrowseDir(hWnd);
			break;

		case ID_LICENSE:
			ShowLicense();
			break;
		}
		return TRUE;


	case WM_ERASEBKGND:
		if (HDC dc= HDC(wParam))
		{
			RECT rect;
			::GetClientRect(hWnd, &rect);

			RECT rectTop= rect;
			rectTop.bottom = 50;
			rect.top = rectTop.bottom;

			::SetBkMode(dc, OPAQUE);

			::SetBkColor(dc, RGB(255,255,255));
			::ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rectTop, 0, 0, 0);

			::ImageList_Draw(g_camera_image, 0, dc, 14, 7, ILD_NORMAL);

			HGDIOBJ hOld= ::SelectObject(dc, g_fntTitle);
			::SetTextColor(dc, RGB(0,0,0));
			
			const TCHAR* title= _T("ExifPro ") EP_VER _T(" Installer");
			::ExtTextOut(dc, 74, 13, 0, 0, title, _tcslen(title), 0);
			::SelectObject(dc, hOld);

			::SetBkColor(dc, ::GetSysColor(COLOR_3DSHADOW));
			RECT rectLine= rectTop;
			rectLine.top = rectLine.bottom - 1;
			::ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rectLine, 0, 0, 0);

			::SetBkColor(dc, ::GetSysColor(COLOR_3DFACE));
			::ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);

			hOld = ::SelectObject(dc, g_fntLicense);
			::SetTextColor(dc, RGB(0,0,0));

			const TCHAR* info= _T("By installing this product, you are agreeing to be bound by the terms of the license.");
			::ExtTextOut(dc, rect.left + 16, rect.bottom - 16, 0, 0, info, _tcslen(info), 0);
			::SelectObject(dc, hOld);
		}
		return true;
	}

	return 0;
}