SVN commit 1281800 by shaforo: Add welcome widget, that is shown on Lokalize first startup (when no project is loaded). So we're now a bit more friendly to newbies. CCMAIL:kde-i18n-doc@kde.org Note to translators: It uses strings that are already translated either in Lokalize or in kdelibs, so be careful to use translation memory to avoid doing same work twice. (actually it is possible that lokalize.po won't change at all, we'll see) M +61 -1 projecttab.cpp M +4 -0 projecttab.h --- branches/KDE/4.8/kdesdk/lokalize/src/project/projecttab.cpp #1281799:1281800 @@ -25,6 +25,7 @@ #include "project.h" #include "projectwidget.h" #include "tmscanapi.h" +#include "prefs.h" #include #include @@ -42,6 +43,9 @@ #include #include #include +#include +#include +#include ProjectTab::ProjectTab(QWidget *parent) : LokalizeSubwindowBase2(parent) @@ -52,7 +56,58 @@ { setWindowTitle(i18nc("@title:window","Project Overview"));//setCaption(i18nc("@title:window","Project"),false); +//BEGIN setup welcome widget + QWidget* welcomeWidget=new QWidget(this); + QVBoxLayout* wl=new QVBoxLayout(welcomeWidget); + QLabel* about = new QLabel(i18n("" //copied from kaboutkdedialog_p.cpp + "You do not have to be a software developer to be a member of the " + "KDE team. You can join the national teams that translate " + "program interfaces. You can provide graphics, themes, sounds, and " + "improved documentation. You decide!" + "

" + "Visit " + "%1 " + "for information on some projects in which you can participate." + "

" + "If you need more information or documentation, then a visit to " + "%2 " + "will provide you with what you need.", + QLatin1String("http://community.kde.org/Getinvolved"), + QLatin1String("http://techbase.kde.org/")), welcomeWidget); + about->setAlignment(Qt::AlignCenter); + about->setWordWrap(true); + about->setOpenExternalLinks(true); + about->setTextInteractionFlags(Qt::TextBrowserInteraction); + about->setTextFormat(Qt::RichText); + + QPushButton* conf = new QPushButton(i18n("&Configure %1...", "Lokalize"), welcomeWidget); + QPushButton* createProject = new QPushButton(i18nc("@action:inmenu","Create new project"), welcomeWidget); + QPushButton* openProject = new QPushButton(i18nc("@action:inmenu","Open project"), welcomeWidget); + connect(conf, SIGNAL(clicked(bool)), SettingsController::instance(),SLOT(showSettingsDialog())); + connect(openProject, SIGNAL(clicked(bool)), this, SIGNAL(projectOpenRequested())); + connect(createProject, SIGNAL(clicked(bool)), SettingsController::instance(), SLOT(projectCreate())); + QHBoxLayout* wbtnl=new QHBoxLayout(); + wbtnl->addStretch(1); + wbtnl->addWidget(conf); + wbtnl->addWidget(createProject); + wbtnl->addWidget(openProject); + wbtnl->addStretch(1); + + wl->addStretch(1); + wl->addWidget(about); + wl->addStretch(1); + wl->addLayout(wbtnl); + wl->addStretch(1); + + +//END setup welcome widget + QWidget* baseWidget=new QWidget(this); + m_stackedLayout = new QStackedLayout(baseWidget); QWidget* w=new QWidget(this); + m_stackedLayout->addWidget(welcomeWidget); + m_stackedLayout->addWidget(w); + connect(Project::instance(), SIGNAL(loaded()), this, SLOT(showRealProjectOverview())); + QVBoxLayout* l=new QVBoxLayout(w); @@ -69,7 +124,7 @@ this, SLOT(updateStatusBar(int,int,int,bool))); connect(Project::instance()->model(),SIGNAL(loading()),this,SLOT(initStatusBarProgress())); - setCentralWidget(w); + setCentralWidget(baseWidget); KHBox *progressBox = new KHBox(); KStatusBar* statusBar = static_cast(parent)->statusBar(); @@ -142,6 +197,11 @@ //kWarning()<<"destroyed"; } +void ProjectTab::showRealProjectOverview() +{ + m_stackedLayout->setCurrentIndex(1); +} + KUrl ProjectTab::currentUrl() { return KUrl::fromLocalFile(Project::instance()->projectDir()); --- branches/KDE/4.8/kdesdk/lokalize/src/project/projecttab.h #1281799:1281800 @@ -31,6 +31,7 @@ #include +class QStackedLayout; class ProjectWidget; class KLineEdit; class QContextMenuEvent; @@ -74,6 +75,7 @@ ///@returns list of selected files recursively Q_SCRIPTABLE QStringList selectedItems() const; Q_SCRIPTABLE bool currentItemIsTranslationFile() const; + void showRealProjectOverview(); //Q_SCRIPTABLE bool isShown() const; @@ -105,6 +107,8 @@ KLineEdit* m_filterEdit; QProgressBar* m_progressBar; + QStackedLayout *m_stackedLayout; + int m_legacyUnitsCount, m_currentUnitsCount; };