[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bplasmate=5D_/=3A_hmmmm=2C_90=25_of_the_code_inside_?=
From: Diego Casella <polentino911 () gmail ! com>
Date: 2011-04-15 7:24:36
Message-ID: 20110415072436.4DCCCA609B () git ! kde ! org
[Download RAW message or body]
Git commit 8f6672d7d6cc9c4606a9c8ab0ba036a1c1b7a6a5 by Diego Casella.
Committed on 15/04/2011 at 09:16.
Pushed by casella into branch 'master'.
hmmmm, 90% of the code inside setTimeLineVisible() actually reads the config of the \
TimeLine dock widget, creates a TimeLine object and connects it with the main widget, \
which makes very little sense.
* Removed setTimeLineVisible(), changed toggleTimeLine() and added an initTimeLine() \
method;
* Creating a savePoint works again now :)
M +11 -8 mainwindow.cpp
M +5 -5 mainwindow.h
http://commits.kde.org/plasmate/8f6672d7d6cc9c4606a9c8ab0ba036a1c1b7a6a5
diff --git a/mainwindow.cpp b/mainwindow.cpp
index fefb7e4..6c6d05b 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -199,7 +199,7 @@ void MainWindow::addAction(QString text, const char * icon, const \
char *slot, c connect(action, SIGNAL(triggered(bool)), this, slot);
actionCollection()->addAction(name, action);
}
-
+
void MainWindow::setupActions()
{
addAction(i18n("New Save Point"), "document-save", \
SLOT(selectSavePoint()), "savepoint"); @@ -213,10 +213,12 @@ void \
MainWindow::setupActions()
void MainWindow::toggleTimeline()
{
- setTimelineVisible(!m_timeLine || !m_timeLine->isVisible());
+ if (m_timeLine) {
+ m_timeLine->setVisible(!m_timeLine->isVisible());
+ }
}
-void MainWindow::setTimelineVisible(const bool visible)
+void MainWindow::initTimeLine()
{
KConfig c;
KConfigGroup configDock = c.group("DocksPosition");
@@ -224,19 +226,18 @@ void MainWindow::setTimelineVisible(const bool visible)
QVariant(Qt::TopDockWidgetArea)).toInt();
location = (Qt::DockWidgetArea) configDock.readEntry("TimeLineLocation",
\
QVariant(Qt::BottomDockWidgetArea)).toInt();
-
- if (visible && !m_timeLine) {
+
+ if (!m_timeLine) {
m_timeLine = new TimeLine(this, m_model->package(), location);
m_timeLine->setObjectName("timeline");
connect(m_timeLine, SIGNAL(sourceDirectoryChanged()),
this, SLOT(editorDestructiveRefresh()));
connect(m_timeLine, SIGNAL(savePointClicked()),
this, SLOT(saveEditorData()));
+ connect(this, SIGNAL(newSavePointClicked()),
+ m_timeLine, SLOT(newSavePoint()));
addDockWidget(location, m_timeLine);
}
- if (m_timeLine) {
- m_timeLine->setVisible(!m_timeLine->isVisible());
- }
}
void MainWindow::toggleFileList()
@@ -662,6 +663,8 @@ void MainWindow::loadProject(const QString &name, const QString \
&type) KUrl url = KUrl(packagePath + "contents/" + mainScript);
m_editPage->loadFile(url);
}
+ // After we loaded the project, init the TimeLine component
+ initTimeLine();
}
QStringList MainWindow::recentProjects()
diff --git a/mainwindow.h b/mainwindow.h
index 4d925d5..e9b40b8 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -81,8 +81,7 @@ public Q_SLOTS:
void togglePreview();
void toggleNotes();
void toggleFileList();
-
- void setTimelineVisible(const bool visible);
+
void setPreviewVisible(const bool visible);
void setNotesVisible(const bool visible);
void setFileListVisible(const bool visible);
@@ -94,15 +93,16 @@ signals:
void refreshRequested();
private:
-
+
KAction *m_savePointAction;
KAction *m_timelineAction;
KAction *m_publishAction;
KAction *m_previewAction;
KAction *m_notesAction;
KAction *m_fileListAction;
-
+
void setupActions();
+ void initTimeLine();
// QMainWindow takes control of and DELETES the previous centralWidget
// whenever a new one is set - this is bad because we want to preserve
@@ -136,7 +136,7 @@ private:
void setupTextEditor(KTextEditor::Document *editorPart, KTextEditor::View \
*view); void loadNotesEditor(QDockWidget *container);
Previewer* createPreviewerFor(const QString& projectType);
-
+
void addAction(QString text, const char * icon,const char *slot, const char \
*name);
StartPage *m_startPage;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic