diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-01 12:47:19 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-01 12:48:14 -0400 |
commit | ccea2e1130bf1cf54aea58528a493aacadbeda13 (patch) | |
tree | 69681284ad5e26e81a60c874c240c1d1f4211fa9 /src-qt5/desktop-utils/lumina-fileinfo | |
parent | Fix up some whitespace in luminaxdg.cpp (diff) | |
download | lumina-ccea2e1130bf1cf54aea58528a493aacadbeda13.tar.gz lumina-ccea2e1130bf1cf54aea58528a493aacadbeda13.tar.bz2 lumina-ccea2e1130bf1cf54aea58528a493aacadbeda13.zip |
Start working on fixing up lumina-fileinfo
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 28 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.h | 11 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui | 132 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/main.cpp | 23 |
4 files changed, 137 insertions, 57 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index c712afed..0247e011 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp @@ -15,15 +15,13 @@ #include <LUtils.h> #include <LuminaOS.h> -//LFileInfo INFO = LFileInfo(""); - MainUI::MainUI() : QDialog(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer form canwrite = false; terminate_thread = false; + INFO = new LFileInfo(); UpdateIcons(); //Set all the icons in the dialog SetupConnections(); - INFO = 0; } MainUI::~MainUI(){ @@ -80,7 +78,7 @@ void MainUI::LoadFile(QString path, QString type){ else{ ftype = INFO->suffix().toUpper(); } if(INFO->isHidden()){ ftype = QString(tr("Hidden %1")).arg(type); } ui->label_file_type->setText(ftype); - + //Now load the icon for the file if(INFO->isImage()){ QPixmap pix(INFO->absoluteFilePath()); @@ -159,18 +157,20 @@ void MainUI::LoadFile(QString path, QString type){ } void MainUI::UpdateIcons(){ - this->setWindowIcon(LXDG::findIcon("document-preview","unknown")); - ui->push_close->setIcon( LXDG::findIcon("dialog-close","") ); - ui->push_save->setIcon( LXDG::findIcon("document-save","") ); - ui->tool_xdg_getCommand->setIcon( LXDG::findIcon("edit-find-page","") ); - ui->tool_xdg_getDir->setIcon( LXDG::findIcon("document-open","") ); + } //============== // PRIVATE //============== void MainUI::ReloadAppIcon(){ - ui->push_xdg_getIcon->setIcon( LXDG::findIcon(ui->push_xdg_getIcon->whatsThis(),"") ); + //qDebug() << "Reload App Icon:"; + ui->label_xdg_icon->setPixmap( LXDG::findIcon(ui->line_xdg_icon->text(),"").pixmap(64,64) ); + //qDebug() << "Check Desktop File entry"; + if(INFO->iconfile()!=ui->line_xdg_icon->text()){ + xdgvaluechanged(); + } + //qDebug() << "Done with app icon"; } void MainUI::GetDirSize(const QString dirname) const { @@ -225,6 +225,7 @@ void MainUI::GetDirSize(const QString dirname) const { void MainUI::SetupConnections(){ connect(ui->line_xdg_command, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) ); connect(ui->line_xdg_comment, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) ); + connect(ui->line_xdg_icon, SIGNAL(textChanged(QString)), this, SLOT(ReloadAppIcon()) ); connect(ui->tool_xdg_getCommand, SIGNAL(clicked()), this, SLOT(getXdgCommand()) ); connect(ui->line_xdg_name, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) ); connect(ui->line_xdg_wdir, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) ); @@ -262,7 +263,7 @@ void MainUI::on_push_save_clicked(){ XDG->name = ui->line_xdg_name->text(); XDG->genericName = ui->line_xdg_name->text().toLower(); XDG->comment = ui->line_xdg_comment->text(); - XDG->icon = ui->push_xdg_getIcon->whatsThis(); + XDG->icon = ui->line_xdg_icon->text(); //Now do the type-specific fields if(XDG->type == XDGDesktop::APP){ XDG->exec = ui->line_xdg_command->text(); @@ -321,14 +322,15 @@ void MainUI::on_push_xdg_getIcon_clicked(){ for(int i=0; i<ext.length(); i++){ ext[i].prepend("*."); } //turn them into valid filters QString file = QFileDialog::getOpenFileName(this, tr("Select an icon"), dir ,QString(tr("Images (%1);; All Files (*)")).arg(ext.join(" ")) ); if(file.isEmpty()){ return; } //cancelled - ui->push_xdg_getIcon->setWhatsThis(file); + ui->line_xdg_icon->setText(file); ReloadAppIcon(); xdgvaluechanged(); } //XDG Value Changed void MainUI::xdgvaluechanged(){ - if(INFO!=0 && (INFO->isDesktopFile() || INFO->filePath().isEmpty() ) ){ + //qDebug() << "xdgvaluechanged"; + if( INFO->isDesktopFile() || INFO->filePath().isEmpty() ){ ui->push_save->setVisible(true); //Compare the current UI values to the file values ui->push_save->setEnabled(canwrite); //assume changed at this point diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h index 8cac813c..089dbe6c 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h @@ -33,18 +33,17 @@ public: public slots: void UpdateIcons(); - + void ReloadAppIcon(); private: Ui::MainUI *ui; LFileInfo *INFO; - LVideoSurface *surface; - QMediaPlayer *player; - bool flag; - QElapsedTimer timer; + LVideoSurface *surface; + QMediaPlayer *player; + bool flag; + QElapsedTimer timer; bool canwrite; bool terminate_thread; //flag for terminating the GetDirSize task - void ReloadAppIcon(); void GetDirSize(const QString dirname) const; //function to get folder size signals: diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui index 51657ba1..d3b88b28 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui @@ -6,13 +6,22 @@ <rect> <x>0</x> <y>0</y> - <width>349</width> - <height>354</height> + <width>535</width> + <height>580</height> </rect> </property> + <property name="sizeIncrement"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> <property name="windowTitle"> <string>File Information</string> </property> + <property name="windowIcon"> + <iconset theme="document-preview"/> + </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabWidget"> @@ -307,9 +316,24 @@ </item> <item row="2" column="2"> <widget class="QToolButton" name="tool_xdg_getCommand"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>42</height> + </size> + </property> <property name="text"> <string notr="true"/> </property> + <property name="icon"> + <iconset theme="edit-find"/> + </property> </widget> </item> <item row="3" column="2"> @@ -317,47 +341,107 @@ <property name="enabled"> <bool>true</bool> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>42</height> + </size> + </property> <property name="text"> <string notr="true"/> </property> + <property name="icon"> + <iconset theme="edit-find"/> + </property> </widget> </item> <item row="4" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QToolButton" name="push_xdg_getIcon"> - <property name="maximumSize"> + <widget class="QLabel" name="label_xdg_icon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> <size> - <width>275</width> - <height>16777215</height> + <width>64</width> + <height>64</height> </size> </property> - <property name="text"> - <string>No Icon</string> - </property> - <property name="iconSize"> + <property name="maximumSize"> <size> <width>64</width> <height>64</height> </size> </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="text"> + <string notr="true"/> + </property> </widget> </item> <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + <widget class="QLineEdit" name="line_xdg_icon"/> </item> </layout> </item> + <item row="4" column="2"> + <widget class="QToolButton" name="push_xdg_getIcon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20000</width> + <height>42</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>2</width> + <height>2</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string notr="true"/> + </property> + <property name="icon"> + <iconset theme="edit-find"/> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> + </item> </layout> </item> <item> @@ -391,6 +475,9 @@ <property name="text"> <string>Save</string> </property> + <property name="icon"> + <iconset theme="document-save"/> + </property> <property name="popupMode"> <enum>QToolButton::InstantPopup</enum> </property> @@ -404,6 +491,9 @@ <property name="text"> <string>Close</string> </property> + <property name="icon"> + <iconset theme="dialog-close"/> + </property> <property name="popupMode"> <enum>QToolButton::DelayedPopup</enum> </property> diff --git a/src-qt5/desktop-utils/lumina-fileinfo/main.cpp b/src-qt5/desktop-utils/lumina-fileinfo/main.cpp index a602f290..463f856a 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/main.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/main.cpp @@ -11,36 +11,25 @@ int main(int argc, char ** argv) { LTHEME::LoadCustomEnvSettings(); QApplication a(argc, argv); - a.setAttribute(Qt::AA_UseHighDpiPixmaps); + a.setAttribute(Qt::AA_UseHighDpiPixmaps); LUtils::LoadTranslation(&a, "l-fileinfo"); - //LuminaThemeEngine theme(&a); //Read the input variables QString path = ""; QString flag = ""; for(int i=1; i<argc; i++){ - if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); } + QString tmp(argv[i]); + if( tmp=="-application" ){ flag = "APP"; } + else if( tmp=="-link" ){ flag = "APP"; } else{ path = QString(argv[i]); break; } } //Check the input variables // - path if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); } - // - flag - if(!flag.isEmpty()){ - if(flag=="-application"){ - flag = "APP"; //for internal use - }else if(flag=="-link"){ - flag = "LINK"; //for internal use - }else{ - //Invalid flag - clear the path as well - flag.clear(); - path.clear(); - } - } - if(!path.isEmpty() || !flag.isEmpty()){ + + if(!path.isEmpty() || !flag.isEmpty()){ MainUI w; - //QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) ); w.LoadFile(path, flag); w.show(); int retCode = a.exec(); |