- 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
|
||||
|
||||
- enhancement: prohibit move selection up/down under column mode
|
||||
|
|
|
@ -147,13 +147,14 @@ public:
|
|||
const QByteArray& encodingOption() const noexcept;
|
||||
void setEncodingOption(const QByteArray& encoding) noexcept;
|
||||
const QByteArray& fileEncoding() const noexcept;
|
||||
void convertToEncoding(const QByteArray& encoding);
|
||||
const QString& filename() const noexcept;
|
||||
|
||||
bool inProject() const noexcept;
|
||||
bool isNew() const noexcept;
|
||||
|
||||
void loadFile(QString filename = "");
|
||||
void saveFile(QString filename);
|
||||
void convertToEncoding(const QByteArray& encoding);
|
||||
bool save(bool force=false, bool reparse=true);
|
||||
bool saveAs(const QString& name="", bool fromProject = false);
|
||||
void activate();
|
||||
|
@ -164,9 +165,11 @@ public:
|
|||
void updateCaption(const QString& newCaption=QString());
|
||||
void applySettings();
|
||||
void applyColorScheme(const QString& schemeName);
|
||||
|
||||
void copyToClipboard() override;
|
||||
void cutToClipboard() override;
|
||||
void copyAsHTML();
|
||||
|
||||
void setCaretPosition(int line,int aChar);
|
||||
void setCaretPositionAndActivate(int line,int aChar);
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@
|
|||
#include "widgets/searchdialog.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -304,7 +306,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
||||
|
||||
mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters());
|
||||
mFileSystemModel.setNameFilterDisables(false);
|
||||
mFileSystemModel.setNameFilterDisables(true);
|
||||
//setFilesViewRoot(pSettings->environment().currentFolder());
|
||||
for (int i=1;i<mFileSystemModel.columnCount();i++) {
|
||||
ui->treeFiles->hideColumn(i);
|
||||
|
@ -6903,9 +6905,22 @@ void MainWindow::on_treeFiles_doubleClicked(const QModelIndex &index)
|
|||
QString filepath = mFileSystemModel.filePath(index);
|
||||
QFileInfo file(filepath);
|
||||
if (file.isFile()) {
|
||||
if (getFileType(filepath)==FileType::Project) {
|
||||
switch (getFileType(filepath)) {
|
||||
case FileType::Project:
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -7772,6 +7787,11 @@ void MainWindow::on_actionGit_Push_triggered()
|
|||
void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1 */)
|
||||
{
|
||||
mFileSystemModel.setNameFilterDisables(!ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
||||
if (!mFileSystemModel.nameFilterDisables()) {
|
||||
mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters());
|
||||
} else {
|
||||
mFileSystemModel.setNameFilters(QStringList());
|
||||
}
|
||||
if (pSettings->environment().hideNonSupportFilesInFileView()
|
||||
!= ui->actionFilesView_Hide_Non_Support_Files->isChecked()) {
|
||||
pSettings->environment().setHideNonSupportFilesInFileView(ui->actionFilesView_Hide_Non_Support_Files->isChecked());
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <QTextCodec>
|
||||
#include <QMessageBox>
|
||||
#include <QDirIterator>
|
||||
#include <QMimeDatabase>
|
||||
#include <QDesktopServices>
|
||||
#include "customfileiconprovider.h"
|
||||
#include <QMimeData>
|
||||
#include "settings.h"
|
||||
|
@ -315,6 +317,15 @@ Editor *Project::openUnit(int index)
|
|||
PProjectUnit unit = mUnits[index];
|
||||
|
||||
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());
|
||||
if (editor) {//already opened in the editors
|
||||
editor->setInProject(true);
|
||||
|
|
|
@ -263,6 +263,18 @@ FileType getFileType(const QString &filename)
|
|||
if (filename.endsWith(".rc",PATH_SENSITIVITY)) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ enum class FileType{
|
|||
CppHeader, // c++ header (.hpp)
|
||||
WindowsResourceSource, // resource source (.res)
|
||||
Project, //Red Panda C++ Project (.dev)
|
||||
Text, // text file
|
||||
Other // any others
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue