Skip to content

Commit 05bc721

Browse files
committed
corepad fixed
1 parent 79d147d commit 05bc721

File tree

19 files changed

+264
-225
lines changed

19 files changed

+264
-225
lines changed

bookmarks/bookmarks.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ along with this program; if not, see {http://www.gnu.org/licenses/}. */
2525
#include "../corebox/globalfunctions.h"
2626

2727

28+
2829
bookmarks::bookmarks(QWidget *parent) :QWidget(parent),ui(new Ui::bookmarks)
2930
{
3031
qDebug() << "bookmarks opening";

coreaction/coreaction.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,15 @@ coreaction::coreaction(QWidget *parent) : QWidget(parent, Qt::Dialog),
3333
qDebug() << "coreaction opening";
3434
ui->setupUi(this);
3535

36-
QScreen *screen = QGuiApplication::primaryScreen();
37-
QRect screenGeometry = screen->geometry();
38-
int x = screenGeometry.width()* .23;
39-
int y = screenGeometry.height();
36+
int x = screensize().width()* .23;
37+
int y = screensize().height();
4038

41-
int sw = screenGeometry.width() - x;
39+
int sw = screensize().width() - x;
4240

4341
this->setFixedSize(x, y);
4442
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); //| Qt::ToolTip
4543
this->move(sw, 0);
4644

47-
//DEMO
48-
// QStringList lio;
49-
// lio.append("/home/shaber/Downloads/");
50-
// lio.append("/home/shaber/Desktop/");
51-
// qDebug() << "DEMO FOR GETTING FILESIZE " << getMultipleFileSize(lio);
52-
//
53-
5445
ui->calcview->setValidator(new QDoubleValidator(0,99999999,99999999,this));
5546

5647
ui->bookmarks->setVisible(0);

corebox/corebox.cpp

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ CoreBox::CoreBox(QWidget *parent) : QMainWindow(parent), ui(new Ui::CoreBox) {
5050
if (sm.getBoxIsMaximize()) {
5151
on_maximizeButton_clicked();
5252
} else {
53-
QScreen *screen = QGuiApplication::primaryScreen();
54-
QRect screenGeometry = screen->geometry();
55-
int x = screenGeometry.width() * .8;
56-
int y = screenGeometry.height() * .8;
53+
int x = screensize().width() * .8;
54+
int y = screensize().height() * .8;
5755
this->resize(x, y);
5856
}
5957

@@ -71,6 +69,7 @@ CoreBox::~CoreBox() {
7169

7270
void CoreBox::tabEngine(AppsName i, QString arg) {
7371
int n = ui->windows->count();
72+
qDebug()<<n;
7473

7574
switch (i) {
7675
case CoreFM: {
@@ -226,39 +225,6 @@ void CoreBox::tabEngine(AppsName i, QString arg) {
226225
default:
227226
break;
228227
}
229-
if (i == CoreFM) {
230-
231-
} else if (i == CoreImage) {
232-
233-
} else if (i == CorePad) {
234-
235-
} else if (i == CorePaint) {
236-
237-
} else if (i == CorePlayer) {
238-
239-
} else if (i == Dashboard) {
240-
241-
} else if (i == Bookmarks) {
242-
243-
} else if (i == About) {
244-
245-
} else if (i == StartView) {
246-
247-
} else if (i == Help) {
248-
249-
} else if (i == Settings) {
250-
251-
} else if (i == Search) {
252-
253-
} else if (i == CoreTime) {
254-
255-
} else if (i == Corebox) {
256-
257-
} else if (i == CorePDF) {
258-
259-
} else {
260-
261-
}
262228
}
263229

264230
void CoreBox::on_windows_tabCloseRequested(int index)

corebox/globalfunctions.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#include "globalfunctions.h"
1+
#include "globalfunctions.h"
22
#include "corebox.h"
33

44
#include <QProcess>
55
#include <QDebug>
66

7+
78
bool moveToTrash(QString fileName)
89
{
910
if (getfilesize(fileName) >= 1073741824) {
@@ -99,10 +100,8 @@ void messageEngine(QString message, QString messageType)
99100
mbox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
100101
mbox->show();
101102

102-
QScreen *screen = QGuiApplication::primaryScreen();
103-
QRect screenGeometry = screen->geometry();
104-
int x = screenGeometry.width() - (mbox->width() + 20);
105-
int y = screenGeometry.height() - (mbox->height() + 40);
103+
int x = screensize().width() - (mbox->width() + 20);
104+
int y = screensize().height() - (mbox->height() + 40);
106105

107106
mbox->move(x,y);
108107
QTimer::singleShot(3000, mbox, SLOT(close()));
@@ -235,6 +234,7 @@ QString getMultipleFileSize(QStringList paths)
235234
}
236235

237236
void openAppEngine(QString path){
237+
238238
CoreBox *cBox = qobject_cast<CoreBox*>(qApp->activeWindow());
239239
QFileInfo info(path);
240240
if(!info.exists() && !path.isEmpty()){
@@ -297,3 +297,8 @@ QString checkIsValidFile(QString str) {
297297
}
298298
return NULL;
299299
}
300+
301+
QRect screensize(){
302+
QScreen * screen = QGuiApplication::primaryScreen();
303+
return screen->geometry();
304+
}

corebox/globalfunctions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ enum AppsName {
4040
void messageEngine(QString message, QString messageType);
4141
void openAppEngine(QString path);
4242

43+
QRect screensize();
44+
4345
AppsName nameToInt(QString appName);
4446
QString appsIconPath(QString appName);
4547

corefm/corefm.cpp

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -438,43 +438,22 @@ void corefm::listSelectionChanged(const QItemSelection selected, const QItemSele
438438

439439
curIndex = modelList->filePath(modelView->mapToSource(listSelectionModel->currentIndex()));
440440

441-
441+
QStringList li;
442+
foreach (QModelIndex item, listSelectionModel->selectedIndexes()) {
443+
li.append(modelList->filePath(modelView->mapToSource(item)));
444+
}
442445

443446
if (selcitem == 1) {
444447
ui->name->setText(curIndex.fileName());
448+
ui->size->setText(formatSize(curIndex.size()));
445449
selcitempath = curIndex.absoluteFilePath();
446-
} else {
450+
}else {
447451
ui->name->setText(ui->pathEdit->currentText());
452+
ui->size->setText(formatSize(getmultiplefilesize(li)));
448453
selcitempath = ui->pathEdit->itemText(0);
449454
}
450455

451-
QStringList li;
452-
foreach (QModelIndex item, listSelectionModel->selectedIndexes()) {
453-
li.append(modelList->filePath(modelView->mapToSource(item)));
454-
}
455-
456-
ui->size->setText(formatSize(getmultiplefilesize(li)));
457-
//ui->name->setText(curIndex.fileName());
458456
ui->selecteditem->setText("Selected : " + QString("%1 items").arg(items.count()));
459-
460-
//for multipal file size
461-
// QModelIndexList selList;
462-
// if(focusWidget() == ui->viewlist || focusWidget() == ui->viewtree){
463-
// if(listSelectionModel->selectedRows(0).count()) selList = listSelectionModel->selectedRows(0);
464-
// else selList = listSelectionModel->selectedIndexes();
465-
// }
466-
467-
// if(selList.count() == 0) selList << modelView->mapFromSource(modelList->index(ui->pathEdit->currentText()));
468-
469-
// QStringList paths;
470-
471-
// foreach(QModelIndex item, selList)container
472-
// paths.append(modelList->filePath(modelView->mapToSource(item)));
473-
474-
// qDebug()<< paths;
475-
// qDebug()<< modelList;
476-
477-
478457
}
479458

480459
void corefm::listItemClicked(QModelIndex current)
@@ -1907,9 +1886,11 @@ void corefm::executeFile(QModelIndex index, bool run) {
19071886

19081887
// Run or open
19091888
if (run) {
1889+
qDebug()<< "gn";
19101890
QProcess *myProcess = new QProcess(this);
19111891
myProcess->startDetached(modelList->filePath(srcIndex));
19121892
} else {
1893+
qDebug()<< modelList->fileInfo(srcIndex);
19131894
mimeUtils->openInApp(modelList->fileInfo(srcIndex), this);
19141895
}
19151896
}

corefm/corefm.ui

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>1017</width>
9+
<width>1056</width>
1010
<height>515</height>
1111
</rect>
1212
</property>
@@ -35,6 +35,12 @@
3535
</property>
3636
<item row="1" column="1" colspan="2">
3737
<widget class="QFrame" name="tools">
38+
<property name="sizePolicy">
39+
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
40+
<horstretch>0</horstretch>
41+
<verstretch>0</verstretch>
42+
</sizepolicy>
43+
</property>
3844
<property name="minimumSize">
3945
<size>
4046
<width>0</width>
@@ -80,6 +86,12 @@ color: #ffffff;
8086
</property>
8187
<item>
8288
<widget class="QToolButton" name="cut">
89+
<property name="sizePolicy">
90+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
91+
<horstretch>0</horstretch>
92+
<verstretch>0</verstretch>
93+
</sizepolicy>
94+
</property>
8395
<property name="minimumSize">
8496
<size>
8597
<width>0</width>
@@ -122,6 +134,12 @@ background-color: rgb(48, 140, 198);
122134
</item>
123135
<item>
124136
<widget class="QToolButton" name="copy">
137+
<property name="sizePolicy">
138+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
139+
<horstretch>0</horstretch>
140+
<verstretch>0</verstretch>
141+
</sizepolicy>
142+
</property>
125143
<property name="minimumSize">
126144
<size>
127145
<width>0</width>
@@ -164,6 +182,12 @@ background-color: rgb(48, 140, 198);
164182
</item>
165183
<item>
166184
<widget class="QToolButton" name="deleteit">
185+
<property name="sizePolicy">
186+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
187+
<horstretch>0</horstretch>
188+
<verstretch>0</verstretch>
189+
</sizepolicy>
190+
</property>
167191
<property name="minimumSize">
168192
<size>
169193
<width>0</width>
@@ -206,6 +230,12 @@ background-color: rgb(48, 140, 198);
206230
</item>
207231
<item>
208232
<widget class="QToolButton" name="properties">
233+
<property name="sizePolicy">
234+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
235+
<horstretch>0</horstretch>
236+
<verstretch>0</verstretch>
237+
</sizepolicy>
238+
</property>
209239
<property name="minimumSize">
210240
<size>
211241
<width>0</width>
@@ -264,6 +294,12 @@ background-color: rgb(48, 140, 198);
264294
</item>
265295
<item>
266296
<widget class="QPushButton" name="showHidden">
297+
<property name="sizePolicy">
298+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
299+
<horstretch>0</horstretch>
300+
<verstretch>0</verstretch>
301+
</sizepolicy>
302+
</property>
267303
<property name="minimumSize">
268304
<size>
269305
<width>0</width>
@@ -301,6 +337,12 @@ background-color:rgb(48, 140, 198);
301337
</item>
302338
<item>
303339
<widget class="QPushButton" name="showthumb">
340+
<property name="sizePolicy">
341+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
342+
<horstretch>0</horstretch>
343+
<verstretch>0</verstretch>
344+
</sizepolicy>
345+
</property>
304346
<property name="minimumSize">
305347
<size>
306348
<width>0</width>
@@ -1492,7 +1534,7 @@ color:#000000;
14921534
</property>
14931535
<property name="styleSheet">
14941536
<string notr="true">QListView {
1495-
padding: 5px 5px 0px 5px;
1537+
padding: 10px 5px 0px 0px;
14961538
}
14971539

14981540
QListView::item:selected {
@@ -2248,14 +2290,14 @@ border: 1px #F2F2F2;
22482290
<item>
22492291
<widget class="QLabel" name="name">
22502292
<property name="text">
2251-
<string>name</string>
2293+
<string/>
22522294
</property>
22532295
</widget>
22542296
</item>
22552297
<item>
22562298
<widget class="QLabel" name="size">
22572299
<property name="text">
2258-
<string>size</string>
2300+
<string/>
22592301
</property>
22602302
</widget>
22612303
</item>

coreimage/coreimage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ coreimage::coreimage(QWidget *parent) :QWidget(parent),ui(new Ui::coreimage)
4747
ui->scrollArea->setBackgroundRole(QPalette::Dark);
4848
ui->scrollArea->setStyleSheet("background-color:rgb(0,0,0);");
4949

50-
ui->tools->setVisible(false);
50+
ui->shortcut->setVisible(false);
5151
ui->propbox->setVisible(false);
5252
ui->thumnailView->setVisible(false);
5353

5454
if(currentImagePath.isNull()){
55-
for (QPushButton *b : ui->tools->findChildren<QPushButton*>()){
55+
for (QPushButton *b : ui->shortcut->findChildren<QPushButton*>()){
5656
b->setEnabled(false);
5757
}
5858

@@ -161,7 +161,7 @@ bool coreimage::loadFile(const QString &fileName)
161161
setImage(newImage);
162162
setWindowFilePath(fileName);
163163

164-
for (QPushButton *b : ui->tools->findChildren<QPushButton*>()){
164+
for (QPushButton *b : ui->shortcut->findChildren<QPushButton*>()){
165165
b->setEnabled(true);
166166
}
167167

@@ -369,10 +369,10 @@ void coreimage::on_cSaveAs_clicked()
369369
void coreimage::on_cTools_clicked(bool checked)
370370
{
371371
if(checked){
372-
ui->tools->setVisible(true);
372+
ui->shortcut->setVisible(true);
373373
}
374374
else{
375-
ui->tools->setVisible(false);
375+
ui->shortcut->setVisible(false);
376376
}
377377
}
378378

@@ -423,7 +423,7 @@ void coreimage::on_slideShow_clicked(bool checked)
423423
}
424424
ui->scrollArea->showFullScreen();
425425
slideShowTimer->start(3000);
426-
ui->tools->setVisible(false);
426+
ui->shortcut->setVisible(false);
427427
}
428428
else {
429429
if(slideShowTimer) {

coreimage/coreimage.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<number>0</number>
3535
</property>
3636
<item>
37-
<widget class="QWidget" name="tools" native="true">
37+
<widget class="QWidget" name="shortcut" native="true">
3838
<property name="sizePolicy">
3939
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
4040
<horstretch>0</horstretch>

0 commit comments

Comments
 (0)