git-svn-id: svn://db.shs.com.ru/libs@367 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-03-22 10:41:05 +00:00
parent 60a3439550
commit 31f2be6981
4 changed files with 33 additions and 5 deletions

View File

@@ -379,6 +379,16 @@ void EMainWindow::openFile() {
} }
void EMainWindow::openFiles() {
if (!checkSave()) return;
QStringList ret = QFileDialog::getOpenFileNames(this, trUtf8("Select files to open"), file_name, loadFilter());
foreach (QString s, ret) {
if (load(s))
addToRecent(s);
}
}
bool EMainWindow::saveFile(bool ask) { bool EMainWindow::saveFile(bool ask) {
if (ask) { if (ask) {
int ret = QMessageBox::question(this, windowTitle(), trUtf8("Save changes%1?").arg(!file_name.isEmpty() ? (trUtf8(" in") + " \"" + file_name + "\"") : ""), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save); int ret = QMessageBox::question(this, windowTitle(), trUtf8("Save changes%1?").arg(!file_name.isEmpty() ? (trUtf8(" in") + " \"" + file_name + "\"") : ""), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);

View File

@@ -115,6 +115,7 @@ public slots:
void changed() {setChanged(true);} void changed() {setChanged(true);}
void newFile(); void newFile();
void openFile(); void openFile();
void openFiles();
bool saveFile(bool ask = false); bool saveFile(bool ask = false);
bool saveAsFile(); bool saveAsFile();
void clearRecent(); void clearRecent();

View File

@@ -19,6 +19,8 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
ui = new Ui::QCodeEdit(); ui = new Ui::QCodeEdit();
ui->setupUi(this); ui->setupUi(this);
ui->widgetSearch->hide(); ui->widgetSearch->hide();
ui->comboSearch->installEventFilter(this);
ui->comboReplace->installEventFilter(this);
prev_lc = auto_comp_pl = cur_search_ind = pos_press = pos_el_press = -1; prev_lc = auto_comp_pl = cur_search_ind = pos_press = pos_el_press = -1;
timer = 0; timer = 0;
_ignore_focus_out = _destructor = _replacing = false; _ignore_focus_out = _destructor = _replacing = false;
@@ -334,6 +336,20 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
//qDebug() << e; //qDebug() << e;
return QWidget::eventFilter(o, e); return QWidget::eventFilter(o, e);
} }
if (o == ui->comboSearch || o == ui->comboReplace) {
//qDebug() << o << e;
if (e->type() == QEvent::KeyPress) {
if (((QKeyEvent * )e)->key() == Qt::Key_Escape) {
hideHelp();
if (completer->isVisible())
completer->hide();
else
hideSearch();
}
}
//qDebug() << e;
return QWidget::eventFilter(o, e);
}
if (ui->textCode) { if (ui->textCode) {
if (o == ui->textCode->viewport()) { if (o == ui->textCode->viewport()) {
if (e->type() == QEvent::MouseButtonPress) { if (e->type() == QEvent::MouseButtonPress) {
@@ -343,7 +359,7 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
return QWidget::eventFilter(o, e); return QWidget::eventFilter(o, e);
} }
if (o == ui->textCode) { if (o == ui->textCode) {
//qDebug() << o << e; //qDebug() << e;
QMetaObject::invokeMethod(this, "syncScrolls", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "syncScrolls", Qt::QueuedConnection);
QKeyEvent * ke; QKeyEvent * ke;
QChar kc(0); QChar kc(0);

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>726</width> <width>726</width>
<height>697</height> <height>577</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@@ -178,7 +178,7 @@
<string>Previous</string> <string>Previous</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../../nicirt/src/nics_admin/icons.qrc"> <iconset resource="qad_widgets.qrc">
<normaloff>:/icons/go-previous.png</normaloff>:/icons/go-previous.png</iconset> <normaloff>:/icons/go-previous.png</normaloff>:/icons/go-previous.png</iconset>
</property> </property>
</widget> </widget>
@@ -195,7 +195,7 @@
<string>Next</string> <string>Next</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../../nicirt/src/nics_admin/icons.qrc"> <iconset resource="qad_widgets.qrc">
<normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset> <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset>
</property> </property>
</widget> </widget>
@@ -312,7 +312,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../../../nicirt/src/nics_admin/icons.qrc"/> <include location="qad_widgets.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>
@@ -385,5 +385,6 @@
<slot>searchNext()</slot> <slot>searchNext()</slot>
<slot>searchPrevious()</slot> <slot>searchPrevious()</slot>
<slot>searchAll()</slot> <slot>searchAll()</slot>
<slot>hideSearch()</slot>
</slots> </slots>
</ui> </ui>