summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp7
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--core/settings/launcher/tabconfig.h1
-rw-r--r--core/settings/launcher/tabdialog.cpp1
-rw-r--r--core/settings/launcher/tabssettings.cpp6
5 files changed, 15 insertions, 2 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 4f81076..4255b44 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -370,96 +370,103 @@ void LauncherTabWidget::setBusy(bool on)
}
}
}
void LauncherTabWidget::setBusyIndicatorType( const QString& str ) {
for (int i = 0; i < categoryBar->count(); i++ ) {
LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view;
view->setBusyIndicatorType( str );
}
}
LauncherView *LauncherTabWidget::currentView(void)
{
return (LauncherView*)stack->visibleWidget();
}
void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "setTabView(QString,int)" ) {
QString id;
stream >> id;
int mode;
stream >> mode;
if ( view(id) )
view(id)->setViewMode( (LauncherView::ViewMode)mode );
} else if ( msg == "setTabBackground(QString,int,QString)" ) {
QString id;
stream >> id;
int mode;
stream >> mode;
QString pixmapOrColor;
stream >> pixmapOrColor;
if ( view(id) )
view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
if ( id == "Documents" )
docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
} else if ( msg == "setTextColor(QString,QString)" ) {
QString id;
stream >> id;
QString color;
stream >> color;
if ( view(id) )
view(id)->setTextColor( QColor(color) );
if ( id == "Documents" )
docLoadingWidget->setTextColor( QColor(color) );
+ } else if ( msg == "setIconColumns(QString,int)" ) {
+ QString id;
+ stream >> id;
+ int number;
+ stream >> number;
+ if ( view(id ) )
+ view(id)->setColNumber( number );
} else if ( msg == "setFont(QString,QString,int,int,int)" ) {
QString id;
stream >> id;
QString fam;
stream >> fam;
int size;
stream >> size;
int weight;
stream >> weight;
int italic;
stream >> italic;
if ( view(id) ) {
if ( !fam.isEmpty() ) {
view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
} else {
view(id)->clearViewFont();
}
}
}else if ( msg == "setBusyIndicatorType(QString)" ) {
QString type;
stream >> type;
setBusyIndicatorType( type );
}else if ( msg == "home()" ) {
if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) {
if (categoryBar)
categoryBar->nextTab();
}else {
static_cast<QWidget*>(parent())->raise();
}
} else if (msg=="doctabEnabled(int)") {
int id; stream >> id;
odebug << "Doctab enabled " << id << oendl;
reCheckDoctab(id);
}
}
void LauncherTabWidget::reCheckDoctab(int how)
{
if ((bool)how == docTabEnabled) {
/* nothing to do */
return;
}
if (docLoadingWidget) {
stack->removeWidget(docLoadingWidget);
delete docLoadingWidget;
docLoadingWidget = 0;
}
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 9d78c0d..2b34cc5 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -594,97 +594,97 @@ void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink)
}
addItem(nlink,false);
}
void LauncherIconView::timerEvent( QTimerEvent *te )
{
if ( te->timerId() == busyTimer ) {
if ( bsy )
bsy->animateIcon();
} else {
QIconView::timerEvent( te );
}
}
void LauncherIconView::setBigIcons( bool bi )
{
sm_EyeCache->clear();
bigIcns = bi;
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
busyPix.resize(0,0);
#endif
}
QIconViewItem* LauncherIconView::busyItem() const
{
return bsy;
}
void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
void LauncherIconView::calculateGrid( ItemTextPos pos )
{
int dw = QApplication::desktop()->width();
int viewerWidth = dw-style().scrollBarExtent().width();
if ( pos == Bottom ) {
if( !numColumns ) {
if ( viewerWidth <= 200 ) numColumns = 2;
else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96;
else numColumns = 3;
}
setSpacing( 4 );
setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
setGridY( fontMetrics().height()*2+24 );
} else {
if( !numColumns ) {
if ( viewerWidth < 150 ) numColumns = 1;
else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150;
else numColumns = 2;
- }
+ }
setSpacing( 2 );
setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
setGridY( fontMetrics().height()+2 );
}
}
void LauncherIconView::styleChange( QStyle &old )
{
QIconView::styleChange( old );
calculateGrid( itemTextPos() );
}
void LauncherIconView::keyPressEvent(QKeyEvent* e)
{
ike = TRUE;
if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
if ( (e->state() & ShiftButton) )
emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
else
returnPressed(currentItem());
}
QIconView::keyPressEvent(e);
ike = FALSE;
}
//===========================================================================
// Implemantation of LauncherIconview end
//===========================================================================
//===========================================================================
LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
: QVBox( parent, name, fl )
{
catmb = 0;
icons = new LauncherIconView( this );
setFocusProxy(icons);
QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
icons->setItemsMovable( FALSE );
icons->setAutoArrange( TRUE );
icons->setSorting( TRUE );
icons->setFrameStyle( QFrame::NoFrame );
icons->setMargin( 0 );
icons->setSelectionMode( QIconView::NoSelection );
icons->setBackgroundMode( PaletteBase );
icons->setResizeMode( QIconView::Adjust );
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 7844673..9ea2418 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -13,61 +13,62 @@
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __TABCONFIG_H__
#define __TABCONFIG_H__
struct TabConfig {
enum ViewMode {
Icon,
List
};
enum BackgroundType {
Ruled,
SolidColor,
Image
};
ViewMode m_view;
BackgroundType m_bg_type;
QString m_last_directory;
QString m_bg_image;
QString m_bg_color;
int m_iconcolumns;
QString m_text_color;
bool m_font_use;
QString m_font_family;
int m_font_size;
int m_font_weight;
bool m_font_italic;
bool m_changed;
bool operator == ( const TabConfig &tc )
{
return ( m_view == tc. m_view ) &&
( m_bg_type == tc. m_bg_type ) &&
( m_bg_image == tc. m_bg_image ) &&
( m_bg_color == tc. m_bg_color ) &&
+ ( m_iconcolumns == tc. m_iconcolumns ) &&
( m_text_color == tc. m_text_color ) &&
( m_font_use == tc. m_font_use ) &&
( m_font_use ? (
( m_font_family == tc. m_font_family ) &&
( m_font_size == tc. m_font_size ) &&
( m_font_weight == tc. m_font_weight ) &&
( m_font_italic == tc. m_font_italic )
) : true );
}
};
#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index abe310f..bd51628 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -260,96 +260,97 @@ public:
( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
}
else
p-> fillRect ( r, m_bgcolor );
}
private:
QColor m_textcolor;
QColor m_bgcolor;
QPixmap m_bgpix;
TabConfig::BackgroundType m_bgtype;
};
TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl )
: QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc )
{
setCaption ( tr( "Edit Tab" ));
QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 );
OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
QWidget *bgtab;
tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" ));
tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
tw-> setCurrentTab ( bgtab );
QWidget *sample = new QVBox ( this );
QTabBar *tb = new QTabBar ( sample );
QString name ( tr( "Previewing %1" ). arg ( tabname ));
tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
m_sample = new SampleView ( sample );
lay-> addWidget ( tw, 10 );
lay-> addWidget ( sample, 1 );
m_iconsize-> setButton ( tc. m_view );
iconSizeClicked ( tc. m_view );
//m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
iconColorClicked ( m_iconcolor-> color ( ));
m_bgtype-> setButton ( tc. m_bg_type );
//m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
+ m_iconcolumns->setValue( tc. m_iconcolumns );
m_bgimage = tc. m_bg_image;
bgTypeClicked ( tc. m_bg_type );
m_fontuse-> setChecked ( tc. m_font_use );
m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
fontClicked ( m_fontselect-> selectedFont ( ));
QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
}
TabDialog::~TabDialog ( )
{
}
QWidget *TabDialog::createFontTab ( QWidget *parent )
{
QWidget *tab = new QWidget ( parent, "FontTab" );
QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
vertLayout-> addWidget ( m_fontuse );
m_fontselect = new OFontSelector ( false, tab, "fontsel" );
vertLayout-> addWidget ( m_fontselect );
connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool)));
connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
this, SLOT( fontClicked(const QFont&)));
return tab;
}
QWidget *TabDialog::createBgTab ( QWidget *parent )
{
QWidget *tab = new QWidget( parent, "BgTab" );
QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout );
gridLayout-> setColStretch ( 1, 10 );
QLabel* label = new QLabel( tr( "Type:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
m_bgtype = new QButtonGroup( tab, "buttongroup" );
m_bgtype-> hide ( );
m_bgtype-> setExclusive ( true );
QRadioButton *rb;
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index ab64331..42f0568 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -125,190 +125,194 @@ void TabsSettings::init ( )
}
void TabsSettings::readTabSettings ( Config &cfg )
{
QString grp ( "Tab %1" ); // No tr
m_tabs. clear ( );
TabConfig global_def;
global_def. m_view = TabConfig::Icon;
global_def. m_bg_type = TabConfig::Ruled;
global_def. m_bg_image = "launcher/opie-background";
global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( );
global_def. m_iconcolumns = 0; // automatic
global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( );
global_def. m_font_use = false;
global_def. m_font_family = font ( ). family ( );
global_def. m_font_size = font ( ). pointSize ( );
global_def. m_font_weight = 50;
global_def. m_font_italic = false;
global_def. m_changed = false;
Config cfg2 = Config( "Launchersettings" );
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
cfg. setGroup ( grp. arg ( *it ));
cfg2. setGroup( grp. arg ( *it ));
QString view = cfg. readEntry ( "View" );
if ( view == "Icon" ) // No tr
tc. m_view = TabConfig::Icon;
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType" );
if ( bgType == "Image" )
tc. m_bg_type = TabConfig::Image;
else if ( bgType == "SolidColor" )
tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
tc. m_bg_type = TabConfig::Image;
tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" );
tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns );
+ qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns );
tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
tc. m_font_use = true;
tc. m_font_family = f [0];
tc. m_font_size = f [1]. toInt ( );
tc. m_font_weight = f [2]. toInt ( );
tc. m_font_italic = ( f [3]. toInt ( ));
}
m_tabs [*it] = tc;
}
// if all tabs have the same config, then initialize the GLOBALID tab to these values
TabConfig *first = 0;
bool same = true;
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
if ( *it == GLOBALID )
continue;
else if ( !first )
first = &m_tabs [*it];
else
same &= ( *first == m_tabs [*it] );
}
if ( same ) {
m_tabs [GLOBALID] = *first;
m_tabs [GLOBALID]. m_changed = true;
}
}
void TabsSettings::accept ( )
{
Config cfg ( "Launcher" );
Config cfg2 ( "Launchersettings" );
// Launcher Tab
QString grp ( "Tab %1" ); // No tr
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig &tc = m_tabs [*it];
if ( !tc. m_changed )
continue;
cfg. setGroup ( grp. arg ( *it ));
cfg2. setGroup ( grp. arg ( *it ));
switch ( tc. m_view ) {
case TabConfig::Icon:
cfg.writeEntry ( "View", "Icon" );
break;
case TabConfig::List:
cfg.writeEntry ( "View", "List" );
break;
}
QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
e << *it << tc. m_view;
cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
cfg. writeEntry ( "Columns", tc. m_iconcolumns );
cfg. writeEntry ( "TextColor", tc. m_text_color );
cfg2. writeEntry ( "DefaultDir", tc.m_last_directory );
if ( tc. m_font_use ) {
QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
cfg. writeEntry ( "Font", f );
}
else
cfg. removeEntry ( "Font" );
QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
switch ( tc. m_bg_type ) {
case TabConfig::Ruled:
cfg.writeEntry( "BackgroundType", "Ruled" );
be << *it << tc. m_bg_type << QString("");
break;
case TabConfig::SolidColor:
cfg.writeEntry( "BackgroundType", "SolidColor" );
be << *it << tc. m_bg_type << tc. m_bg_color;
break;
case TabConfig::Image:
cfg.writeEntry( "BackgroundType", "Image" );
be << *it << tc. m_bg_type << tc. m_bg_image;
break;
}
QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
te << *it << tc. m_text_color;
- QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
+ QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" );
+ ic << *it << tc. m_iconcolumns;
+
+ QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
fe << *it;
fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
fe << tc. m_font_size;
fe << tc. m_font_weight;
fe << ( tc. m_font_italic ? 1 : 0 );
tc. m_changed = false;
}
cfg. setGroup ( "GUI" );
QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" );
cfg. writeEntry ( "BusyType", busytype );
cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) );
{
QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
e << busytype;
}
}
void TabsSettings::newClicked ( )
{
QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
}
void TabsSettings::deleteClicked ( )
{
int ind = m_list-> currentItem ( );
if ( ind < 0 )
return;
QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
}
void TabsSettings::editClicked ( )
{
int ind = m_list-> currentItem ( );
if ( ind < 0 )
return;
TabConfig tc = m_tabs [m_ids [ind]];
TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) {
tc. m_changed = true;