@@ -34,7 +34,6 @@ MainWindow::MainWindow(QWidget *parent) :
34
34
gbIsReloadFile = false ;
35
35
gbSaveCancelled = false ;
36
36
gbShowEraseAndSaveMessageBox = true ;
37
- gfMaxFileSize = 1000.00 ;
38
37
giCurrentFileIndex = 0 ;
39
38
giCurrentTabIndex = 0 ;
40
39
giDefaultDirCounter = 0 ;
@@ -54,18 +53,16 @@ MainWindow::MainWindow(QWidget *parent) :
54
53
workerThread = new QThread;
55
54
setAcceptDrops (true );
56
55
loadConfig ();
57
- QShortcut *menuBar_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+M" )),this );
58
56
57
+ QShortcut *menuBar_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+M" )),this );
59
58
QShortcut *gr1_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+1" )),this );
60
59
QShortcut *gr2_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+2" )),this );
61
60
QShortcut *gr3_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+3" )),this );
62
61
QShortcut *gr4_shortcut = new QShortcut (QKeySequence (tr (" Ctrl+4" )),this );
63
-
64
62
QShortcut *paste_gr1_shortcut = new QShortcut (QKeySequence (tr (" F1" )),this );
65
63
QShortcut *paste_gr2_shortcut = new QShortcut (QKeySequence (tr (" F2" )),this );
66
64
QShortcut *paste_gr3_shortcut = new QShortcut (QKeySequence (tr (" F3" )),this );
67
65
QShortcut *paste_gr4_shortcut = new QShortcut (QKeySequence (tr (" F4" )),this );
68
-
69
66
QShortcut *openFileLocation_shortCut = new QShortcut (QKeySequence (tr (" F9" )),this );
70
67
71
68
connect (ui->tabWidget ,SIGNAL (currentChanged (int )),this ,SLOT (main_slot_tabChanged (int )));
@@ -86,7 +83,6 @@ MainWindow::MainWindow(QWidget *parent) :
86
83
connect (gr2_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_gr2 ()));
87
84
connect (gr3_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_gr3 ()));
88
85
connect (gr4_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_gr4 ()));
89
-
90
86
connect (paste_gr1_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_pasteGr1 ()));
91
87
connect (paste_gr2_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_pasteGr2 ()));
92
88
connect (paste_gr3_shortcut,SIGNAL (activated ()),this ,SLOT (main_slot_pasteGr3 ()));
@@ -229,7 +225,6 @@ bool MainWindow::saveConfig()
229
225
configText = configText + " [ALERTS]" + " \n " ;
230
226
configText = configText + " showEraseAlert=" + QString (" %1" ).arg (this ->gbShowEraseAndSaveMessageBox ) + " \n " ;
231
227
configText = configText + " [FILESIZE]" + " \n " ;
232
- configText = configText + " maxFileSize=" + QString (" %1" ).arg (gfMaxFileSize) + " \n " ;
233
228
configText = configText + " [RELOAD]" + " \n " ;
234
229
configText = configText + " delay=" + QString (" %1" ).arg (giTimerDelay) + " \n " ;
235
230
configText = configText + " [RECENTS]" + " \n " ;
@@ -278,7 +273,6 @@ bool MainWindow::loadConfig()
278
273
else if (line.startsWith (" x" ) && liIsMaximized == 0 ) this ->move (line.split (" =" ).at (1 ).toInt (),this ->geometry ().y ());
279
274
else if (line.startsWith (" y" ) && liIsMaximized == 0 ) this ->move (this ->geometry ().x (),line.split (" =" ).at (1 ).toInt ());
280
275
else if (line.startsWith (" showEraseAlert" )) gbShowEraseAndSaveMessageBox = line.split (" =" ).at (1 ).toInt ();
281
- else if (line.startsWith (" maxFileSize" )) gfMaxFileSize = line.split (" =" ).at (1 ).toFloat ();
282
276
else if (line.startsWith (" delay" )) giTimerDelay = line.split (" =" ).at (1 ).toInt ();
283
277
else if (line.startsWith (" recentFiles" )) {
284
278
QStringList lobRecentList= line.split (" @@" );
@@ -312,7 +306,7 @@ bool MainWindow::loadConfig()
312
306
313
307
void MainWindow::on_actionAbout_QNote_triggered ()
314
308
{
315
- QMessageBox::about (this ," QNote 1.7.4 " ,
309
+ QMessageBox::about (this ," QNote 1.7.5 " ,
316
310
" <style>"
317
311
" a:link {"
318
312
" color: orange;"
@@ -356,11 +350,10 @@ void MainWindow::on_actionNew_Tab_triggered()
356
350
connect (this ,SIGNAL (main_signal_refreshHighlight ()),lobPlainTexEdit,SLOT (highlightCurrentLine ()));
357
351
connect (gobSearchDialog,SIGNAL (search_signal_disableHighLight ()),lobPlainTexEdit,SLOT (cte_slot_disableHighLight ()));
358
352
connect (gobSearchDialog,SIGNAL (search_signal_enableHighLight ()),lobPlainTexEdit,SLOT (cte_slot_enableHighLight ()));
359
- QFont serifFont (gsSavedFont, giSavedFontPointSize, giSavedFontStyle);
360
- lobPlainTexEdit->setFont (serifFont );
353
+ QFont lobFont (gsSavedFont, giSavedFontPointSize, giSavedFontStyle);
354
+ lobPlainTexEdit->setFont (lobFont );
361
355
giCurrentTabIndex = this ->ui ->tabWidget ->addTab (lobPlainTexEdit," New " + QString::number (giTotalTabs));
362
356
this ->ui ->tabWidget ->setCurrentIndex (giCurrentTabIndex);
363
- gobFilePathsHash.insert (giCurrentTabIndex," " );
364
357
gobIsModifiedTextHash.insert (giCurrentTabIndex,false );
365
358
}
366
359
@@ -921,7 +914,8 @@ void MainWindow::checkIfUnsaved(int index)
921
914
}
922
915
break ;
923
916
case QMessageBox::Discard:
924
- closeTab (index);
917
+ if (!gbIsReloadFile && !gbIsAutoreloadEnabled) closeTab (index);
918
+ else ui->indicatorLabel ->clear ();
925
919
break ;
926
920
case QMessageBox::Cancel:
927
921
gbSaveCancelled = true ;
@@ -981,8 +975,6 @@ void MainWindow::closeTab(int index)
981
975
982
976
void MainWindow::loadFile (QString asFileName)
983
977
{
984
- // qDebug() << "Begin loadFile, asFileName: " << asFileName;
985
-
986
978
QFile *lobFile = new QFile (asFileName);
987
979
988
980
if (!asFileName.isEmpty () && lobFile->exists ()){
@@ -991,7 +983,7 @@ void MainWindow::loadFile(QString asFileName)
991
983
992
984
emit main_signal_setCurrentFileSize (lobFile->size ());
993
985
994
- if (gobFilePathsHash.value (giCurrentTabIndex) != NULL && gobFilePathsHash.value (giCurrentTabIndex) != " " ){
986
+ if (( gobFilePathsHash.value (giCurrentTabIndex) != NULL && gobFilePathsHash.value (giCurrentTabIndex) != " " ) || gobIsModifiedTextHash. value (giCurrentTabIndex) == true ){
995
987
on_actionNew_Tab_triggered ();
996
988
}
997
989
@@ -1005,7 +997,7 @@ void MainWindow::loadFile(QString asFileName)
1005
997
}
1006
998
1007
999
gobCurrentPlainTextEdit = qobject_cast<CustomTextEdit*>(ui->tabWidget ->widget (giCurrentTabIndex));
1008
- giCurrentFileIndex ++; // Aumenta el cursor para leer el siguiente archivo en el mapa global de archivos
1000
+ giCurrentFileIndex ++;
1009
1001
emit main_signal_loadFile (lobFile);
1010
1002
1011
1003
addRecentFiles ();
@@ -1014,7 +1006,6 @@ void MainWindow::loadFile(QString asFileName)
1014
1006
QMessageBox::warning (this ," Error!" ," The file " + asFileName + " can't be opened." );
1015
1007
gobFileNames.removeAt (giCurrentFileIndex);
1016
1008
}
1017
- // qDebug() << "End loadFile";
1018
1009
}
1019
1010
1020
1011
void MainWindow::setFileNameFromCommandLine (QStringList asFileNames)
@@ -1062,11 +1053,9 @@ void MainWindow::dropEvent(QDropEvent *event)
1062
1053
const QMimeData* mimeData = event->mimeData ();
1063
1054
1064
1055
if (mimeData->hasUrls ()){
1065
-
1066
1056
QList<QUrl> urlList = mimeData->urls ();
1067
1057
1068
- for (int i = 0 ; i < urlList.size (); i++)
1069
- {
1058
+ for (int i = 0 ; i < urlList.size (); i++) {
1070
1059
gobCurrentPlainTextEdit->appendPlainText (urlList.at (i).toLocalFile ());
1071
1060
}
1072
1061
0 commit comments