mirror of
https://github.com/YACReader/yacreader
synced 2025-07-17 20:44:32 -04:00
Format code using clang-format
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#include "yacreader_history_controller.h"
|
||||
|
||||
YACReaderHistoryController::YACReaderHistoryController(QObject *parent) :
|
||||
QObject(parent)
|
||||
YACReaderHistoryController::YACReaderHistoryController(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ void YACReaderHistoryController::clear()
|
||||
{
|
||||
currentFolderNavigation = 0;
|
||||
history.clear();
|
||||
history.append(YACReaderLibrarySourceContainer(QModelIndex(),YACReaderLibrarySourceContainer::Folder)); //root folder is always the first item
|
||||
history.append(YACReaderLibrarySourceContainer(QModelIndex(), YACReaderLibrarySourceContainer::Folder)); //root folder is always the first item
|
||||
|
||||
emit(enabledBackward(false));
|
||||
emit(enabledForward(false));
|
||||
@ -17,45 +17,41 @@ void YACReaderHistoryController::clear()
|
||||
|
||||
void YACReaderHistoryController::backward()
|
||||
{
|
||||
if(currentFolderNavigation>0)
|
||||
{
|
||||
if (currentFolderNavigation > 0) {
|
||||
currentFolderNavigation--;
|
||||
emit(modelIndexSelected(history.at(currentFolderNavigation)));
|
||||
emit(enabledForward(true));
|
||||
}
|
||||
|
||||
if(currentFolderNavigation==0)
|
||||
if (currentFolderNavigation == 0)
|
||||
emit(enabledBackward(false));
|
||||
}
|
||||
|
||||
void YACReaderHistoryController::forward()
|
||||
{
|
||||
if(currentFolderNavigation<history.count()-1)
|
||||
{
|
||||
if (currentFolderNavigation < history.count() - 1) {
|
||||
currentFolderNavigation++;
|
||||
emit(modelIndexSelected(history.at(currentFolderNavigation)));
|
||||
emit(enabledBackward(true));
|
||||
}
|
||||
|
||||
if(currentFolderNavigation==history.count()-1)
|
||||
if (currentFolderNavigation == history.count() - 1)
|
||||
emit(enabledForward(false));
|
||||
}
|
||||
|
||||
void YACReaderHistoryController::updateHistory(const YACReaderLibrarySourceContainer &source)
|
||||
{
|
||||
//remove history from current index
|
||||
if(!source.sourceModelIndex.isValid() && history.count() == 1)
|
||||
if (!source.sourceModelIndex.isValid() && history.count() == 1)
|
||||
return;
|
||||
|
||||
int numElementsToRemove = history.count() - (currentFolderNavigation+1);
|
||||
while(numElementsToRemove>0)
|
||||
{
|
||||
int numElementsToRemove = history.count() - (currentFolderNavigation + 1);
|
||||
while (numElementsToRemove > 0) {
|
||||
numElementsToRemove--;
|
||||
history.removeLast();
|
||||
}
|
||||
|
||||
if(source!=history.at(currentFolderNavigation))
|
||||
{
|
||||
if (source != history.at(currentFolderNavigation)) {
|
||||
history.append(source);
|
||||
|
||||
emit(enabledBackward(true));
|
||||
@ -78,14 +74,14 @@ YACReaderLibrarySourceContainer YACReaderHistoryController::currentSourceContain
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
YACReaderLibrarySourceContainer::YACReaderLibrarySourceContainer()
|
||||
:sourceModelIndex(QModelIndex()),type(None)
|
||||
: sourceModelIndex(QModelIndex()), type(None)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
YACReaderLibrarySourceContainer::YACReaderLibrarySourceContainer(const QModelIndex &sourceModelIndex, YACReaderLibrarySourceContainer::SourceType type)
|
||||
:sourceModelIndex(sourceModelIndex),type(type)
|
||||
{}
|
||||
: sourceModelIndex(sourceModelIndex), type(type)
|
||||
{
|
||||
}
|
||||
|
||||
QModelIndex YACReaderLibrarySourceContainer::getSourceModelIndex() const
|
||||
{
|
||||
|
Reference in New Issue
Block a user