- change: uncheck "hide unsupported files" in files view shouldn't gray out non-c files
- enhancement: double clicking a non-text file in the files view, will open it with external program - enhancement: double clicking a non-text file in the project's view, will open it with external program
This commit is contained in:
parent
5e2b5e8091
commit
cb2cbf49d0
6
NEWS.md
6
NEWS.md
|
@ -1,3 +1,9 @@
|
||||||
|
Red Panda C++ Version 1.1.5
|
||||||
|
|
||||||
|
- change: uncheck "hide unsupported files" in files view shouldn't gray out non-c files
|
||||||
|
- enhancement: double clicking a non-text file in the files view, will open it with external program
|
||||||
|
- enhancement: double clicking a non-text file in the project's view, will open it with external program
|
||||||
|
|
||||||
Red Panda C++ Version 1.1.4
|
Red Panda C++ Version 1.1.4
|
||||||
|
|
||||||
- enhancement: prohibit move selection up/down under column mode
|
- enhancement: prohibit move selection up/down under column mode
|
||||||
|
|
|
@ -147,13 +147,14 @@ public:
|
||||||
const QByteArray& encodingOption() const noexcept;
|
const QByteArray& encodingOption() const noexcept;
|
||||||
void setEncodingOption(const QByteArray& encoding) noexcept;
|
void setEncodingOption(const QByteArray& encoding) noexcept;
|
||||||
const QByteArray& fileEncoding() const noexcept;
|
const QByteArray& fileEncoding() const noexcept;
|
||||||
|
void convertToEncoding(const QByteArray& encoding);
|
||||||
const QString& filename() const noexcept;
|
const QString& filename() const noexcept;
|
||||||
|
|
||||||
bool inProject() const noexcept;
|
bool inProject() const noexcept;
|
||||||
bool isNew() const noexcept;
|
bool isNew() const noexcept;
|
||||||
|
|
||||||
void loadFile(QString filename = "");
|
void loadFile(QString filename = "");
|
||||||
void saveFile(QString filename);
|
void saveFile(QString filename);
|
||||||
void convertToEncoding(const QByteArray& encoding);
|
|
||||||
bool save(bool force=false, bool reparse=true);
|
bool save(bool force=false, bool reparse=true);
|
||||||
bool saveAs(const QString& name="", bool fromProject = false);
|
bool saveAs(const QString& name="", bool fromProject = false);
|
||||||
void activate();
|
void activate();
|
||||||
|
@ -164,9 +165,11 @@ public:
|
||||||
void updateCaption(const QString& newCaption=QString());
|
void updateCaption(const QString& newCaption=QString());
|
||||||
void applySettings();
|
void applySettings();
|
||||||
void applyColorScheme(const QString& schemeName);
|
void applyColorScheme(const QString& schemeName);
|
||||||
|
|
||||||
void copyToClipboard() override;
|
void copyToClipboard() override;
|
||||||
void cutToClipboard() override;
|
void cutToClipboard() override;
|
||||||
void copyAsHTML();
|
void copyAsHTML();
|
||||||
|
|
||||||
void setCaretPosition(int line,int aChar);
|
void setCaretPosition(int line,int aChar);
|
||||||
void setCaretPositionAndActivate(int line,int aChar);
|
void setCaretPositionAndActivate(int line,int aChar);
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@
|
||||||
#include "widgets/searchdialog.h"
|
#include "widgets/searchdialog.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#include <QMimeDatabase>
|
||||||
|
#include <QMimeType>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -304,7 +306,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
||||||
|
|
||||||
mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters());
|
mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters());
|
||||||
mFileSystemModel.setNameFilterDisables(false);
|
mFileSystemModel.setNameFilterDisables(true);
|
||||||
//setFilesViewRoot(pSettings->environment().currentFolder());
|
//setFilesViewRoot(pSettings->environment().currentFolder());
|
||||||
for (int i=1;i<mFileSystemModel.columnCount();i++) {
|
for (int i=1;i<mFileSystemModel.columnCount();i++) {
|
||||||
ui->treeFiles->hideColumn(i);
|
ui->treeFiles->hideColumn(i);
|
||||||
|
@ -6903,9 +6905,22 @@ void MainWindow::on_treeFiles_doubleClicked(const QModelIndex &index)
|
||||||
QString filepath = mFileSystemModel.filePath(index);
|
QString filepath = mFileSystemModel.filePath(index);
|
||||||
QFileInfo file(filepath);
|
QFileInfo file(filepath);
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
if (getFileType(filepath)==FileType::Project) {
|
switch (getFileType(filepath)) {
|
||||||
|
case FileType::Project:
|
||||||
openProject(filepath);
|
openProject(filepath);
|
||||||
} else {
|
break;
|
||||||
|
case FileType::Other:
|
||||||
|
{
|
||||||
|
QMimeDatabase db;
|
||||||
|
QMimeType mimeType=db.mimeTypeForFile(file);
|
||||||
|
if (mimeType.isValid() && mimeType.name().startsWith("text/")) {
|
||||||
|
openFile(filepath);
|
||||||
|
} else {
|
||||||
|
QDesktopServices::openUrl(QUrl::fromLocalFile(file.absoluteFilePath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
openFile(filepath);
|
openFile(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7772,6 +7787,11 @@ void MainWindow::on_actionGit_Push_triggered()
|
||||||
void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1 */)
|
void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1 */)
|
||||||
{
|
{
|
||||||
mFileSystemModel.setNameFilterDisables(!ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
mFileSystemModel.setNameFilterDisables(!ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
||||||
|
if (!mFileSystemModel.nameFilterDisables()) {
|
||||||
|
mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters());
|
||||||
|
} else {
|
||||||
|
mFileSystemModel.setNameFilters(QStringList());
|
||||||
|
}
|
||||||
if (pSettings->environment().hideNonSupportFilesInFileView()
|
if (pSettings->environment().hideNonSupportFilesInFileView()
|
||||||
!= ui->actionFilesView_Hide_Non_Support_Files->isChecked()) {
|
!= ui->actionFilesView_Hide_Non_Support_Files->isChecked()) {
|
||||||
pSettings->environment().setHideNonSupportFilesInFileView(ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
pSettings->environment().setHideNonSupportFilesInFileView(ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
#include <QMimeDatabase>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include "customfileiconprovider.h"
|
#include "customfileiconprovider.h"
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -315,6 +317,15 @@ Editor *Project::openUnit(int index)
|
||||||
PProjectUnit unit = mUnits[index];
|
PProjectUnit unit = mUnits[index];
|
||||||
|
|
||||||
if (!unit->fileName().isEmpty() && fileExists(unit->fileName())) {
|
if (!unit->fileName().isEmpty() && fileExists(unit->fileName())) {
|
||||||
|
if (getFileType(unit->fileName())==FileType::Other) {
|
||||||
|
QMimeDatabase db;
|
||||||
|
QMimeType mimeType=db.mimeTypeForFile(unit->fileName());
|
||||||
|
if (!mimeType.isValid() || !mimeType.name().startsWith("text/")) {
|
||||||
|
QDesktopServices::openUrl(QUrl::fromLocalFile(unit->fileName()));
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
Editor * editor = mEditorList->getOpenedEditorByFilename(unit->fileName());
|
Editor * editor = mEditorList->getOpenedEditorByFilename(unit->fileName());
|
||||||
if (editor) {//already opened in the editors
|
if (editor) {//already opened in the editors
|
||||||
editor->setInProject(true);
|
editor->setInProject(true);
|
||||||
|
|
|
@ -263,6 +263,18 @@ FileType getFileType(const QString &filename)
|
||||||
if (filename.endsWith(".rc",PATH_SENSITIVITY)) {
|
if (filename.endsWith(".rc",PATH_SENSITIVITY)) {
|
||||||
return FileType::WindowsResourceSource;
|
return FileType::WindowsResourceSource;
|
||||||
}
|
}
|
||||||
|
if (filename.endsWith(".in",PATH_SENSITIVITY)) {
|
||||||
|
return FileType::Text;
|
||||||
|
}
|
||||||
|
if (filename.endsWith(".out",PATH_SENSITIVITY)) {
|
||||||
|
return FileType::Text;
|
||||||
|
}
|
||||||
|
if (filename.endsWith(".txt",PATH_SENSITIVITY)) {
|
||||||
|
return FileType::Text;
|
||||||
|
}
|
||||||
|
if (filename.endsWith(".dat",PATH_SENSITIVITY)) {
|
||||||
|
return FileType::Text;
|
||||||
|
}
|
||||||
return FileType::Other;
|
return FileType::Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ enum class FileType{
|
||||||
CppHeader, // c++ header (.hpp)
|
CppHeader, // c++ header (.hpp)
|
||||||
WindowsResourceSource, // resource source (.res)
|
WindowsResourceSource, // resource source (.res)
|
||||||
Project, //Red Panda C++ Project (.dev)
|
Project, //Red Panda C++ Project (.dev)
|
||||||
|
Text, // text file
|
||||||
Other // any others
|
Other // any others
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue