Skip to content

Commit

Permalink
Fixed updateFileList
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbourgeois committed Jun 15, 2018
1 parent b03ff87 commit 5626a10
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
43 changes: 25 additions & 18 deletions bucket.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "bucket.hpp"

#define DEBUG_BUCKET

Bucket::Bucket(NodeSettings settings, QWidget * parent) :
QMainWindow(parent),
ui(new Ui::Bucket)
Expand All @@ -9,8 +11,11 @@ Bucket::Bucket(NodeSettings settings, QWidget * parent) :

connect(ui->lineEdit, SIGNAL(editingFinished()), this, SLOT(setTargetDirectory()));

width = 315;//this->size().width();
height = 444;//this->size().height();
QScreen *screen = QApplication::screens().at(0);
float screenWidth = screen->availableSize().width();
float screenHeight = screen->availableSize().height();
width = screenWidth * 0.2;//this->size().width();
height = screenHeight * 0.5;//this->size().height();

this->resize(width, 0);
imageNumber = 0;
Expand Down Expand Up @@ -49,14 +54,14 @@ void Bucket::InitializeClip() {
// qDebug() << "Width : " << listWidget->width();
// qDebug() << "Width2 : " << listWidget->size().width();
// qDebug() << "Width2 : " << this->width;
//listWidget->setIconSize(QSize(300, this->width));
listWidget->setIconSize(QSize(300, 400));
listWidget->setIconSize(QSize(this->width, this->height));
//listWidget->setIconSize(QSize(300, 400));
listWidget->setResizeMode(QListWidget::Adjust);
listWidget->setStyleSheet(QString("background-color: rgba(255, 255, 255, 255);"));

ui->openExplorerButton->setStyleSheet(QString("background-color: rgba(255, 255, 255, 255);"));
//Set working path
workingDirectory.setPath("D:/Content/");//QDir::currentPath() + "/");
workingDirectory.setPath("B:/Content/");//QDir::currentPath() + "/");
ui->lineEdit->setText(workingDirectory.absolutePath() + "/");
UpdateVisibleFiles();
}
Expand Down Expand Up @@ -120,7 +125,7 @@ void Bucket::InitializeWindow()
void Bucket::Open() {
this->setVisible(true);
QPropertyAnimation *animation = new QPropertyAnimation(this, "size");
animation->setDuration(200);
animation->setDuration(300);
// animation->setStartValue(QRect(this->pos().x(), this->pos().y(), width, 0));
// animation->setEndValue(QRect(this->pos().x(), this->pos().y(), width, height));
animation->setStartValue(QSize(width, 0));
Expand All @@ -134,7 +139,7 @@ void Bucket::Open() {

void Bucket::Close() {
QPropertyAnimation *animation = new QPropertyAnimation(this, "size");
animation->setDuration(200);
animation->setDuration(300);
// animation->setStartValue(QRect(this->pos().x(), this->pos().y(), width, height));
// animation->setEndValue(QRect(this->pos().x(), this->pos().y(), width, 0));
animation->setStartValue(QSize(width, height));
Expand Down Expand Up @@ -312,16 +317,19 @@ void Bucket::UpdateVisibleFiles() {
for(auto i=0 ; i<listWidget->count() ; i++) {
QStringList stringList = listWidget->item(i)->text().split("/");
QString fileName = stringList.last();
// qDebug() << "Comparing " << it.fileName() << " with" << fileName << ":" << fileName.compare(it.fileName());
if(fileName.compare(it.fileName()) > 0) {
#ifdef DEBUG_BUCKET
qDebug() << "Comparing " << it.fileName() << " with" << fileName << ":" << fileName.compare(it.fileName());
#endif
if(fileName.compare(it.fileName()) >= 0) {
// qDebug() << "File already visible";
addFile = false;
break;
}
}
if(addFile) {
#ifdef DEBUG_BUCKET
qDebug() << "Adding new element : " << workingDirectory.absolutePath() << "/" << it.fileName() << it.fileInfo().suffix();

#endif
QListWidgetItem* newItem = new QListWidgetItem();
if(IsImage(it.fileInfo().suffix())) {
newItem->setIcon(QIcon(workingDirectory.absolutePath() + "/" + it.fileName()));
Expand Down Expand Up @@ -411,17 +419,16 @@ void Bucket::listWidgetItemDoubleClicked(QListWidgetItem *item)

void Bucket::on_openExplorerButton_clicked()
{
#ifdef DEBUG_BUCKET
qDebug() << "Opening explorer .. " <<workingDirectory.absolutePath() ;
#endif
QString program = "explorer";
QStringList arguments;
QString tempPath = workingDirectory.absolutePath().replace("/", "\\");
arguments <<tempPath;// workingDirectory.absolutePath() + "/";
QStringList arguments;
QString cleanedPath = workingDirectory.absolutePath().replace("/", "\\");
arguments << cleanedPath;// workingDirectory.absolutePath() + "/";

QProcess *myProcess = new QProcess();
myProcess->start(program, arguments);
QProcess *myProcess = new QProcess();
myProcess->start(program, arguments);

// QProcess process;
// process.setWorkingDirectory(workingDirectory.absolutePath());
// process.start("exporer");//, QStringList() << "gui");
QProcess::startDetached("git", QStringList() << "gui", "D:\\MyWork\\Temp\\source");
}
1 change: 1 addition & 0 deletions bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QListWidget>
#include <QStatusBar>
#include <QProcess>
#include <QScreen>

#include "ui_bucket.h"
#include "bucket.hpp"
Expand Down
2 changes: 1 addition & 1 deletion bucket.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>315</width>
<width>363</width>
<height>444</height>
</rect>
</property>
Expand Down
11 changes: 4 additions & 7 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,12 @@ void MainWindow::CreatePin(NodeWidget* node, QListWidgetItem* item) {
void MainWindow::InitializeWindow()
{
//QWidget::activateWindow();

Qt::WindowFlags flags;
this->setAttribute(Qt::WA_TranslucentBackground);
Qt::WindowFlags flags = this->windowFlags();
flags |= Qt::FramelessWindowHint;
flags |= Qt::WindowStaysOnTopHint;
flags |= Qt::X11BypassWindowManagerHint;
this->setWindowFlags(flags);
this->setAttribute(Qt::WA_TranslucentBackground);


flags |= Qt::WindowStaysOnTopHint;
this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);

QRect rec = QApplication::desktop()->screenGeometry();
height = rec.height();
Expand Down

0 comments on commit 5626a10

Please sign in to comment.