- implement: when startup , open file provided by commmand line options
- implement: open files pasted by clipboard
This commit is contained in:
parent
0ae9b92924
commit
b28d2d4ab4
2
NEWS.md
2
NEWS.md
|
@ -14,6 +14,8 @@ Version 0.6.0
|
||||||
- enhancement: refactor in project (using search symbol occurence and replace in files)
|
- enhancement: refactor in project (using search symbol occurence and replace in files)
|
||||||
- fix: search in files
|
- fix: search in files
|
||||||
- implement: register file associations
|
- implement: register file associations
|
||||||
|
- implement: when startup , open file provided by commmand line options
|
||||||
|
- implement: open files pasted by clipboard
|
||||||
|
|
||||||
Version 0.5.0
|
Version 0.5.0
|
||||||
- enhancement: support C++ using type alias;
|
- enhancement: support C++ using type alias;
|
||||||
|
|
|
@ -98,11 +98,17 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
MainWindow mainWindow;
|
MainWindow mainWindow;
|
||||||
pMainWindow = &mainWindow;
|
pMainWindow = &mainWindow;
|
||||||
|
if (app.arguments().count()>1) {
|
||||||
|
QStringList filesToOpen = app.arguments();
|
||||||
|
filesToOpen.pop_front();
|
||||||
|
pMainWindow->openFiles(filesToOpen);
|
||||||
|
} else {
|
||||||
if (pSettings->editor().autoLoadLastFiles())
|
if (pSettings->editor().autoLoadLastFiles())
|
||||||
pMainWindow->loadLastOpens();
|
pMainWindow->loadLastOpens();
|
||||||
if (pMainWindow->editorList()->pageCount()==0) {
|
if (pMainWindow->editorList()->pageCount()==0) {
|
||||||
pMainWindow->newEditor();
|
pMainWindow->newEditor();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
int retCode = app.exec();
|
int retCode = app.exec();
|
||||||
// save settings
|
// save settings
|
||||||
|
|
|
@ -2857,10 +2857,26 @@ void MainWindow::on_actionCopy_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionPaste_triggered()
|
void MainWindow::on_actionPaste_triggered()
|
||||||
{
|
{
|
||||||
|
QClipboard* clipboard = QGuiApplication::clipboard();
|
||||||
|
const QMimeData* data = clipboard->mimeData();
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
if (data->hasUrls()) {
|
||||||
|
QStringList filesToOpen;
|
||||||
|
foreach (const QUrl& url, data->urls()) {
|
||||||
|
QString s = url.toLocalFile();
|
||||||
|
if (!s.isEmpty()) {
|
||||||
|
filesToOpen.append(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!filesToOpen.isEmpty())
|
||||||
|
openFiles(filesToOpen);
|
||||||
|
} else {
|
||||||
Editor * editor = mEditorList->getEditor();
|
Editor * editor = mEditorList->getEditor();
|
||||||
if (editor != NULL ) {
|
if (editor != NULL ) {
|
||||||
editor->pasteFromClipboard();
|
editor->pasteFromClipboard();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionIndent_triggered()
|
void MainWindow::on_actionIndent_triggered()
|
||||||
|
|
|
@ -91,6 +91,8 @@ public:
|
||||||
void saveLastOpens();
|
void saveLastOpens();
|
||||||
void loadLastOpens();
|
void loadLastOpens();
|
||||||
|
|
||||||
|
void openFiles(const QStringList& files);
|
||||||
|
|
||||||
void newEditor();
|
void newEditor();
|
||||||
|
|
||||||
QPlainTextEdit* txtLocals();
|
QPlainTextEdit* txtLocals();
|
||||||
|
@ -154,7 +156,6 @@ private:
|
||||||
void prepareProjectForCompile();
|
void prepareProjectForCompile();
|
||||||
void closeProject(bool refreshEditor);
|
void closeProject(bool refreshEditor);
|
||||||
void updateProjectView();
|
void updateProjectView();
|
||||||
void openFiles(const QStringList& files);
|
|
||||||
void openFile(const QString& filename);
|
void openFile(const QString& filename);
|
||||||
void openProject(const QString& filename);
|
void openProject(const QString& filename);
|
||||||
CompileTarget getCompileTarget();
|
CompileTarget getCompileTarget();
|
||||||
|
|
|
@ -191,7 +191,9 @@ QString Settings::Dirs::config(Settings::Dirs::DataType dataType) const
|
||||||
|
|
||||||
QString Settings::Dirs::executable() const
|
QString Settings::Dirs::executable() const
|
||||||
{
|
{
|
||||||
return QApplication::instance()->applicationFilePath();
|
QString s = QApplication::instance()->applicationFilePath();
|
||||||
|
s.replace("/",QDir::separator());
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::Dirs::doSave()
|
void Settings::Dirs::doSave()
|
||||||
|
|
|
@ -69,7 +69,7 @@ void FileAssociationModel::updateAssociationStates()
|
||||||
"."+item->suffix,
|
"."+item->suffix,
|
||||||
"DevCpp."+item->suffix,
|
"DevCpp."+item->suffix,
|
||||||
item->name,
|
item->name,
|
||||||
"open",
|
"Open",
|
||||||
pSettings->dirs().executable()+" \"%1\""
|
pSettings->dirs().executable()+" \"%1\""
|
||||||
);
|
);
|
||||||
item->defaultSelected = item->selected;
|
item->defaultSelected = item->selected;
|
||||||
|
@ -111,7 +111,7 @@ void FileAssociationModel::saveAssociations()
|
||||||
PFileAssociationItem item = fileTypeDescriptions[fileType];
|
PFileAssociationItem item = fileTypeDescriptions[fileType];
|
||||||
ok = registerFileType(fileType,
|
ok = registerFileType(fileType,
|
||||||
item->name,
|
item->name,
|
||||||
"open",
|
"Open",
|
||||||
pSettings->dirs().executable(),
|
pSettings->dirs().executable(),
|
||||||
item->icon);
|
item->icon);
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,7 +167,7 @@ bool FileAssociationModel::checkAssociation(const QString &extension, const QStr
|
||||||
if (result != ERROR_SUCCESS )
|
if (result != ERROR_SUCCESS )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString keyString = QString("%1\\shell\\%2\\command").arg(filetype).arg(verb);
|
QString keyString = QString("%1\\Shell\\%2\\Command").arg(filetype).arg(verb);
|
||||||
QString value1,value2;
|
QString value1,value2;
|
||||||
if (!readRegistry(HKEY_CLASSES_ROOT,keyString.toLocal8Bit(),value1))
|
if (!readRegistry(HKEY_CLASSES_ROOT,keyString.toLocal8Bit(),value1))
|
||||||
return false;
|
return false;
|
||||||
|
@ -254,7 +254,7 @@ bool FileAssociationModel::registerFileType(const QString &filetype, const QStri
|
||||||
keyString.toLocal8Bit(),
|
keyString.toLocal8Bit(),
|
||||||
value.toLocal8Bit()))
|
value.toLocal8Bit()))
|
||||||
return false;
|
return false;
|
||||||
keyString = QString("%1\\shell\\%2\\command").arg(filetype).arg(verb);
|
keyString = QString("%1\\Shell\\%2\\Command").arg(filetype).arg(verb);
|
||||||
value = serverApp+" \"%1\"";
|
value = serverApp+" \"%1\"";
|
||||||
if (!writeRegistry(HKEY_CLASSES_ROOT,
|
if (!writeRegistry(HKEY_CLASSES_ROOT,
|
||||||
keyString.toLocal8Bit(),
|
keyString.toLocal8Bit(),
|
||||||
|
|
Loading…
Reference in New Issue