fixed include headers

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-20 22:32:41 +00:00
parent 622914c923
commit e261a8b515
12 changed files with 233 additions and 276 deletions

View file

@ -31,7 +31,7 @@
#include "ui_ApplicationWindow.h" #include "ui_ApplicationWindow.h"
#include "../config/rsharesettings.h" #include "gui/Preferences/rsharesettings.h"
class ApplicationWindow : public QMainWindow class ApplicationWindow : public QMainWindow
{ {

View file

@ -26,7 +26,7 @@
#include "mainpage.h" #include "mainpage.h"
#include "ui_MessengerWindow.h" #include "ui_MessengerWindow.h"
#include "NetworkDialog.h" #include "NetworkDialog.h"
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
class LogoBar; class LogoBar;
class PeersDialog; class PeersDialog;

View file

@ -24,7 +24,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "configpage.h" #include "configpage.h"
#include "ui_CryptographyDialog.h" #include "ui_CryptographyDialog.h"

View file

@ -32,7 +32,7 @@
#include "mainpage.h" #include "mainpage.h"
#include "ui_SearchDialog.h" #include "ui_SearchDialog.h"
#include "advsearch/advancedsearchdialog.h" #include "advsearch/advancedsearchdialog.h"
#include "../config/rsharesettings.h" #include "Preferences/rsharesettings.h"
class FileDetail; class FileDetail;

View file

@ -23,7 +23,7 @@
#ifndef _STARTDIALOG_H #ifndef _STARTDIALOG_H
#define _STARTDIALOG_H #define _STARTDIALOG_H
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
/******** /********
#if (QT_VERSION >= 040300) #if (QT_VERSION >= 040300)

View file

@ -26,7 +26,7 @@
#include <QDateTime> #include <QDateTime>
//#include <QEvent> //#include <QEvent>
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "mainpage.h" #include "mainpage.h"
#include "ui_StatisticDialog.h" #include "ui_StatisticDialog.h"

View file

@ -27,8 +27,7 @@
#include <QDateTime> #include <QDateTime>
#include <QEvent> #include <QEvent>
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
//#include <control/rscontrol.h>
#include <gui/common/rwindow.h> #include <gui/common/rwindow.h>
#include "ui_bwgraph.h" #include "ui_bwgraph.h"

View file

@ -23,7 +23,7 @@
#ifndef _CONNECTDIALOG_H #ifndef _CONNECTDIALOG_H
#define _CONNECTDIALOG_H #define _CONNECTDIALOG_H
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "ui_ConnectDialog.h" #include "ui_ConnectDialog.h"

View file

@ -1,201 +1,180 @@
/**************************************************************** #include <QtGui>
* RetroShare is distributed under the following license: //#include "ui_window.h"
* #include "findwindow.h"
* Copyright (C) 2008, defnax #include "mainwindowimpl.h"
*
* This program is free software; you can redistribute it and/or extern QString fileToFind;
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 Window::Window(QWidget *parent)
* of the License, or (at your option) any later version. : QDialog(parent)
* {
* This program is distributed in the hope that it will be useful, browseButton = createButton(tr("&Browse..."), SLOT(browse()));
* but WITHOUT ANY WARRANTY; without even the implied warranty of findButton = createButton(tr("&Find"), SLOT(find()));
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. fileComboBox = createComboBox(fileToFind);
* textComboBox = createComboBox();
* You should have received a copy of the GNU General Public License directoryComboBox = createComboBox();
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, fileLabel = new QLabel(tr("Named:"));
* Boston, MA 02110-1301, USA. textLabel = new QLabel(tr("Containing text:"));
****************************************************************/ directoryLabel = new QLabel(tr("In directory:"));
filesFoundLabel = new QLabel;
#include <QtGui>
//#include "ui_FileWindow.h" createFilesTable();
#include "findwindow.h"
#include "Gui/LibraryDialog.h" QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch();
extern QString fileToFind; buttonsLayout->addWidget(findButton);
FindWindow::FindWindow(QWidget *parent) QGridLayout *mainLayout = new QGridLayout;
: QDialog(parent) mainLayout->addWidget(fileLabel, 0, 0);
{ mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
browseButton = createButton(tr("&Browse..."), SLOT(browse())); mainLayout->addWidget(textLabel, 1, 0);
findButton = createButton(tr("&Find"), SLOT(find())); mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
mainLayout->addWidget(directoryLabel, 2, 0);
fileComboBox = createComboBox(fileToFind); mainLayout->addWidget(directoryComboBox, 2, 1);
textComboBox = createComboBox(); mainLayout->addWidget(browseButton, 2, 2);
directoryComboBox = createComboBox(); mainLayout->addWidget(filesTable, 3, 0, 1, 3);
mainLayout->addWidget(filesFoundLabel, 4, 0);
fileLabel = new QLabel(tr("Named:")); mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3);
textLabel = new QLabel(tr("Containing text:")); setLayout(mainLayout);
directoryLabel = new QLabel(tr("In directory:"));
filesFoundLabel = new QLabel; setWindowTitle(tr("Find Files"));
resize(700, 300);
createFilesTable(); }
QHBoxLayout *buttonsLayout = new QHBoxLayout; void Window::browse()
buttonsLayout->addStretch(); {
buttonsLayout->addWidget(findButton); QString directory = QFileDialog::getExistingDirectory(this,
tr("Find Files"), QDir::currentPath());
QGridLayout *mainLayout = new QGridLayout; if (!directory.isEmpty()) {
mainLayout->addWidget(fileLabel, 0, 0); directoryComboBox->addItem(directory);
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2); directoryComboBox->setCurrentIndex(directoryComboBox->currentIndex() + 1);
mainLayout->addWidget(textLabel, 1, 0); }
mainLayout->addWidget(textComboBox, 1, 1, 1, 2); }
mainLayout->addWidget(directoryLabel, 2, 0);
mainLayout->addWidget(directoryComboBox, 2, 1); void Window::find()
mainLayout->addWidget(browseButton, 2, 2); {
mainLayout->addWidget(filesTable, 3, 0, 1, 3); filesTable->setRowCount(0);
mainLayout->addWidget(filesFoundLabel, 4, 0);
mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3); QString fileName = fileComboBox->currentText();
setLayout(mainLayout); QString text = textComboBox->currentText();
QString path = directoryComboBox->currentText();
setWindowTitle(tr("Find Files"));
resize(700, 300);
} QDir directory = QDir(path);
QStringList files,folders;
void FindWindow::browse()
{ if (fileName.isEmpty())
QString directory = QFileDialog::getExistingDirectory(this, fileName = "*";
tr("Find Files"), QDir::currentPath()); files = directory.entryList(QStringList(fileName),
if (!directory.isEmpty()) { QDir::Files |QDir::NoSymLinks);
directoryComboBox->addItem(directory); folders=directory.entryList(QStringList(fileName),
directoryComboBox->setCurrentIndex(directoryComboBox->currentIndex() + 1); QDir::Dirs | QDir::NoSymLinks);
} //QMessageBox::information(this,"path",path);
}
files = findFiles(directory, files, text);
void FindWindow::find() if(text.isEmpty()){
{ showFolders(directory, folders);
filesTable->setRowCount(0); showFiles(directory, files);
}
QString fileName = fileComboBox->currentText(); else if(!text.isEmpty()){
QString text = textComboBox->currentText(); showFiles(directory, files);
QString path = directoryComboBox->currentText(); }
QLocale d;
if (files.isEmpty())
QDir directory = QDir(path); {
QStringList files,folders; if(d.toString(folders.size())!=0){
for(int i=folders.size();i>0;i--)
if (fileName.isEmpty()) directory.cd(folders[i]);
fileName = "*"; //QMessageBox::information(this,"dir",directory.dirName());
files = directory.entryList(QStringList(fileName), }
QDir::Files |QDir::NoSymLinks); }
folders=directory.entryList(QStringList(fileName), }
QDir::Dirs | QDir::NoSymLinks); QStringList Window::findFiles( QDir &directory, QStringList &files,
//QMessageBox::information(this,"path",path); QString &text)
{
files = findFiles(directory, files, text); QStringList foundFiles;
if(text.isEmpty()){
showFolders(directory, folders); for (int i = 0; i < files.size(); ++i) {
showFiles(directory, files); QFile file(directory.absoluteFilePath(files[i]));
}
else if(!text.isEmpty()){ if (file.open(QIODevice::ReadOnly)) {
showFiles(directory, files); QString line;
} QTextStream in(&file);
QLocale d; while (!in.atEnd()) {
if (files.isEmpty()) line = in.readLine();
{ if (line.contains(text)) {
if(d.toString(folders.size())!=0){ foundFiles << files[i];
for(int i=folders.size();i>0;i--) break;
directory.cd(folders[i]); }
//QMessageBox::information(this,"dir",directory.dirName()); }
} }
} }
} return foundFiles;
QStringList FindWindow::findFiles( QDir &directory, QStringList &files, }
QString &text)
{ void Window::showFiles(const QDir &directory, const QStringList &files)
QStringList foundFiles; {
for (int i = 0; i < files.size(); ++i) {
for (int i = 0; i < files.size(); ++i) { QFile file(directory.absoluteFilePath(files[i]));
QFile file(directory.absoluteFilePath(files[i])); qint64 size = QFileInfo(file).size();
if (file.open(QIODevice::ReadOnly)) { QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]);
QString line; fileNameItem->setFlags(Qt::ItemIsEnabled);
QTextStream in(&file); QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
while (!in.atEnd()) { .arg(int((size + 1023) / 1024)));
line = in.readLine(); sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
if (line.contains(text)) { sizeItem->setFlags(Qt::ItemIsEnabled);
foundFiles << files[i];
break; int row = filesTable->rowCount();
} filesTable->insertRow(row);
} filesTable->setItem(row, 0, fileNameItem);
} filesTable->setItem(row, 1, sizeItem);
} }
return foundFiles; filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()));
} }
void FindWindow::showFiles(const QDir &directory, const QStringList &files) void Window::showFolders(const QDir &directory, const QStringList &folders)
{ {
for (int i = 0; i < files.size(); ++i) { for (int i = 0; i < folders.size(); ++i) {
QFile file(directory.absoluteFilePath(files[i])); QDir folder(directory.absoluteFilePath(folders[i]));
qint64 size = QFileInfo(file).size();
QTableWidgetItem *fileNameItem = new QTableWidgetItem(folders[i]);
QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]); fileNameItem->setFlags(Qt::ItemIsEnabled);
fileNameItem->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
.arg(int((size + 1023) / 1024))); int row = filesTable->rowCount();
sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); filesTable->insertRow(row);
sizeItem->setFlags(Qt::ItemIsEnabled); filesTable->setItem(row, 0, fileNameItem);
int row = filesTable->rowCount(); }
filesTable->insertRow(row); return ;
filesTable->setItem(row, 0, fileNameItem); }
filesTable->setItem(row, 1, sizeItem);
} QPushButton *Window::createButton(const QString &text, const char *member)
filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size())); {
} QPushButton *button = new QPushButton(text);
connect(button, SIGNAL(clicked()), this, member);
void FindWindow::showFolders(const QDir &directory, const QStringList &folders) return button;
{ }
for (int i = 0; i < folders.size(); ++i) {
QDir folder(directory.absoluteFilePath(folders[i])); QComboBox *Window::createComboBox(const QString &text)
{
QTableWidgetItem *fileNameItem = new QTableWidgetItem(folders[i]); QComboBox *comboBox = new QComboBox;
fileNameItem->setFlags(Qt::ItemIsEnabled); comboBox->setEditable(true);
comboBox->addItem(text);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
int row = filesTable->rowCount(); return comboBox;
filesTable->insertRow(row); }
filesTable->setItem(row, 0, fileNameItem);
void Window::createFilesTable()
} {
return ; filesTable = new QTableWidget(0, 2);
} QStringList labels;
labels << tr("File Name") << tr("Size");
QPushButton *FindWindow::createButton(const QString &text, const char *member) filesTable->setHorizontalHeaderLabels(labels);
{ filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
QPushButton *button = new QPushButton(text); filesTable->verticalHeader()->hide();
connect(button, SIGNAL(clicked()), this, member); filesTable->setShowGrid(false);
return button; }
}
QComboBox *FindWindow::createComboBox(const QString &text)
{
QComboBox *comboBox = new QComboBox;
comboBox->setEditable(true);
comboBox->addItem(text);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
return comboBox;
}
void FindWindow::createFilesTable()
{
filesTable = new QTableWidget(0, 2);
QStringList labels;
labels << tr("File Name") << tr("Size");
filesTable->setHorizontalHeaderLabels(labels);
filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
filesTable->verticalHeader()->hide();
filesTable->setShowGrid(false);
}

