Skip to content

Commit

Permalink
- ported to Qt6
Browse files Browse the repository at this point in the history
- editor in lower panel
- various crash fixes
- use app data instead of app directory in windows
  • Loading branch information
ychclone committed Mar 2, 2023
1 parent f9b2fea commit e7af239
Show file tree
Hide file tree
Showing 47 changed files with 1,385 additions and 2,321 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

find_package(Qt5 COMPONENTS Widgets Xml Network REQUIRED)
find_package(Qt6 COMPONENTS Widgets Xml Network REQUIRED)

set(CMAKE_AUTOUIC_SEARCH_PATHS Resources/Forms)

include_directories(. Utils)

link_directories (/usr/src/QScintilla_src-2.13.0/src)

add_executable(blink
Resources/Forms/mainWindow.ui
Resources/Forms/editor.ui
Expand Down Expand Up @@ -71,6 +73,6 @@ add_executable(blink

)

target_link_libraries(blink Qt5::Widgets Qt5::Xml Qt5::Network qscintilla2_qt5)
target_link_libraries(blink Qt6::Widgets Qt6::Xml Qt6::Network qscintilla2_qt6)


20 changes: 0 additions & 20 deletions Display/CConfigDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void CConfigDlg::loadSetting()
confManager = CConfigManager::getInstance();

defaultEditor_lineEdit->setText(confManager->getAppSettingValue("DefaultEditor").toString());
tagDir_lineEdit->setText(confManager->getAppSettingValue("TagDir").toString());
tmpDir_lineEdit->setText(confManager->getAppSettingValue("TmpDir").toString());

timeoutRunExtProgram_lineEdit->setText(confManager->getAppSettingValue("TimeoutRunExtProgram").toString());
Expand Down Expand Up @@ -119,7 +118,6 @@ void CConfigDlg::saveSetting()
confManager = CConfigManager::getInstance();

confManager->setAppSettingValue("DefaultEditor", defaultEditor_lineEdit->text());
confManager->setAppSettingValue("TagDir", tagDir_lineEdit->text());
confManager->setAppSettingValue("TmpDir", tmpDir_lineEdit->text());

confManager->setAppSettingValue("TimeoutRunExtProgram", timeoutRunExtProgram_lineEdit->text());
Expand All @@ -145,7 +143,6 @@ void CConfigDlg::createActions()

// 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(tmpDir_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged()));
QObject::connect(timeoutRunExtProgram_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged()));
QObject::connect(projectFont_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(configContentChanged()));
Expand Down Expand Up @@ -280,23 +277,6 @@ void CConfigDlg::on_editorFont_toolBn_clicked()
}
}

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;
Expand Down
1 change: 0 additions & 1 deletion Display/CConfigDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ private slots:

void on_editorFont_toolBn_clicked();

void on_tagDir_toolBn_clicked();
void on_tmpDir_toolBn_clicked();

void configContentChanged();
Expand Down
2 changes: 1 addition & 1 deletion Display/CEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void CEditor::setEditorFont(QsciLexer* lexer)
QString editorFontSettingStr = CConfigManager::getInstance()->getAppSettingValue("EditorFont").toString();
editorFont.fromString(editorFontSettingStr);

qDebug() << "editorFontSettingStr = " << editorFontSettingStr << endl;
qDebug() << "editorFontSettingStr = " << editorFontSettingStr << Qt::endl;

if (editorFontSettingStr == "") {
lexer->setFont(QApplication::font()); // using system default font
Expand Down
1 change: 1 addition & 0 deletions Display/CEditorFindDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CEditorFindDlg::CEditorFindDlg(QWidget* parent)

void CEditorFindDlg::createActions()
{
connect(find_lineEdit, &QLineEdit::textChanged, this, &CEditorFindDlg::on_findButton_clicked);
}

void CEditorFindDlg::on_findButton_clicked()
Expand Down
42 changes: 24 additions & 18 deletions Display/CFileListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
CFileListWidget::CFileListWidget(QWidget *parent)
: QTreeView(parent)
{
QFont currentFont = static_cast <QWidget*> (this)->font();
fileFontSize_ = currentFont.pointSize();
QFont currentFont = static_cast <QWidget*> (this)->font();
fileFontSize_ = currentFont.pointSize();
}

void CFileListWidget::setFileListModel(CFileListModel *fileListModel)
{
fileListModel_ = fileListModel;
}
}

