Skip to content

Commit 68d68ea

Browse files
committed
fix compliation warnings
1 parent d140246 commit 68d68ea

7 files changed

Lines changed: 40 additions & 32 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ znotes.pro.user
44
translations/*.qm
55
build
66
Makefile
7+
.qmake.stash
78
znotes
89
TODO

main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ int main(int argc, char **argv)
88

99
settings.load();
1010
// if another copy is starts
11-
if(app.isRunning() && settings.getSingleInstance())
12-
return !app.sendMessage("proton is our god!");
11+
if(app.isRunning() && settings.getSingleInstance()) {
12+
return !app.sendMessage("Only one instance is allowed");
13+
}
14+
1315
app.setQuitOnLastWindowClosed(false);
1416

1517
MainWindow w;

mainwindow.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ MainWindow::~MainWindow()
168168
// saving notes
169169
notes->saveAll();
170170
// saving title of last note
171-
if(notes->current())
171+
if(notes->current()) {
172172
settings.setLastNote(notes->current()->fileName());
173+
}
173174
// saving dialog's params
174175
settings.setDialogGeometry(saveGeometry());
175176
settings.setDialogState(saveState());
@@ -369,8 +370,9 @@ void MainWindow::hideEvent(QHideEvent* event)
369370
settings.setDialogGeometry(saveGeometry());
370371
actShow->setEnabled(true);
371372
actHide->setDisabled(true);
372-
if(notes->current())
373+
if(notes->current()) {
373374
notes->saveAll();
375+
}
374376

375377
if(note_create_widget && note_create_widget->isVisible())
376378
{

notelist.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ void NoteList::registerType(Note::Type id,
170170

171171
void NoteList::scanForNewFiles()
172172
{
173-
if (settings.getShowHidden())
173+
if (settings.getShowHidden()) {
174174
dir.setFilter(QDir::Files | QDir::Hidden | QDir::Readable);
175-
else
175+
} else {
176176
dir.setFilter(QDir::Files | QDir::Readable);
177+
}
177178
dir.refresh();
178179
QFileInfoList flist = dir.entryInfoList();
179180
for (int i = 0; i < flist.size(); ++i)
@@ -246,8 +247,9 @@ Note* NoteList::add(const QFileInfo& fileinfo, bool set_current)
246247
vec.append(note);
247248
tabs->addTab(note->widget(), note->title());
248249
notes_filenames.insert(fileinfo.fileName());
249-
if (set_current)
250+
if (set_current) {
250251
tabs->setCurrentWidget(note->widget());
252+
}
251253
return note;
252254
}
253255

@@ -361,11 +363,12 @@ void NoteList::currentTabChanged(int index)
361363
{
362364
if (index==-1)
363365
return;
364-
if (current_index != -1)
366+
if (current_index != -1) {
365367
if(current()) {
366368
current()->save();
367369
tabs->currentWidget()->setFocus();
368370
}
371+
}
369372
int old_index = current_index;
370373
current_index = index;
371374
const QString path = vec[current_index]->absolutePath();

scriptmodel.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,19 @@ void ScriptModel::append(const QString& name, const QString& file, const QString
1515
setData(index(r, 2), icon);
1616
}
1717

18-
QVariant ScriptModel::headerData ( int section, Qt::Orientation orientation, int role) const
19-
{
20-
switch(role)
21-
{
22-
case Qt::DisplayRole:
23-
{
24-
switch(orientation)
25-
{
26-
case Qt::Horizontal:
27-
{
28-
switch(section)
29-
{
30-
case 0: return QObject::tr("Name");
31-
case 1: return QObject::tr("File");
32-
case 2: return QObject::tr("Icon");
33-
default: return QVariant();
18+
QVariant ScriptModel::headerData ( int section, Qt::Orientation orientation, int role) const {
19+
switch(role) {
20+
case Qt::DisplayRole: {
21+
switch(orientation) {
22+
case Qt::Horizontal: {
23+
switch(section) {
24+
case 0: return QObject::tr("Name");
25+
case 1: return QObject::tr("File");
26+
case 2: return QObject::tr("Icon");
27+
default: return QVariant();
3428
}
3529
}
36-
case Qt::Vertical: return QString::number(section);
30+
default: return QString::number(section);
3731
}
3832
}
3933
default: return QVariant();

settings.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void Settings::load()
9191
if(!mydocuments_path.isEmpty()) notes_path = mydocuments_path+"/Notes";
9292
else if(!QDir::homePath().isEmpty()) notes_path = QDir::homePath()+"/Notes";
9393
#else
94-
if(!QDir::homePath().isEmpty()) notes_path = QDir::homePath()+"\Notes";
94+
if(!QDir::homePath().isEmpty()) notes_path = QDir::homePath()+"\\Notes";
9595
#endif
9696
config.setValue("NotesPath", notes_path);
9797
}
@@ -514,15 +514,19 @@ void Settings::setToolbarItems(const QVector<int>& v)
514514
if (v == tb_items)
515515
return;
516516
// Remove old settings
517-
for (int i = 0; i < tb_items.size(); ++i)
518-
if(tb_items[i] != itemSeparator)
517+
for (int i = 0; i < tb_items.size(); ++i) {
518+
if(tb_items[i] != itemSeparator) {
519519
config.remove(ToolbarAction(item_enum(tb_items[i])).pref_name()); //dirty hack =(
520520
tb_items = v;
521+
}
522+
}
521523
// Save settings
522524
config.setValue("Toolbar/itemCount", tb_items.size());
523-
for (int i = 0; i < tb_items.size(); ++i)
524-
if(tb_items[i] != itemSeparator)
525+
for (int i = 0; i < tb_items.size(); ++i) {
526+
if(tb_items[i] != itemSeparator) {
525527
config.setValue(ToolbarAction(item_enum(tb_items[i])).pref_name(), i);
528+
}
529+
}
526530

527531
emit ToolbarItemsChanged();
528532
}

textnote.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ void TextNote::load()
4040
// Saving note
4141
void TextNote::save(bool forced)
4242
{
43-
if (!(content_changed || forced))
43+
if (!(content_changed || forced)) {
4444
return; //If file doesn't need in saving, exiting from function
45+
}
4546
file.close();
46-
if(!file.open(QFile::WriteOnly | QFile::Text))
47+
if(!file.open(QFile::WriteOnly | QFile::Text)) {
4748
return;
49+
}
4850
QTextStream out(&file);
4951
out << text_edit->toPlainText();
5052
file.close();

0 commit comments

Comments
 (0)