View file

@ -1,64 +1,43 @@
/**************************************************************** #ifndef FINDWINDOW_H
* RetroShare is distributed under the following license: #define FINDWINDOW_H
*
* Copyright (C) 2008, defnax #include <QDialog>
*
* This program is free software; you can redistribute it and/or class QComboBox;
* modify it under the terms of the GNU General Public License class QDir;
* as published by the Free Software Foundation; either version 2 class QLabel;
* of the License, or (at your option) any later version. class QPushButton;
* class QTableWidget;
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of class Window : public QDialog
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the {
* GNU General Public License for more details. Q_OBJECT
*
* You should have received a copy of the GNU General Public License public:
* along with this program; if not, write to the Free Software Window(QWidget *parent = 0);
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. private slots:
****************************************************************/ void browse();
void find();
#ifndef FINDWINDOW_H
#define FINDWINDOW_H private:
QStringList findFiles( QDir &directory, QStringList &files,
#include <QDialog> QString &text);
void showFiles(const QDir &directory, const QStringList &files);
class QComboBox; void showFolders(const QDir &directory, const QStringList &folders);
class QDir; QPushButton *createButton(const QString &text, const char *member);
class QLabel; QComboBox *createComboBox(const QString &text = QString());
class QPushButton; void createFilesTable();
class QTableWidget;
QComboBox *fileComboBox;
class FindWindow : public QDialog QComboBox *textComboBox;
{ QComboBox *directoryComboBox;
Q_OBJECT QLabel *fileLabel;
QLabel *textLabel;
public: QLabel *directoryLabel;
FindWindow(QWidget *parent = 0); QLabel *filesFoundLabel;
QPushButton *browseButton;
private slots: QPushButton *findButton;
void browse(); QTableWidget *filesTable;
void find(); };
#endif
private:
QStringList findFiles( QDir &directory, QStringList &files,
QString &text);
void showFiles(const QDir &directory, const QStringList &files);
void showFolders(const QDir &directory, const QStringList &folders);
QPushButton *createButton(const QString &text, const char *member);
QComboBox *createComboBox(const QString &text = QString());
void createFilesTable();
QComboBox *fileComboBox;
QComboBox *textComboBox;
QComboBox *directoryComboBox;
QLabel *fileLabel;
QLabel *textLabel;
QLabel *directoryLabel;
QLabel *filesFoundLabel;
QPushButton *browseButton;
QPushButton *findButton;
QTableWidget *filesTable;
};
#endif

View file

@ -26,7 +26,7 @@
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h" #include "rsiface/rsmsgs.h"
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include <sstream> #include <sstream>

View file

@ -26,7 +26,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QMap> #include <QMap>
#include <QPointer> #include <QPointer>
#include <config/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "ui_ChanMsgDialog.h" #include "ui_ChanMsgDialog.h"