void CFileListWidget::mousePressEvent(QMouseEvent *event)
{
Expand All @@ -27,29 +27,31 @@ void CFileListWidget::mousePressEvent(QMouseEvent *event)
QTreeView::mousePressEvent(event);
}

void CFileListWidget::mouseDoubleClickEvent(QMouseEvent* event)
void CFileListWidget::mouseReleaseEvent(QMouseEvent* event)
{
emit fileItemTriggered();
QTreeView::mouseDoubleClickEvent(event);
if (event->button() == Qt::LeftButton) {
emit fileItemTriggered();
}
QTreeView::mouseReleaseEvent(event);
}

void CFileListWidget::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Return) {
emit fileItemTriggered();
} else if ((event->key() == Qt::Key_Equal) && (event->modifiers() == Qt::ControlModifier)) {
emit fileItemTriggered();
} else if ((event->key() == Qt::Key_Equal) && (event->modifiers() == Qt::ControlModifier)) {
fileZoomIn();
} else if ((event->key() == Qt::Key_Minus) && (event->modifiers() == Qt::ControlModifier)) {
} else if ((event->key() == Qt::Key_Minus) && (event->modifiers() == Qt::ControlModifier)) {
fileZoomOut();
}
}
QTreeView::keyPressEvent(event);
}

void CFileListWidget::updateOutputFont(const QFont& outputFont)
void CFileListWidget::updateOutputFont(const QFont& outputFont)
{
QFont currentFont = static_cast <QWidget*> (this)->font();

if (currentFont != outputFont) {
if (currentFont != outputFont) {
static_cast <QWidget*> (this)->setFont(outputFont);

fileFontSize_ = outputFont.pointSize();
Expand All @@ -64,7 +66,7 @@ QStringList CFileListWidget::getSelectedItemNameList()
QModelIndex indexSelected, mappedIndex;
int rowSelected;
QStandardItem* itemSelected;

QString fileItemName;
QStringList fileItemNameList;

Expand Down Expand Up @@ -123,7 +125,7 @@ void CFileListWidget::mouseMoveEvent(QMouseEvent *event)
QUrl url = QUrl::fromLocalFile(filePath);
urlList.append(url);
}

mimeData->setUrls(urlList);
drag->setMimeData(mimeData);

Expand All @@ -143,7 +145,7 @@ void CFileListWidget::fileZoomIn()
{
fileFontSize_++;
QFont fnt = static_cast <QWidget*> (this)->font();
fnt.setPointSize(fileFontSize_);
fnt.setPointSize(fileFontSize_);
static_cast <QWidget*> (this)->setFont(fnt);

updateFileListWidget();
Expand All @@ -154,16 +156,18 @@ void CFileListWidget::fileZoomOut()
if (fileFontSize_ > 1) {
fileFontSize_--;
QFont fnt = static_cast <QWidget*> (this)->font();
fnt.setPointSize(fileFontSize_);
fnt.setPointSize(fileFontSize_);
static_cast <QWidget*> (this)->setFont(fnt);
}

updateFileListWidget();
updateFileListWidget();
}


void CFileListWidget::wheelEvent(QWheelEvent *e)
{
/* YCH modified (begin), commented temporary */
/*
if (e->modifiers() == Qt::ControlModifier) {
e->accept();
if (e->delta() > 0) {
Expand All @@ -172,7 +176,9 @@ void CFileListWidget::wheelEvent(QWheelEvent *e)
fileZoomOut();
}
}
QTreeView::wheelEvent(e);
*/
/* YCH modified (end), commented temporary */
QTreeView::wheelEvent(e);
}


8 changes: 4 additions & 4 deletions Display/CFileListWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CFILE_LIST_WIDGET_H

#include <QTreeView>
#include <QMouseEvent>
#include <QMouseEvent>
#include <QStringList>

#include <QShortcut>
Expand All @@ -20,10 +20,10 @@ class CFileListWidget : public QTreeView

void mousePressEvent(QMouseEvent *event);

void mouseDoubleClickEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void keyPressEvent(QKeyEvent* event);

void updateOutputFont(const QFont& outputFont);
void updateOutputFont(const QFont& outputFont);

void mouseMoveEvent(QMouseEvent *event);

Expand All @@ -44,7 +44,7 @@ class CFileListWidget : public QTreeView
CFileListModel* fileListModel_;

long fileFontSize_;

};

#endif // CFILE_LIST_WIDGET_H
Loading

0 comments on commit e7af239

Please sign in to comment.