42 | #include
43 | #include "mainwindow.h"
44 |
45 | extern int windowNum;
46 |
47 | static void showHelp(QCommandLineParser &parser, const QString errorMessage = QString())
48 | {
49 | QString text;
50 | QTextStream str(&text);
51 | str << "";
52 | if (!errorMessage.isEmpty())
53 | str << "" << errorMessage << "
";
54 | str << "" << parser.helpText() << "
";
55 | QMessageBox box(errorMessage.isEmpty() ? QMessageBox::Information : QMessageBox::Warning,
56 | QGuiApplication::applicationDisplayName(), text, QMessageBox::Ok);
57 | box.setTextInteractionFlags(Qt::TextBrowserInteraction);
58 | box.exec();
59 | }
60 |
61 | int main(int argc, char * argv[])
62 | {
63 | QApplication app(argc, argv);
64 | //QTranslator trans;
65 | //trans.load("looplorer_zh.qm");
66 | //app.installTranslator(&trans);
67 | QCommandLineParser commandLineParser;
68 | commandLineParser.addPositionalArgument(QStringLiteral("url"),
69 | QStringLiteral("The url to be loaded in the browser window."));
70 | commandLineParser.process(app);
71 | QStringList positionalArguments = commandLineParser.positionalArguments();
72 |
73 | QUrl url;
74 | if (positionalArguments.size() > 1) {
75 | showHelp(commandLineParser, QStringLiteral("Too many arguments."));
76 | return -1;
77 | } else if (positionalArguments.size() == 1)
78 | url = QUrl::fromUserInput(positionalArguments.at(0));
79 | else
80 | url = QUrl("http://www.baidu.com");
81 |
82 | if (!url.isValid()) {
83 | showHelp(commandLineParser, QString("%1 is not a valid url.").arg(positionalArguments.at(0)));
84 | return -1;
85 | }
86 |
87 | windowNum = 0;
88 | MainWindow browser(url);
89 | browser.show();
90 |
91 | return app.exec();
92 | }
93 |
--------------------------------------------------------------------------------
/src/ldecc/descc.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Descc
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 100
20 | 10
21 | 80
22 | 27
23 |
24 |
25 |
26 | 主页
27 |
28 |
29 |
30 |
31 |
32 | 220
33 | 10
34 | 161
35 | 31
36 |
37 |
38 |
39 |
40 | 11
41 | 75
42 | true
43 |
44 |
45 |
46 | 桌面与壁纸
47 |
48 |
49 |
50 |
51 |
52 | 10
53 | 10
54 | 80
55 | 27
56 |
57 |
58 |
59 | 关闭
60 |
61 |
62 |
63 |
64 |
65 | 20
66 | 40
67 | 201
68 | 131
69 |
70 |
71 |
72 | <html><head/><body><p align="center"><背景浏览></p></body></html>
73 |
74 |
75 | true
76 |
77 |
78 |
79 |
80 |
81 | 20
82 | 180
83 | 361
84 | 79
85 |
86 |
87 |
88 | -
89 |
90 |
91 | false
92 |
93 |
94 | 使用 LDE WallPapers 壁纸库(未安装)
95 |
96 |
97 |
98 | -
99 |
100 |
-
101 |
102 |
103 | 自定义壁纸
104 |
105 |
106 | true
107 |
108 |
109 |
110 | -
111 |
112 |
-
113 |
114 |
115 | 图片位置:
116 |
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | 200
132 | 260
133 | 195
134 | 32
135 |
136 |
137 |
138 | -
139 |
140 |
141 | 选择图片...
142 |
143 |
144 |
145 | -
146 |
147 |
148 | false
149 |
150 |
151 | 应用
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/src/ldecc/gencc.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Gencc
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 10
20 | 10
21 | 80
22 | 27
23 |
24 |
25 |
26 | 关闭
27 |
28 |
29 |
30 |
31 |
32 | 100
33 | 10
34 | 80
35 | 27
36 |
37 |
38 |
39 | 主页
40 |
41 |
42 |
43 |
44 |
45 | 220
46 | 10
47 | 161
48 | 31
49 |
50 |
51 |
52 |
53 | 11
54 | 75
55 | true
56 |
57 |
58 |
59 | 通用
60 |
61 |
62 |
63 |
64 |
65 | 150
66 | 60
67 | 121
68 | 27
69 |
70 |
71 |
72 | 窗口管理器设置
73 |
74 |
75 |
76 |
77 |
78 | 90
79 | 60
80 | 31
81 | 31
82 |
83 |
84 |
85 | 外观:
86 |
87 |
88 |
89 |
90 |
91 | 60
92 | 120
93 | 71
94 | 16
95 |
96 |
97 |
98 | 显示状态栏:
99 |
100 |
101 |
102 |
103 |
104 | 120
105 | 230
106 | 231
107 | 22
108 |
109 |
110 |
111 | 关闭文稿时要求保存更改
112 |
113 |
114 |
115 |
116 |
117 | 20
118 | 210
119 | 361
120 | 16
121 |
122 |
123 |
124 | Qt::Horizontal
125 |
126 |
127 |
128 |
129 |
130 | 10
131 | 90
132 | 381
133 | 16
134 |
135 |
136 |
137 | Qt::Horizontal
138 |
139 |
140 |
141 |
142 |
143 | 150
144 | 120
145 | 134
146 | 80
147 |
148 |
149 |
150 | -
151 |
152 |
153 | 按照程序内设置
154 |
155 |
156 |
157 | -
158 |
159 |
160 | 始终显示
161 |
162 |
163 |
164 | -
165 |
166 |
167 | 始终隐藏
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
--------------------------------------------------------------------------------
/src/LooFTP/widget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Widget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 454
10 | 300
11 |
12 |
13 |
14 | LooFTP 0.1.6
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | FTP服务器:
23 |
24 |
25 |
26 | -
27 |
28 |
29 | ftp.loongsoner.com
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
-
38 |
39 |
40 | 用户名:
41 |
42 |
43 |
44 | -
45 |
46 |
47 | 默认用户名请使用:anonymous,此时密码任意。
48 |
49 |
50 | anonymous
51 |
52 |
53 |
54 | -
55 |
56 |
57 | 密码:
58 |
59 |
60 |
61 | -
62 |
63 |
64 | 123456
65 |
66 |
67 | QLineEdit::Password
68 |
69 |
70 |
71 | -
72 |
73 |
74 | 连接
75 |
76 |
77 |
78 |
79 |
80 | -
81 |
82 |
83 |
84 | 文件
85 |
86 |
87 |
88 |
89 | 大小
90 |
91 |
92 |
93 |
94 | 新建列
95 |
96 |
97 |
98 |
99 | 拥有者
100 |
101 |
102 |
103 |
104 | 修改日期
105 |
106 |
107 |
108 |
109 | -
110 |
111 |
-
112 |
113 |
114 | 24
115 |
116 |
117 |
118 | -
119 |
120 |
121 | 返回上一级目录
122 |
123 |
124 |
125 |
126 |
127 | -
128 |
129 |
-
130 |
131 |
132 | FTP客户端
133 |
134 |
135 |
136 | -
137 |
138 |
139 | Qt::Horizontal
140 |
141 |
142 |
143 | 40
144 | 20
145 |
146 |
147 |
148 |
149 | -
150 |
151 |
152 | 下载
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/src/Lootepad/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #include "mainwindow.h"
8 | #include "ui_mainwindow.h"
9 | #include "textedittab.h"
10 |
11 | MainWindow::MainWindow(QWidget *parent) :
12 | QMainWindow(parent),
13 | ui(new Ui::MainWindow)
14 | {
15 | ui->setupUi(this);
16 | isSaved = false;
17 | curFile = tr("untitled.txt");
18 | formTitle = curFile + tr(" - Lootepad 0.10");
19 | setWindowTitle(formTitle);
20 | textEditTab = new TextEditTab(this);
21 | ui->gridLayout->addWidget(textEditTab);
22 |
23 | connect(this, SIGNAL(updateText(QString)), this, SLOT(on_second_statusLabel_updateText(QString)));
24 | init_statusBar();
25 |
26 | }
27 |
28 | MainWindow::~MainWindow()
29 | {
30 | delete ui;
31 | }
32 |
33 |
34 | void MainWindow::on_action_New_triggered()
35 | {
36 | textEditTab->currentTEditor->do_file_New();
37 | }
38 |
39 | void MainWindow::on_action_Save_triggered()
40 | {
41 | textEditTab->currentTEditor->do_file_Save();
42 | }
43 |
44 | void MainWindow::on_action_SaveAs_triggered()
45 | {
46 | textEditTab->currentTEditor->do_file_SaveAs();
47 | }
48 |
49 | void MainWindow::on_action_Help_triggered()
50 | {
51 | QMessageBox::information(this,tr("版本说明"),tr("lootepad 0.10.1"));
52 | }
53 |
54 |
55 |
56 | void MainWindow::on_action_Open_triggered()
57 | {
58 | textEditTab->currentTEditor->do_file_Open();
59 | }
60 |
61 | void MainWindow::on_action_Close_triggered()
62 | {
63 | textEditTab->currentTEditor->do_file_SaveOrNot();
64 | textEditTab->currentTEditor->setVisible(false);
65 | first_statusLabel->setText(tr("文本编辑器已关闭"));
66 | second_statusLabel->setText(tr("Lootepad 0.10.1"));
67 | }
68 |
69 | void MainWindow::on_action_Quit_triggered()
70 | {
71 | on_action_Close_triggered();
72 | qApp->quit();
73 | }
74 |
75 | void MainWindow::on_action_Undo_triggered()
76 | {
77 | textEditTab->currentTEditor->undo();
78 | }
79 |
80 | void MainWindow::on_action_Cut_triggered()
81 | {
82 | textEditTab->currentTEditor->cut();
83 | }
84 |
85 | void MainWindow::on_action_Copy_triggered()
86 | {
87 | textEditTab->currentTEditor->copy();
88 | }
89 |
90 | void MainWindow::on_action_Past_triggered()
91 | {
92 | textEditTab->currentTEditor->paste();
93 | }
94 |
95 | void MainWindow::on_action_Find_triggered()
96 | {
97 | QDialog *findDlg = new QDialog(this);
98 | findDlg->setWindowTitle(tr("查找"));
99 | find_textLineEdit = new QLineEdit(findDlg);
100 | QPushButton *find_Btn = new QPushButton(tr("查找下一个"),findDlg);
101 | QVBoxLayout* layout = new QVBoxLayout(findDlg);
102 | layout->addWidget(find_textLineEdit);
103 | layout->addWidget(find_Btn);
104 | findDlg->show();
105 | connect(find_Btn,SIGNAL(clicked()),this,SLOT(show_findText()));
106 | second_statusLabel->setText(tr("正在进行查找"));
107 | }
108 |
109 | void MainWindow::show_findText()
110 | {
111 | QString findText = find_textLineEdit->text();
112 | if(!textEditTab->currentTEditor->find(findText,QTextDocument::FindBackward))
113 | {
114 | QMessageBox::warning(this,tr("查找"),tr("找不到 %1").arg(findText));
115 | }
116 | }
117 |
118 | void MainWindow::init_statusBar()
119 | {
120 | QStatusBar* bar = ui->statusBar;
121 | first_statusLabel = new QLabel;
122 | first_statusLabel->setMinimumSize(150,20);
123 | first_statusLabel->setFrameShape(QFrame::WinPanel);
124 | first_statusLabel->setFrameShadow(QFrame::Sunken);
125 | second_statusLabel = new QLabel;
126 | second_statusLabel->setMinimumSize(150,20);
127 | second_statusLabel->setFrameShape(QFrame::WinPanel);
128 | second_statusLabel->setFrameShadow(QFrame::Sunken);
129 | bar->addWidget(first_statusLabel);
130 | bar->addWidget(second_statusLabel);
131 | first_statusLabel->setText(tr("欢迎使用文本编辑器"));
132 | second_statusLabel->setText(tr("Lootepad 0.10.1"));
133 | }
134 |
135 | void MainWindow::do_cursorChanged()
136 | {
137 | int rowNum = textEditTab->currentTEditor->document()->blockCount();
138 | const QTextCursor cursor = textEditTab->currentTEditor->textCursor();
139 | int colNum = cursor.columnNumber();
140 | first_statusLabel->setText(tr("%1 行 %2 列").arg(rowNum).arg(colNum));
141 | }
142 |
143 | void MainWindow::on_action_triggered()
144 | {
145 | textEditTab->currentTEditor->redo();
146 | }
147 |
148 | void MainWindow::on_action_LDE_triggered()
149 | {
150 | QProcess *mainProcess = new QProcess;
151 | mainProcess->start("ldeabout",NULL);
152 | }
153 |
154 | void MainWindow::on_actionNewTab_triggered()
155 | {
156 | emit textEditTab->addEditTab(this);
157 | }
158 |
159 | void MainWindow::on_second_statusLabel_updateText(QString text)
160 | {
161 | second_statusLabel->setText(text);
162 | }
163 |
--------------------------------------------------------------------------------
/src/LooFTP/qurlinfo.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtNetwork module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QURLINFO_H
43 | #define QURLINFO_H
44 |
45 | #include
46 | #include
47 | #include
48 |
49 | QT_BEGIN_NAMESPACE
50 |
51 | class QUrl;
52 | class QUrlInfoPrivate;
53 |
54 | class QUrlInfo
55 | {
56 | public:
57 | enum PermissionSpec {
58 | ReadOwner = 00400, WriteOwner = 00200, ExeOwner = 00100,
59 | ReadGroup = 00040, WriteGroup = 00020, ExeGroup = 00010,
60 | ReadOther = 00004, WriteOther = 00002, ExeOther = 00001 };
61 |
62 | QUrlInfo();
63 | QUrlInfo(const QUrlInfo &ui);
64 | QUrlInfo(const QString &name, int permissions, const QString &owner,
65 | const QString &group, qint64 size, const QDateTime &lastModified,
66 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
67 | bool isWritable, bool isReadable, bool isExecutable);
68 | QUrlInfo(const QUrl &url, int permissions, const QString &owner,
69 | const QString &group, qint64 size, const QDateTime &lastModified,
70 | const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink,
71 | bool isWritable, bool isReadable, bool isExecutable);
72 | QUrlInfo &operator=(const QUrlInfo &ui);
73 | virtual ~QUrlInfo();
74 |
75 | virtual void setName(const QString &name);
76 | virtual void setDir(bool b);
77 | virtual void setFile(bool b);
78 | virtual void setSymLink(bool b);
79 | virtual void setOwner(const QString &s);
80 | virtual void setGroup(const QString &s);
81 | virtual void setSize(qint64 size);
82 | virtual void setWritable(bool b);
83 | virtual void setReadable(bool b);
84 | virtual void setPermissions(int p);
85 | virtual void setLastModified(const QDateTime &dt);
86 | void setLastRead(const QDateTime &dt);
87 |
88 | bool isValid() const;
89 |
90 | QString name() const;
91 | int permissions() const;
92 | QString owner() const;
93 | QString group() const;
94 | qint64 size() const;
95 | QDateTime lastModified() const;
96 | QDateTime lastRead() const;
97 | bool isDir() const;
98 | bool isFile() const;
99 | bool isSymLink() const;
100 | bool isWritable() const;
101 | bool isReadable() const;
102 | bool isExecutable() const;
103 |
104 | static bool greaterThan(const QUrlInfo &i1, const QUrlInfo &i2,
105 | int sortBy);
106 | static bool lessThan(const QUrlInfo &i1, const QUrlInfo &i2,
107 | int sortBy);
108 | static bool equal(const QUrlInfo &i1, const QUrlInfo &i2,
109 | int sortBy);
110 |
111 | bool operator==(const QUrlInfo &i) const;
112 | inline bool operator!=(const QUrlInfo &i) const
113 | { return !operator==(i); }
114 |
115 | private:
116 | QUrlInfoPrivate *d;
117 | };
118 |
119 | QT_END_NAMESPACE
120 |
121 | #endif // QURLINFO_H
122 |
--------------------------------------------------------------------------------
/src/LooFTP/widget.cpp:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 | #include "ui_widget.h"
3 |
4 | Widget::Widget(QWidget *parent) :
5 | QWidget(parent),
6 | ui(new Ui::Widget)
7 | {
8 | ui->setupUi(this);
9 | ui->progressBar->setValue(0);
10 | connect(ui->fileList,SIGNAL(itemActivated(QTreeWidgetItem*,int)),this,SLOT(processItem(QTreeWidgetItem*,int)));
11 | }
12 |
13 | Widget::~Widget()
14 | {
15 | delete ui;
16 | }
17 |
18 | void Widget::ftpCommandStarted(int)
19 | {
20 | if(ftp->currentCommand() == QFtp::ConnectToHost){
21 | ui->label->setText(tr("正在连接到服务器…"));
22 | }
23 | if(ftp->currentCommand() == QFtp::Login){
24 | ui->label->setText(tr("正在登录…"));
25 | }
26 | if(ftp->currentCommand() == QFtp::Get){
27 | ui->label->setText(tr("正在下载…"));
28 | }
29 | else if(ftp->currentCommand() == QFtp::Close){
30 | ui->label->setText(tr("正在关闭链接…"));
31 | }
32 | }
33 |
34 | void Widget::ftpCommandFinished(int, bool error)
35 | {
36 | if(ftp->currentCommand() == QFtp::ConnectToHost){
37 | if(error) ui->label->setText(tr("连接服务器出现错误: %1").arg(ftp->errorString()));
38 | else ui->label->setText(tr("连接到服务器成功"));
39 | }
40 | if(ftp->currentCommand() == QFtp::Login){
41 | if(error) ui->label->setText(tr("登录出现错误: %1").arg(ftp->errorString()));
42 | else{
43 | ui->label->setText(tr("登录成功"));
44 | ftp->list();
45 | }
46 | }
47 | if(ftp->currentCommand() == QFtp::Get){
48 | if(error) ui->label->setText(tr("下载出现错误: %1").arg(ftp->errorString()));
49 | else{
50 | ui->label->setText(tr("已经完成下载"));
51 | ui->downloadButton->setEnabled(true);
52 | file->close();
53 | }
54 | }
55 | if(ftp->currentCommand() == QFtp::List){
56 | if(isDirectory.isEmpty())
57 | {
58 | ui->fileList->addTopLevelItem(new QTreeWidgetItem(QStringList()<")));
59 | ui->fileList->setEnabled(false);
60 | ui->label->setText(tr("该目录为空"));
61 | }
62 | }
63 | else if(ftp->currentCommand() == QFtp::Close){
64 | ui->label->setText(tr("已经关闭连接"));
65 | }
66 | }
67 |
68 |
69 | void Widget::on_cdToParentButton_clicked()
70 | {
71 | ui->fileList->clear();
72 | isDirectory.clear();
73 | currentPath = currentPath.left(currentPath.lastIndexOf('/'));
74 | if(currentPath.isEmpty()){
75 | ui->cdToParentButton->setEnabled(false);
76 | ftp->cd("/");
77 | } else{
78 | ftp->cd(currentPath);
79 | }
80 | ftp->list();
81 | }
82 |
83 | void Widget::on_connectButton_clicked()
84 | {
85 | QString userName;
86 | QString passWord;
87 | ui->fileList->clear();
88 | currentPath.clear();
89 | isDirectory.clear();
90 | ftp = new QFtp(this);
91 | connect(ftp,SIGNAL(commandStarted(int)),this,SLOT(ftpCommandStarted(int)));
92 | connect(ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(ftpCommandFinished(int,bool)));
93 | connect(ftp,SIGNAL(listInfo(QUrlInfo)),this,SLOT(addToList(QUrlInfo)));
94 | connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),this,SLOT(updateDataTransferProgress(qint64,qint64)));
95 | QString ftpServer = ui->ftpServerLineEdit->text();
96 | if (ui->userNamelineEdit->text() == "")
97 | userName = "anonymous";
98 | else
99 | userName = ui->userNamelineEdit->text();
100 | if (ui->passWordlineEdit->text() == "")
101 | passWord = "123456";
102 | else
103 | passWord = ui->passWordlineEdit->text();
104 | ftp->connectToHost(ftpServer,21);
105 | ftp->login(userName,passWord);
106 | }
107 |
108 | void Widget::addToList(const QUrlInfo &urlInfo)
109 | {
110 | QTreeWidgetItem *item = new QTreeWidgetItem;
111 | item->setText(0,urlInfo.name());
112 | item->setText(1,QString::number(urlInfo.size()));
113 | item->setText(2,urlInfo.owner());
114 | item->setText(3,urlInfo.group());
115 | item->setText(4,urlInfo.lastModified().toString("MMM dd yyyy"));
116 | //QPixmap pixmap(urlInfo.isDir() ? "../dir.png" : "../file.png");
117 | //item->setIcon(0,pixmap);
118 | isDirectory[urlInfo.name()] = urlInfo.isDir();
119 | ui->fileList->addTopLevelItem(item);
120 | if(!ui->fileList->currentItem()){
121 | ui->fileList->setCurrentItem(ui->fileList->topLevelItem(0));
122 | ui->fileList->setEnabled(true);
123 | }
124 | }
125 |
126 | void Widget::processItem(QTreeWidgetItem *item, int)
127 | {
128 | QString name = item->text(0);
129 | if(isDirectory.value(name)){
130 | ui->fileList->clear();
131 | isDirectory.clear();
132 | currentPath += '/';
133 | currentPath += name;
134 | ftp->cd(name);
135 | ftp->list();
136 | ui->cdToParentButton->setEnabled(true);
137 | }
138 | }
139 |
140 |
141 | void Widget::on_downloadButton_clicked()
142 | {
143 | QString fileName = ui->fileList->currentItem()->text(0);
144 | file = new QFile(fileName);
145 | if(!file->open(QIODevice::WriteOnly))
146 | {
147 | delete file;
148 | return;
149 | }
150 | ui->downloadButton->setEnabled(false);
151 | ftp->get(ui->fileList->currentItem()->text(0),file);
152 | }
153 |
154 | void Widget::updateDataTransferProgress(qint64 readBytes, qint64 totalBytes)
155 | {
156 | ui->progressBar->setMaximum(totalBytes);
157 | ui->progressBar->setValue(readBytes);
158 | }
159 |
--------------------------------------------------------------------------------
/src/LooFTP/qftp.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtNetwork module of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:LGPL$
9 | ** Commercial License Usage
10 | ** Licensees holding valid commercial Qt licenses may use this file in
11 | ** accordance with the commercial license agreement provided with the
12 | ** Software or, alternatively, in accordance with the terms contained in
13 | ** a written agreement between you and Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Lesser General Public License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
19 | ** General Public License version 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef QFTP_H
43 | #define QFTP_H
44 |
45 | #include
46 | #include
47 | #include "qurlinfo.h"
48 |
49 | QT_BEGIN_NAMESPACE
50 |
51 | class QFtpPrivate;
52 |
53 | class QFtp : public QObject
54 | {
55 | Q_OBJECT
56 |
57 | public:
58 | explicit QFtp(QObject *parent = 0);
59 | virtual ~QFtp();
60 |
61 | enum State {
62 | Unconnected,
63 | HostLookup,
64 | Connecting,
65 | Connected,
66 | LoggedIn,
67 | Closing
68 | };
69 | enum Error {
70 | NoError,
71 | UnknownError,
72 | HostNotFound,
73 | ConnectionRefused,
74 | NotConnected
75 | };
76 | enum Command {
77 | None,
78 | SetTransferMode,
79 | SetProxy,
80 | ConnectToHost,
81 | Login,
82 | Close,
83 | List,
84 | Cd,
85 | Get,
86 | Put,
87 | Remove,
88 | Mkdir,
89 | Rmdir,
90 | Rename,
91 | RawCommand
92 | };
93 | enum TransferMode {
94 | Active,
95 | Passive
96 | };
97 | enum TransferType {
98 | Binary,
99 | Ascii
100 | };
101 |
102 | int setProxy(const QString &host, quint16 port);
103 | int connectToHost(const QString &host, quint16 port=21);
104 | int login(const QString &user = QString(), const QString &password = QString());
105 | int close();
106 | int setTransferMode(TransferMode mode);
107 | int list(const QString &dir = QString());
108 | int cd(const QString &dir);
109 | int get(const QString &file, QIODevice *dev=0, TransferType type = Binary);
110 | int put(const QByteArray &data, const QString &file, TransferType type = Binary);
111 | int put(QIODevice *dev, const QString &file, TransferType type = Binary);
112 | int remove(const QString &file);
113 | int mkdir(const QString &dir);
114 | int rmdir(const QString &dir);
115 | int rename(const QString &oldname, const QString &newname);
116 |
117 | int rawCommand(const QString &command);
118 |
119 | qint64 bytesAvailable() const;
120 | qint64 read(char *data, qint64 maxlen);
121 | QByteArray readAll();
122 |
123 | int currentId() const;
124 | QIODevice* currentDevice() const;
125 | Command currentCommand() const;
126 | bool hasPendingCommands() const;
127 | void clearPendingCommands();
128 |
129 | State state() const;
130 |
131 | Error error() const;
132 | QString errorString() const;
133 |
134 | public Q_SLOTS:
135 | void abort();
136 |
137 | Q_SIGNALS:
138 | void stateChanged(int);
139 | void listInfo(const QUrlInfo&);
140 | void readyRead();
141 | void dataTransferProgress(qint64, qint64);
142 | void rawCommandReply(int, const QString&);
143 |
144 | void commandStarted(int);
145 | void commandFinished(int, bool);
146 | void done(bool);
147 |
148 | private:
149 | Q_DISABLE_COPY(QFtp)
150 | QScopedPointer d;
151 |
152 | Q_PRIVATE_SLOT(d, void _q_startNextCommand())
153 | Q_PRIVATE_SLOT(d, void _q_piFinished(const QString&))
154 | Q_PRIVATE_SLOT(d, void _q_piError(int, const QString&))
155 | Q_PRIVATE_SLOT(d, void _q_piConnectState(int))
156 | Q_PRIVATE_SLOT(d, void _q_piFtpReply(int, const QString&))
157 | };
158 |
159 | QT_END_NAMESPACE
160 |
161 | #endif // QFTP_H
162 |
--------------------------------------------------------------------------------
/ldemanual.txt:
--------------------------------------------------------------------------------
1 | LDE 用户手册(2015-1-28 更新)
2 |
3 | 本用户手册是自由传播的,类似Wiki,每个使用者和开发者
4 | 都可以修改、补充其内容。修改后请在文本最后增加作者信息,
5 | 上传时请保留原文件。
6 |
7 |
8 |
9 | 1.9.1:
10 |
11 | 1、增加 LCalc 计算器。
12 |
13 | 2、修改 InitLDE 增加配置文件管理功能。
14 |
15 |
16 |
17 | Debian 7 用户请注意:
18 |
19 |
20 | LDE 有一个依赖包在 Debian Testing 源中。
21 | 在 /etc/apt/sources.list 中添加:
22 |
23 | deb http://ftp.cn.debian.org/debian/ testing main
24 |
25 | 再执行 apt-get update 即可使用 LDE 的 deb 包安装。
26 |
27 | 如果在命令行下安装,
28 | 安装后请执行 apt-get -f install 修复依赖。
29 | (推荐使用 GDebi 软件包安装程序来安装,可自动安装依赖)
30 |
31 |
32 |
33 | 安装详细说明请看下文 “五、安装方法”
34 |
35 |
36 |
37 | 当然,更好的方法是从源码编译安装
38 |
39 | 这里是编译说明:https://github.com/xuzhuoyi/LDE/wiki
40 |
41 | 零、LDE介绍:
42 |
43 |
44 | LDE,全名为 L Desktop Environment,
45 | 可在 i386/amd64/mipsel(龙芯)/armv5/armv7 等平台上执行。
46 | 最近,LDE正在准备向 iOS/Android 移动平台进行移植。
47 | LDE 项目旨在向用户提供一个低硬件门槛的桌面环境,
48 | 在轻量化的前提下,尽可能实现更强大的功能。
49 | LDE 以 Qt 5 作为图形界面库,有强大的移植性,
50 | 在 mipsel 以外的平台也可编译运行。
51 | LDE 提供了一些配套的可独立运行元件。
52 | LDE 使用 Openbox 为其默认视窗管理器,
53 | 并且希望能够提供一个建立在可独立的套件上。
54 |
55 |
56 | LDE 元件
57 |
58 |
59 |
60 | LCalc,计算器
61 |
62 | LooFM,文件管理器
63 |
64 | Looplorer, 是一个快速的网页浏览器,以 webkit 为内核,
65 | 有可保存书签功能,提供用户书签文件用于修改。
66 |
67 |
68 | LooFTP, FTP 客户端。
69 |
70 |
71 | Razorqt-Panel, 桌面面板,
72 | 移植于 Razorqt 项目(LXQT 项目的前身)。
73 | 它可以从 *.desktop 档案自动制造出选单,
74 | 也有 GUI 的偏好设定对话框(因此不需要手动修改设定档)。
75 | 这个元件也提供拥有自动完成选单的“执行”对话框。
76 |
77 |
78 | Initlde,会话管理器,当使用者启动会话时,
79 | 建立桌面环境并自动启动程序的工具。
80 |
81 |
82 | Looget, 可指定存储位置,带进度条的下载工具。
83 |
84 |
85 | Obconf, 界面管理器,可以通过此软件简单的切换窗口风格、
86 | 图标以及程序使用的字型。
87 |
88 |
89 | Lootepad, 文字编辑器,基于 Qt 的文本编辑器。可快速启动,
90 | 流畅操作。最新的版本支持恢复功能。
91 |
92 |
93 | Loogout, 注销管理器。
94 |
95 |
96 | Openbox, 窗口管理器。
97 |
98 |
99 | LRun,程序快速启动器。
100 |
101 |
102 | Ldeabout,内嵌于 LDE 软件中,显示 LDE 版本、
103 | 作者等信息的模块。
104 |
105 |
106 |
107 | 一、开发初衷和适用人群:
108 |
109 |
110 | 在图形计算中,一个桌面环境(Desktop environment,
111 | 有时称为桌面管理器)为计算机提供一个图形用户界面(GUI)。
112 | 这个名称来自桌面比拟,对应于早期的文字命令行界面(CLI)。
113 | 一个典型的桌面环境提供图标,视窗,工具栏,文件夹,
114 | 壁纸以及像拖放这样的能力。整体而言,
115 | 桌面环境在设计和功能上的特性,
116 | 赋予了它与众不同的外观和感觉。
117 | 这个桌面环境,
118 | 可以在龙芯上使用。龙芯(英语:Loongson,旧称GODSON[1])
119 | 是由中国科学院计算技术研究所所设计的通用中央处理器,
120 | 采用MIPS精简指令集架构。因为它的 mipsel 架构,
121 | 支持的软件比较少。而且现阶段龙芯的性能较弱,
122 | 流行的 KDE、GNOME 桌面环境无法在龙芯上运行,
123 | 于是就开始逐步开发和完善一个新的桌面环境。
124 | 现在已经做到了以下部分:
125 |
126 |
127 | 1,以 Openbox 为默认窗口管理器。可自行修改配置文件更换窗口
128 | 管理器。
129 |
130 |
131 | 2,整体风格接近 Lxde,由窗口管理器与面板组成。
132 |
133 |
134 | 3,支持 Oconf 修改窗口风格、主题。
135 |
136 |
137 | 4,支持所有 Openbox 的窗体操作。
138 |
139 |
140 | 5,有独立的桌面环境引导和注销程序。
141 |
142 |
143 | 6,整合 Looplorer, Lootepad, LooFTP, Looget 等实用程序,
144 | 可在终端中直接打程序名启动,也可在菜单中启动。
145 |
146 |
147 |
148 | 适用人群:
149 |
150 |
151 | 1,使用 MIPSEL 架构的设备,建议 Loongson 2F 及以上
152 | (包括 2F/3A/3B 等)。
153 |
154 |
155 | 2,好奇心强,希望更换新桌面环境,体验新程序。
156 |
157 |
158 | 3,对 Linux 有一定了解,懂得如何切换桌面环境。
159 |
160 |
161 | 4,愿意报告 bug,为龙芯社区做贡献。
162 |
163 | 关于报告 bug 及帮助开发,可以前往项目主页:
164 |
165 | https://github.com/xuzhuoyi/LDE
166 |
167 | 这是一个 git 仓库,你也可以使用
168 |
169 | git clone https://github.com/xuzhuoyi/LDE
170 |
171 | 将源代码下载到本地,编译说明请见 LDE Wiki
172 |
173 | https://github.com/xuzhuoyi/LDE/wiki
174 |
175 |
176 |
177 |
178 | 二、版本变更记录
179 |
180 |
181 | 由于之后版本变化过于频繁,这里只列出 0.9 以前版本变更记录
182 |
183 | 详细版本记录可以去:
184 |
185 | https://github.com/xuzhuoyi/LDE/commits/master 查看
186 |
187 | 0.9.0:
188 |
189 | 1、增加 LooFM 文件管理器。
190 |
191 | 2、重写 Looplorer UI,WebView 与应用分离,增加稳定性。
192 |
193 | 0.5.0:
194 |
195 | 1、修改 InitLDE 源文件,修复部分电脑的启动错误。
196 |
197 | 0.1.0:
198 |
199 | 1、对 amd64 平台进行优化。
200 |
201 | 0.0.7:
202 |
203 |
204 | 1、增加 LRun 软件快速启动器。
205 |
206 |
207 | 2、修改 .desktop 配置文件,优化菜单显示。
208 |
209 | 0.0.6:
210 |
211 |
212 | 1、出于稳定性的考虑,将面板更换为 razorqt-panel。
213 |
214 |
215 | 2、向关键程序添加 ldeabout 关于模块。
216 |
217 |
218 |
219 | 0.0.5:
220 |
221 |
222 | 1、优化依赖关系,去除非必需的依赖关系。
223 |
224 |
225 | 2、加入 Looplorer, Lootepad, LooFTP, Looget 等应用。
226 |
227 |
228 | 3、加入 Loogout 注销管理器。
229 |
230 |
231 | 4、加入 Initlde 桌面环境引导程序。
232 |
233 |
234 | 5、移植 Lxqt-panel 作为 LDE 的面板程序。
235 |
236 |
237 |
238 | 0.0.5 之前为内部版本
239 |
240 |
241 |
242 | 三、软件特色:
243 |
244 |
245 | (......待补充......)
246 |
247 |
248 |
249 | 四、主界面展示:
250 |
251 |
252 |
253 |
254 | 五、安装方法:
255 |
256 |
257 | Debian 用户安装前请注意,LDE 的一个依赖只在 Debian Testing 源提供。
258 | 安装前可临时调整到 Testing 源,安装好后可以调回 Stable 源
259 | ,不会影响其他软件包的安装升级。
260 | 如果知道如何换成
261 | Testing 源,可以以自己的方法更换。
262 | 这里使用命令行文本编辑器 nano 作为示范:
263 |
264 |
265 | 安装有两种方法,图形安装和命令行安装。建议使用图形安装。
266 |
267 |
268 | 1.图形安装(推荐):
269 |
270 |
271 | 图形安装需要下载一个 GDebi 软件包安装程序。
272 |
273 |
274 | 1)输入 su 获得 root 权限。
275 |
276 |
277 | 2)终端下执行 apt-get install gdebi 。
278 |
279 |
280 | 开始更改源:
281 |
282 |
283 | 3)输入 nano /etc/apt/sources.list
284 |
285 |
286 | 4)按下键使光标移到最后一行直接输入
287 | deb http://ftp.cn.debian.org/debian/ testing main
288 |
289 |
290 | 5)按 Ctrl + X 退出,再按 Y 确认,最后按回车。
291 |
292 |
293 | 6)使用 apt-get update 更新软件包列表。
294 |
295 |
296 | 注意:换到 Testing 源期间,最好不要使用
297 | apt-get dist-upgrade 命令升级。这样会更新到 Debian 8,
298 | Wi-Fi 将会失效。
299 |
300 |
301 | 7)打开图形界面的文件管理器,右键点击下载好的deb包,
302 | 选择“GDebi 软件包安装程序”,再在弹出的窗口中点击
303 | “安装软件包”,输入密码后会自动安装。
304 | 图形安装的优点是可以更方便地检查软件包依赖关系,
305 | 并且自动满足依赖关系,清楚地查看不满足的的依赖包和
306 | 错误信息。
307 |
308 |
309 |
310 | 2.命令行安装:
311 |
312 | 修改源的操作与图形安装一样,可以参考图形安装3-6步。
313 |
314 |
315 | 安装:
316 |
317 |
318 | 代码:
319 |
320 | cd <你的下载目录>
321 |
322 | su
323 |
324 | dpkg -i lde_0.0.7-1_mipsel.deb
325 |
326 | apt-get -f install
327 |
328 |
329 |
330 | 注意:完全安装完毕后可以删除新加的源。和刚才一样,
331 | 使用 nano 打开 sources.list,在刚添加的那行最开头加#。
332 | Ctrl + X,Y,回车。保存并退出。
333 |
334 |
335 |
336 | 六、配置文件
337 |
338 |
339 | 本版本的配置文件保存在程序内部,暂时不提供修改。
340 | 在后续的版本中,将提供配置文件的修改功能和
341 | 一个图形化的配置工具。现在,您也可以通过更改
342 | Openbox 的配置文件来更改窗口管理器和
343 | 面板设置。
344 |
345 |
346 | Openbox 配置文件位置:
347 | /home/xuzhuoyi/.config/openbox
348 |
349 |
350 |
351 | 七、进入DE环境
352 | 做完上面几步后,注销,在“登陆”界面,
353 | 选“LDE”登陆,即可进入。
354 | 第一次启动可能速度稍慢,
355 | 一般第二次启动即可正常使用。
356 |
357 |
358 | LDE 提供了专门开发的注销管理器 Loogout。
359 | 点击菜单中的系统工具中的注销即可打开。
360 | 由于新版 Debian 的权限限制,
361 | 非管理员用户没有关机和重启权限。
362 | 可注销后在登录界面关机。
363 | 也可按 Ctrl + Alt + F1 进入 tty 命令行或使用虚拟终端,
364 | 输入 su 后输入密码获取权限,再执行 reboot (重启)
365 | 或 init 0 (关机)。
366 |
367 |
368 |
369 | 注意:部分电脑在 LDE 下菜单中最低下的注销按钮有时会失效,
370 | 请点击系统工具中的注销来使用 LDE 自带的注销程序 Loogout。
371 |
372 |
373 |
374 | 八、使用方法
375 |
376 |
377 | (......待补充......)
378 |
379 |
380 |
381 | 九,其他
382 | 本DE可以直接在其他桌面环境中启动,
383 | 支持同时重叠两个桌面环境。
384 |
385 | 启动命令是:
386 | initlde
387 |
388 |
389 |
390 | 其他附带的程序也可以很好地单独运行,
391 | 命令行或是菜单中的运行中输入:
392 |
393 |
394 | looplorer 轻量级网页浏览器
395 |
396 | lootepad 类似 gedit 的文本编辑器
397 |
398 | looftp 多信息 FTP 客户端
399 |
400 | looget 可指定存储位置的下载工具
401 |
402 | loogout 注销管理器
403 |
404 |
405 |
406 |
407 | 作者:LDE Team
--------------------------------------------------------------------------------