[PC-BSD Commits] r17726 - in pcbsd-projects/PCDM: . images
svn at pcbsd.org
svn at pcbsd.org
Fri Jul 13 22:11:38 PDT 2012
Author: kenmoore
Date: 2012-07-14 05:11:38 +0000 (Sat, 14 Jul 2012)
New Revision: 17726
Modified:
pcbsd-projects/PCDM/images/system.png
pcbsd-projects/PCDM/pcdm-gui.cpp
pcbsd-projects/PCDM/pcdm-gui.h
pcbsd-projects/PCDM/pcdm-themes.cpp
pcbsd-projects/PCDM/pcdm-themes.h
pcbsd-projects/PCDM/sample.pcdm-theme
Log:
Fix the PCDM GUI to now support spacers, and fix the toolbar to properly display
Modified: pcbsd-projects/PCDM/images/system.png
===================================================================
(Binary files differ)
Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp 2012-07-13 19:44:38 UTC (rev 17725)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp 2012-07-14 05:11:38 UTC (rev 17726)
@@ -30,32 +30,48 @@
//Create the Toolbar
toolbar = new QToolBar();
- //Put it in the proper location
+ //Add the Toolbar to the window
this->addToolBar( Theme::toolbarLocation(), toolbar ); //use the theme location
- //toolbar->setMovable(FALSE);
+ toolbar->setVisible(TRUE);
+ toolbar->setMovable(FALSE);
toolbar->setFloatable(FALSE);
//Set the default style and icon sizes
toolbar->setToolButtonStyle( Theme::toolbarStyle() ); //use the theme style
toolbar->setIconSize( QSize(Theme::toolbarSizeWidth(),Theme::toolbarSizeHeight()) ); //use theme size
-
- //Populate the Toolbar with items
+
+ //Populate the Toolbar with items (starts at leftmost/topmost)
+ //----Virtual Keyboard
+ QAction* virtkeyboardButton = new QAction( QIcon(Theme::objectIconPath("virt-keyboard")),tr("Keyboard"),this );
+ toolbar->addAction(virtkeyboardButton);
+ connect( virtkeyboardButton, SIGNAL(triggered()), this, SLOT(slotPushVirtKeyboard()) );
+ virtkeyboardButton->setToolTip(tr("Virtual Keyboard"));
//----Locale Switcher
- qDebug() << "PCDM: Locale switcher not implemented yet";
+ QAction* localeButton = new QAction( QIcon(Theme::objectIconPath("locale")),tr("Locale"),this );
+ toolbar->addAction(localeButton);
+ connect( localeButton, SIGNAL(triggered()), this, SLOT(slotChangeLocale()) );
+ localeButton->setToolTip(tr("Change locale"));
//----Keyboard Layout Switcher
- qDebug() << "PCDM: Keyboard switcher not implemented yet";
+ QAction* keyboardButton = new QAction( QIcon(Theme::objectIconPath("keyboard")),tr("Keyboard Layout"),this );
+ toolbar->addAction(keyboardButton);
+ connect( keyboardButton, SIGNAL(triggered()), this, SLOT(slotChangeKeyboardLayout()) );
+ keyboardButton->setToolTip(tr("Change Keyboard Layout"));
+ //----Add a spacer
+ QWidget* spacer = new QWidget();
+ spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ toolbar->addWidget(spacer);
+
//----System Shutdown/Restart
- QToolButton* systemButton = new QToolButton(toolbar);
+ QAction* systemButton = new QAction( QIcon(Theme::objectIconPath("system")),tr("System"),this );
systemMenu = new QMenu();
systemMenu->addAction( tr("Restart"),this, SLOT(slotRestartComputer()) );
systemMenu->addAction( tr("Shut Down"), this, SLOT(slotShutdownComputer()) );
if(DEBUG_MODE){systemMenu->addAction( tr("Close PCDM"), this, SLOT(slotClosePCDM()) ); }
systemButton->setMenu(systemMenu);
- systemButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ toolbar->addAction(systemButton);
+ connect( systemButton, SIGNAL(triggered()), this, SLOT(slotShutdownComputer()) );
-
//Create the grid layout
QGridLayout* grid = new QGridLayout;
-
//Populate the grid with items
//----Header Image
QString hLayout = Theme::objectIconStyle("header");
@@ -165,15 +181,23 @@
Theme::objectLocationRowSpan("desktop"), \
Theme::objectLocationColumnSpan("desktop"), Qt::AlignCenter);
}
+ //----WINDOW SPACERS
+ QStringList spacers = Theme::getSpacers();
+ for(int i=0; i<spacers.length(); i++){
+ QString type = spacers[i].section("::",0,0);
+ int row = spacers[i].section("::",1,1).toInt();
+ int col = spacers[i].section("::",2,2).toInt();
+ if(type =="vertical"){
+ grid->setRowStretch(row,1);
+ }else{ //horizontal
+ grid->setColumnStretch(col,1);
+ }
+ }
//Connect the grid to the Window
- //qDebug() << "Creating Widget";
- QWidget* widget = new QWidget;
- //qDebug() << "Adding the grid to the widget";
- widget->setLayout(grid);
- //qDebug() << "Setting the widget as the central widget in the mainwindow";
- this->setCentralWidget(widget);
-
+ QWidget* widget = new QWidget;
+ widget->setLayout(grid);
+ this->setCentralWidget(widget);
//Connect all the buttons to their proper slots
}
@@ -183,16 +207,24 @@
}
void PCDMgui::slotRestartComputer(){
- qDebug() << "PCDM: Restart COmputer not implemented yet";
+ qDebug() << "PCDM: Restart Computer not implemented yet";
}
void PCDMgui::slotClosePCDM(){
+ system("killall -9 xvkbd"); //be sure to close the virtual keyboard
close();
}
+void PCDMgui::slotChangeLocale(){
+ qDebug() << "PCDM: Changing of Locale is not implemented yet";
+}
+
+void PCDMgui::slotChangeKeyboardLayout(){
+ qDebug() << "PCDM: Changing the keyboard layout is not implemented yet";
+}
+
// Start xvkbd
-void PCDMgui::slotPushVirtKeyboard()
-{
+void PCDMgui::slotPushVirtKeyboard(){
system("killall -9 xvkbd; xvkbd -compact &");
}
Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h 2012-07-13 19:44:38 UTC (rev 17725)
+++ pcbsd-projects/PCDM/pcdm-gui.h 2012-07-14 05:11:38 UTC (rev 17726)
@@ -14,6 +14,8 @@
#include <QPushButton>
#include <QLineEdit>
#include <QGridLayout>
+#include <QX11EmbedContainer>
+#include <QSpacerItem>
#include "pcdm-backend.h"
#include "pcdm-themes.h"
@@ -32,8 +34,9 @@
void slotRestartComputer();
void slotShutdownComputer();
void slotClosePCDM();
- // Start xvkbd
- void slotPushVirtKeyboard();
+ void slotChangeLocale();
+ void slotChangeKeyboardLayout();
+ void slotPushVirtKeyboard(); // Start xvkbd
private:
//Objects
@@ -41,6 +44,8 @@
QMenu* systemMenu;
QComboBox* unameline,deSwitcher;
QLineEdit* pwline;
+ QX11EmbedContainer* container;
+ QProcess* vkbd;
//Functions
void createGUIfromTheme();
Modified: pcbsd-projects/PCDM/pcdm-themes.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-themes.cpp 2012-07-13 19:44:38 UTC (rev 17725)
+++ pcbsd-projects/PCDM/pcdm-themes.cpp 2012-07-14 05:11:38 UTC (rev 17726)
@@ -1,20 +1,20 @@
#include "pcdm-themes.h"
//Setup variables that save the current theme data
-QStringList images, imSizes, imLayout, gridLayout, tbFormat, validLayouts, needText, objStruct;
+QStringList images, imSizes, imLayout, gridLayout, tbFormat, validLayouts, needText, objStruct, spacers;
bool fullscreenWindow;
int wWidth, wHeight, gridWidth, gridHeight;
//Create the functions to read and output the theme data
void Theme::loadDefaults(QString vars){
if( vars=="all" ){
- validLayouts << "above" << "below" << "left" << "right" << "none" << "icononly";
+ validLayouts << "above" << "below" << "left" << "right" << "disabled" << "icononly";
needText << "user" << "password" << "login";
objStruct << "header" << "background" << "splashscreen" << "user" << "password" << "login" << "keyboard" << "locale" << "system" << "desktop" << "virt-keyboard";
}
if( (vars=="all") || (vars=="window") ){
//Main Window Setup
- fullscreenWindow=FALSE;
+ fullscreenWindow=TRUE;
wWidth=800;
wHeight=600;
}
@@ -27,32 +27,38 @@
images <<":images/user.png"; imSizes << "32x32"; // [3]=User
images <<":images/password.png"; imSizes << "32x32"; // [4]=Password
images <<":images/next.png"; imSizes << "15x15"; // [5]=Login
- images <<":images/input-keyboard.png"; imSizes << "32x32"; // [6]=Keyboard Layout
+ images <<":images/keyboard.png"; imSizes << "32x32"; // [6]=Keyboard Layout
images <<":images/language.png"; imSizes << "32x32"; // [7]=Locale
images <<":images/system.png"; imSizes << "32x32"; // [8]=System
images <<":images/desktop.png"; imSizes << "32x32"; // [9]=Desktop
- images <<":images/keyboard.png"; imSizes << "32x32"; // [10]=Virtual Keyboard
+ images <<":images/input-keyboard.png"; imSizes << "32x32"; // [10]=Virtual Keyboard
}
if( (vars=="all") || (vars=="layout") ){
gridWidth=5; gridHeight=6;
//Default Layout for the application (row x column)
imLayout.clear(); gridLayout.clear();
- imLayout << "icononly"; gridLayout << "0x0"; // [0]=Header
+ imLayout << "icononly"; gridLayout << "0x0-2"; // [0]=Header
imLayout << "icononly"; gridLayout << ""; // [1]=Background
imLayout << "icononly"; gridLayout << ""; // [2]=Splash Screen
- imLayout << "left"; gridLayout << "2x0"; // [3]=User
- imLayout << "left"; gridLayout << "3x0"; // [4]=Password
- imLayout << "disabled"; gridLayout << "4x0"; // [5]=Login
+ imLayout << "left"; gridLayout << "2x1"; // [3]=User
+ imLayout << "left"; gridLayout << "3x1"; // [4]=Password
+ imLayout << "disabled"; gridLayout << "4x1"; // [5]=Login
imLayout << "icononly"; gridLayout << ""; // [6]=Keyboard Layout
imLayout << "icononly"; gridLayout << ""; // [7]=Locale
imLayout << "icononly"; gridLayout << ""; // [8]=System
- imLayout << "left"; gridLayout << "6x0"; // [9]=Desktop
+ imLayout << "left"; gridLayout << "6x1"; // [9]=Desktop
imLayout << "icononly"; gridLayout << ""; // [10]=Virtual Keyboard
+ spacers.clear();
+ spacers << "vertical::1::1"; //vertical spacer at row 1, column 1
+ spacers << "vertical::5::1"; //vertical spacer at row 5, column 1
+ spacers << "horizontal::0::0"; //horizontal spacer at row 2, column 0
+ spacers << "horizontal::0::2"; //horizontal spacer at row 2, column 2
+
}
if( (vars=="all") || (vars=="toolbar") ){
tbFormat.clear();
- tbFormat << "bottom"; // [0] Location [bottom | top | left | right]
- tbFormat << "icononly"; // [1] Style [icononly | textonly | textbeside | textunder]
+ tbFormat << "top"; // [0] Location [bottom | top | left | right]
+ tbFormat << "textbeside"; // [1] Style [icononly | textonly | textbeside | textunder]
tbFormat << "32"; // [2] Width in pixels
tbFormat << "32"; // [3] Height in pixels
}
@@ -121,6 +127,7 @@
int i = getObjectIndex(obj);
bool invalid = FALSE;
QString output = imLayout[i].toLower();
+ if(output=="none"){ output="disabled"; }
if( (output=="icononly") && needText.contains(obj) ){ invalid=TRUE; }
if(!validLayouts.contains(output) || invalid){
qDebug() << "PCDM: Invalid layout detected for" << obj << "- defaulting to \"left\"";
@@ -183,6 +190,9 @@
return colSpan;
}
+QStringList Theme::getSpacers(){
+ return spacers;
+}
//********** SPLASH SCREEN ***********
bool Theme::useSplashscreen(){
Modified: pcbsd-projects/PCDM/pcdm-themes.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-themes.h 2012-07-13 19:44:38 UTC (rev 17725)
+++ pcbsd-projects/PCDM/pcdm-themes.h 2012-07-14 05:11:38 UTC (rev 17726)
@@ -29,6 +29,7 @@
static int objectLocationColumn(QString);
static int objectLocationRowSpan(QString);
static int objectLocationColumnSpan(QString);
+ static QStringList getSpacers();
//Splash Screen
static QString splashscreen();
static bool useSplashscreen();
Modified: pcbsd-projects/PCDM/sample.pcdm-theme
===================================================================
--- pcbsd-projects/PCDM/sample.pcdm-theme 2012-07-13 19:44:38 UTC (rev 17725)
+++ pcbsd-projects/PCDM/sample.pcdm-theme 2012-07-14 05:11:38 UTC (rev 17726)
@@ -41,6 +41,11 @@
WINDOW_ITEM=desktop::above::[6,1] #(required) Desktop environment switcher
DE_SELECT_IMAGE=default-de-select.png # (required) Default image for the DE selection pulldown
+ WINDOW_ITEM=spacer::vertical::[1,1] #Add a vertical spacer between the header and user
+ WINDOW_ITEM=spacer::vertical::[5,1] #Add a vertical spacer between the desktop and login
+ WINDOW_ITEM=spacer::horizontal::[3,0] #Add a horizontal spacer to the left of the user
+ WINDOW_ITEM=spacer::horizontal::[3,2] #Add a horizontal spacer to the right of the user
+
# ADD TOOLBAR ITEMS
WINDOW_TOOLBAR_LOCATION=bottom # [bottom,top,left,right]
TOOLBAR_DEFAULT_SIZE=32x32 # Set the default size for all images in the toolbar
More information about the Commits
mailing list