-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
168 changed files
with
11,041 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# C++ objects and libs | ||
*.slo | ||
*.lo | ||
*.o | ||
*.a | ||
*.la | ||
*.lai | ||
*.so | ||
*.dll | ||
*.dylib | ||
|
||
# Qt-es | ||
object_script.*.Release | ||
object_script.*.Debug | ||
*_plugin_import.cpp | ||
/.qmake.cache | ||
/.qmake.stash | ||
*.pro.user | ||
*.pro.user.* | ||
*.qbs.user | ||
*.qbs.user.* | ||
*.moc | ||
moc_*.cpp | ||
moc_*.h | ||
qrc_*.cpp | ||
ui_*.h | ||
*.qmlc | ||
*.jsc | ||
Makefile* | ||
*build-* | ||
|
||
# Qt unit tests | ||
target_wrapper.* | ||
|
||
# QtCreator | ||
*.autosave | ||
|
||
# QtCreator Qml | ||
*.qmlproject.user | ||
*.qmlproject.user.* | ||
|
||
# QtCreator CMake | ||
CMakeLists.txt.user* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "CAboutDlg.h" | ||
|
||
CAboutDlg::CAboutDlg(QWidget* parent) | ||
: QDialog(parent) | ||
{ | ||
setupUi(this); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef CABOUTDLG_H | ||
#define CABOUTDLG_H | ||
|
||
#include <QDialog> | ||
#include "ui_aboutDialog.h" | ||
|
||
class CAboutDlg : public QDialog, private Ui::aboutDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
CAboutDlg(QWidget* parent = 0); | ||
virtual ~CAboutDlg() {} | ||
}; | ||
#endif // CABOUTDLG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
#include <QDir> | ||
#include <QFileDialog> | ||
|
||
#include <QFontDialog> | ||
|
||
#include "CConfigDlg.h" | ||
#include "Model/CConfigManager.h" | ||
|
||
CConfigDlg::CConfigDlg(QWidget* parent) | ||
: QDialog(parent) | ||
{ | ||
setupUi(this); | ||
|
||
loadSetting(); | ||
|
||
// connect slot only after when dialog has already been loaded and initial content filled in | ||
createActions(); | ||
} | ||
|
||
QFont CConfigDlg::getProfileDefaultFont() | ||
{ | ||
return profileDefaultFont_; | ||
} | ||
|
||
void CConfigDlg::loadSetting() | ||
{ | ||
CConfigManager* confManager; | ||
|
||
confManager = CConfigManager::getInstance(); | ||
|
||
defaultEditor_lineEdit->setText(confManager->getAppSettingValue("DefaultEditor").toString()); | ||
tagDir_lineEdit->setText(confManager->getAppSettingValue("TagDir").toString()); | ||
srcSubstDrv_lineEdit->setText(confManager->getAppSettingValue("SrcSubstDrv").toString()); | ||
tagSubstDrv_lineEdit->setText(confManager->getAppSettingValue("TagSubstDrv").toString()); | ||
tmpDir_lineEdit->setText(confManager->getAppSettingValue("TmpDir").toString()); | ||
|
||
timeoutRunExtProgram_lineEdit->setText(confManager->getAppSettingValue("TimeoutRunExtProgram").toString()); | ||
|
||
QString profileFontStr = confManager->getAppSettingValue("ProfileFont").toString(); | ||
if (profileFontStr != "") { // load from setting | ||
profileDefaultFont_.fromString(profileFontStr); | ||
} else { | ||
profileDefaultFont_ = QApplication::font(); // using application font as default font | ||
} | ||
|
||
// update profile font setting display | ||
QString fontTextToDisplay = profileDefaultFont_.family() + ", " + QString::number(profileDefaultFont_.pointSize()); | ||
profileFont_lineEdit->setText(fontTextToDisplay); | ||
} | ||
|
||
void CConfigDlg::saveSetting() | ||
{ | ||
CConfigManager* confManager; | ||
|
||
confManager = CConfigManager::getInstance(); | ||
|
||
confManager->setAppSettingValue("DefaultEditor", defaultEditor_lineEdit->text()); | ||
confManager->setAppSettingValue("TagDir", tagDir_lineEdit->text()); | ||
confManager->setAppSettingValue("SrcSubstDrv", srcSubstDrv_lineEdit->text()); | ||
confManager->setAppSettingValue("TagSubstDrv", tagSubstDrv_lineEdit->text()); | ||
confManager->setAppSettingValue("TmpDir", tmpDir_lineEdit->text()); | ||
|
||
confManager->setAppSettingValue("TimeoutRunExtProgram", timeoutRunExtProgram_lineEdit->text()); | ||
|
||
confManager->setAppSettingValue("ProfileFont", profileDefaultFont_.toString()); | ||
} | ||
|
||
void CConfigDlg::createActions() | ||
{ | ||
// for different pages | ||
connect(configListWidget, | ||
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), | ||
this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*))); | ||
|
||
// when setting change | ||
QObject::connect(defaultEditor_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(tagDir_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(srcSubstDrv_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(tagSubstDrv_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(tmpDir_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(timeoutRunExtProgram_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
QObject::connect(profileFont_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged())); | ||
} | ||
|
||
void CConfigDlg::changePage(QListWidgetItem *current, QListWidgetItem *previous) | ||
{ | ||
if (!current) { | ||
current = previous; | ||
} | ||
|
||
configStackedWidget->setCurrentIndex(configListWidget->row(current)); | ||
} | ||
|
||
void CConfigDlg::on_okButton_clicked() | ||
{ | ||
on_applyButton_clicked(); | ||
this->done(QDialog::Accepted); | ||
} | ||
|
||
void CConfigDlg::on_cancelButton_clicked() | ||
{ | ||
this->done(QDialog::Rejected); | ||
} | ||
|
||
void CConfigDlg::on_applyButton_clicked() | ||
{ | ||
saveSetting(); | ||
setWindowModified(false); | ||
} | ||
|
||
void CConfigDlg::configContentChanged() | ||
{ | ||
applyButton->setEnabled(true); | ||
setWindowModified(true); | ||
} | ||
|
||
void CConfigDlg::on_defaultEditor_toolBn_clicked() | ||
{ | ||
QString editorPathname; | ||
|
||
if (defaultEditor_lineEdit->text() != "") { | ||
editorPathname = defaultEditor_lineEdit->text(); | ||
} else { | ||
editorPathname = QDir::currentPath(); | ||
} | ||
|
||
QString programPath = QFileDialog::getOpenFileName(this, | ||
tr("Default Editor"), editorPathname, tr("Program (*.exe)")); | ||
if (programPath != "") { | ||
defaultEditor_lineEdit->setText(programPath); | ||
} | ||
} | ||
|
||
void CConfigDlg::on_profileFont_toolBn_clicked() | ||
{ | ||
bool bOkClicked; | ||
QFont selectedFont = QFontDialog::getFont( | ||
&bOkClicked, profileDefaultFont_, this); | ||
|
||
if (bOkClicked) { | ||
profileDefaultFont_ = selectedFont; | ||
|
||
// update profile font setting display | ||
QString fontTextToDisplay = profileDefaultFont_.family() + ", " + QString::number(profileDefaultFont_.pointSize()); | ||
profileFont_lineEdit->setText(fontTextToDisplay); | ||
} | ||
|
||
} | ||
|
||
void CConfigDlg::on_tagDir_toolBn_clicked() | ||
{ | ||
QString tagDir; | ||
|
||
if (tagDir_lineEdit->text() != "") { | ||
tagDir = tagDir_lineEdit->text(); | ||
} else { | ||
tagDir = QDir::currentPath(); | ||
} | ||
|
||
QString directory = QFileDialog::getExistingDirectory(this, | ||
tr("Tag directory"), tagDir); | ||
if (directory != "") { | ||
tagDir_lineEdit->setText(directory); | ||
} | ||
} | ||
|
||
void CConfigDlg::on_tmpDir_toolBn_clicked() | ||
{ | ||
QString tmpDir; | ||
|
||
if (tmpDir_lineEdit->text() != "") { | ||
tmpDir = tmpDir_lineEdit->text(); | ||
} else { | ||
tmpDir = QDir::currentPath(); | ||
} | ||
|
||
QString directory = QFileDialog::getExistingDirectory(this, | ||
tr("Temp directory"), tmpDir); | ||
if (directory != "") { | ||
tmpDir_lineEdit->setText(directory); | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef CCONFIGDLG_H | ||
#define CCONFIGDLG_H | ||
|
||
#include <QDialog> | ||
#include "ui_configDialog.h" | ||
|
||
class CConfigDlg : public QDialog, private Ui::configDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
CConfigDlg(QWidget* parent = 0); | ||
|
||
virtual ~CConfigDlg() {}; | ||
|
||
QFont getProfileDefaultFont(); | ||
|
||
private slots: | ||
void changePage(QListWidgetItem *current, QListWidgetItem *previous); | ||
void on_okButton_clicked(); | ||
void on_cancelButton_clicked(); | ||
void on_applyButton_clicked(); | ||
|
||
void on_defaultEditor_toolBn_clicked(); | ||
void on_profileFont_toolBn_clicked(); | ||
|
||
void on_tagDir_toolBn_clicked(); | ||
void on_tmpDir_toolBn_clicked(); | ||
|
||
void configContentChanged(); | ||
|
||
private: | ||
void createActions(); | ||
|
||
void loadSetting(); | ||
void saveSetting(); | ||
|
||
QFont profileDefaultFont_; | ||
|
||
|
||
}; | ||
|
||
#endif // CCONFIGDLG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <QKeyEvent> | ||
#include <QApplication> | ||
#include <QMenuBar> | ||
|
||
#include <QMainWindow> | ||
|
||
#include "Display/CMainWindow.h" | ||
#include "Model/CConfigManager.h" | ||
#include "CEventFilterObj.h" | ||
|
||
bool CEventFilterObj::eventFilter(QObject *obj, QEvent *event) | ||
{ | ||
QPoint p; | ||
bool bAutoHideMenu; | ||
CConfigManager* confManager; | ||
QKeyEvent *keyEvent; | ||
QMouseEvent *mouseEvent; | ||
|
||
// only process for the key press and mouse press event | ||
switch (event->type()) { | ||
case QEvent::KeyPress: | ||
case QEvent::MouseButtonPress: | ||
break; | ||
default: | ||
return QObject::eventFilter(obj, event); | ||
} | ||
|
||
confManager = CConfigManager::getInstance(); | ||
|
||
bAutoHideMenu = confManager->getAppSettingValue("AutoHideMenu").toBool(); | ||
|
||
// only hide/show menubar if active window is the main window | ||
if ((bAutoHideMenu) && (strcmp(QApplication::activeWindow()->metaObject()->className(), "CMainWindow") == 0)) { | ||
CMainWindow *mainWindow = static_cast<CMainWindow *> (QApplication::activeWindow()); | ||
|
||
switch (event->type()) { | ||
case QEvent::KeyPress: | ||
keyEvent = static_cast<QKeyEvent *>(event); | ||
|
||
if (keyEvent->key() == Qt::Key_Alt) { | ||
if (mainWindow->menuBar()->isHidden()) { | ||
mainWindow->menuBar()->show(); | ||
} | ||
} else { | ||
if (!(mainWindow->menuBar()->isHidden())) { | ||
// only hide menu if menubar or menu not selected | ||
if ((strcmp(QApplication::focusWidget()->metaObject()->className(), "QMenu") == -1) && | ||
(strcmp(QApplication::focusWidget()->metaObject()->className(), "QMenuBar") == -1)) { | ||
mainWindow->menuBar()->hide(); | ||
} | ||
} | ||
} | ||
break; | ||
|
||
case QEvent::MouseButtonPress: | ||
mouseEvent = static_cast<QMouseEvent *>(event); | ||
|
||
p = mainWindow->menuBar()->mapFromGlobal(mouseEvent->globalPos()); | ||
|
||
// hide menuBar only when not hidden | ||
if (!(mainWindow->menuBar()->isHidden())) { | ||
// hide menuBar only when mouse not in menuBar area | ||
if (!(mainWindow->menuBar()->rect().contains(p))) { | ||
mainWindow->menuBar()->hide(); | ||
} | ||
} | ||
|
||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
||
return QObject::eventFilter(obj, event); | ||
} else { | ||
return QObject::eventFilter(obj, event); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CEVENTFILTEROBJ_H | ||
#define CEVENTFILTEROBJ_H | ||
|
||
#include <QApplication> | ||
|
||
class CEventFilterObj : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
protected: | ||
bool eventFilter(QObject *obj, QEvent *event); | ||
}; | ||
|
||
#endif // CEVENTFILTEROBJ_H |
Oops, something went wrong.